diff --git a/alibabacloud_oss_v2/_client.py b/alibabacloud_oss_v2/_client.py index 394e3b7..33fcaec 100644 --- a/alibabacloud_oss_v2/_client.py +++ b/alibabacloud_oss_v2/_client.py @@ -32,7 +32,7 @@ class AddressStyle(): - """_summary_ + """address style information """ Virtual = 1 Path = 2 @@ -62,7 +62,7 @@ def __init__( self._seekable = False def is_seekable(self) -> bool: - """'_summary_ + """'is seekable Returns: bool: _description_ @@ -70,7 +70,7 @@ def is_seekable(self) -> bool: return self._seekable def mark(self) -> None: - """_summary_ + """Set the current marked position in the stream. """ if self.is_seekable() is False: return @@ -79,7 +79,7 @@ def mark(self) -> None: self._io_curr = self._body.tell() def reset(self) -> None: - """_summary_ + """Resets the buffer to the marked position. The marked position """ if self.is_seekable() is False: return @@ -208,14 +208,14 @@ def verify_operation(self, op_input: OperationInput, options: _Options) -> None: raise exceptions.ObjectNameInvalidError() def apply_operation(self, options: _Options, op_input: OperationInput) -> None: - """_summary_""" + """apply operation""" self._apply_operation_options(options) # pylint: disable=no-member _apply_operation_metadata(op_input, options) def build_request_context(self, op_input: OperationInput, options: _Options, inner: _InnerOptions ) -> SigningContext: - """_summary_ + """build request context """ # host & path url = _build_url(op_input, options) @@ -273,7 +273,7 @@ def build_request_context(self, op_input: OperationInput, options: _Options, inn return context def retry_max_attempts(self, options: _Options) -> int: - """_summary_""" + """retry max attempts""" if options.retry_max_attempts is not None: attempts = int(options.retry_max_attempts) elif options.retryer is not None: @@ -284,11 +284,11 @@ def retry_max_attempts(self, options: _Options) -> int: return max(1, attempts) def has_feature(self, flag: int) -> bool: - """_summary_""" + """has feature""" return (self._options.feature_flags & flag) > 0 # pylint: disable=no-member def get_retry_attempts(self) -> bool: - """_summary_""" + """sumget retry attemptsmary""" return self.retry_max_attempts(self._options) # pylint: disable=no-member class _SyncClientImpl(_ClientImplMixIn): @@ -303,7 +303,7 @@ def __init__(self, config: Config, **kwargs) -> None: self._inner = inner def invoke_operation(self, op_input: OperationInput, **kwargs) -> OperationOutput: - """_summary_ + """Common class interface invoice operation Args: op_input (OperationInput): _description_ diff --git a/alibabacloud_oss_v2/checkpoint.py b/alibabacloud_oss_v2/checkpoint.py index 1ce2aa5..b921426 100644 --- a/alibabacloud_oss_v2/checkpoint.py +++ b/alibabacloud_oss_v2/checkpoint.py @@ -46,7 +46,7 @@ # } class DownloadCheckpoint: - """_summary_ + """Download Checkpoint """ def __init__( self, @@ -189,7 +189,7 @@ def _is_valid(self) -> bool: return False def dump(self) -> bool: - """_summary_ + """dump Returns: _type_: _description_ @@ -247,7 +247,7 @@ def remove(self) -> None: # } class UploadCheckpoint: - """_summary_ + """Upload Checkpoint """ def __init__( self, @@ -352,7 +352,7 @@ def _is_valid(self) -> bool: return False def dump(self) -> bool: - """_summary_ + """dump Returns: _type_: _description_ @@ -377,7 +377,7 @@ def dump(self) -> bool: return True def remove(self) -> None: - """_summary_ + """remove """ try: os.remove(self.cp_filepath) diff --git a/alibabacloud_oss_v2/client.py b/alibabacloud_oss_v2/client.py index 375fd82..1c4bef0 100644 --- a/alibabacloud_oss_v2/client.py +++ b/alibabacloud_oss_v2/client.py @@ -1,5 +1,5 @@ # pylint: disable=line-too-long -"""_summary_""" +"""Client used to interact with **Alibaba Cloud Object Storage Service (OSS)**.""" import copy from typing import Optional from .config import Config @@ -29,11 +29,11 @@ from .filelike import AppendOnlyFile, ReadOnlyFile class Client: - """_summary_ + """Client """ def __init__(self, config: Config, **kwargs) -> None: - """_summary_ + """Initialize Client Args: config (Config): _description_ @@ -45,7 +45,7 @@ def __repr__(self) -> str: def invoke_operation(self, op_input: OperationInput, **kwargs ) -> OperationOutput: - """_summary_ + """invoke operation Args: op_input (OperationInput): _description_ @@ -65,7 +65,7 @@ def list_buckets(self, request: models.ListBucketsRequest, **kwargs request (ListBucketsRequest): Request parameters for ListBuckets operation. Returns: - ListBucketsResult: Reponse result for ListBuckets operation. + ListBucketsResult: Response result for ListBuckets operation. """ return operations.list_buckets(self._client, request, **kwargs) @@ -97,7 +97,7 @@ def put_bucket(self, request: models.PutBucketRequest, **kwargs request (PutBucketRequest): Request parameters for PutBucket operation. Returns: - PutBucketResult: Reponse result for PutBucket operation. + PutBucketResult: Response result for PutBucket operation. """ return operations.put_bucket(self._client, request, **kwargs) @@ -111,7 +111,7 @@ def delete_bucket(self, request: models.DeleteBucketRequest, **kwargs request (DeleteBucketRequest): Request parameters for DeleteBucket operation. Returns: - DeleteBucketResult: Reponse result for DeleteBucket operation. + DeleteBucketResult: Response result for DeleteBucket operation. """ return operations.delete_bucket(self._client, request, **kwargs) @@ -125,7 +125,7 @@ def list_objects(self, request: models.ListObjectsRequest, **kwargs request (ListObjectsRequest): Request parameters for ListObjects operation. Returns: - ListObjectsResult: Reponse result for ListObjects operation. + ListObjectsResult: Response result for ListObjects operation. """ return operations.list_objects(self._client, request, **kwargs) @@ -168,7 +168,7 @@ def list_objects_v2(self, request: models.ListObjectsV2Request, **kwargs request (ListObjectsV2Request): Request parameters for ListObjectsV2 operation. Returns: - ListObjectsV2Result: Reponse result for ListObjectsV2 operation. + ListObjectsV2Result: Response result for ListObjectsV2 operation. """ return operations.list_objects_v2(self._client, request, **kwargs) @@ -253,7 +253,7 @@ def list_object_versions(self, request: models.ListObjectVersionsRequest, **kwar request (ListObjectVersionsRequest): Request parameters for ListObjectVersions operation. Returns: - ListObjectVersionsResult: Reponse result for ListObjectVersions operation. + ListObjectVersionsResult: Response result for ListObjectVersions operation. """ return operations.list_object_versions(self._client, request, **kwargs) @@ -268,7 +268,7 @@ def put_object(self, request: models.PutObjectRequest, **kwargs request (PutObjectRequest): Request parameters for PutObject operation. Returns: - PutObjectResult: Reponse result for PutObject operation. + PutObjectResult: Response result for PutObject operation. """ return operations.put_object(self._client, request, **kwargs) @@ -282,7 +282,7 @@ def get_object(self, request: models.GetObjectRequest, **kwargs request (GetObjectRequest): Request parameters for GetObject operation. Returns: - GetObjectResult: Reponse result for GetObject operation. + GetObjectResult: Response result for GetObject operation. """ return operations.get_object(self._client, request, **kwargs) @@ -296,7 +296,7 @@ def copy_object(self, request: models.CopyObjectRequest, **kwargs request (CopyObjectRequest): Request parameters for CopyObject operation. Returns: - CopyObjectResult: Reponse result for CopyObject operation. + CopyObjectResult: Response result for CopyObject operation. """ return operations.copy_object(self._client, request, **kwargs) @@ -311,7 +311,7 @@ def append_object(self, request: models.AppendObjectRequest, **kwargs request (AppendObjectRequest): Request parameters for AppendObject operation. Returns: - AppendObjectResult: Reponse result for AppendObject operation. + AppendObjectResult: Response result for AppendObject operation. """ return operations.append_object(self._client, request, **kwargs) @@ -325,21 +325,21 @@ def delete_object(self, request: models.DeleteObjectRequest, **kwargs request (DeleteObjectRequest): Request parameters for DeleteObject operation. Returns: - DeleteObjectResult: Reponse result for DeleteObject operation. + DeleteObjectResult: Response result for DeleteObject operation. """ return operations.delete_object(self._client, request, **kwargs) - def delete_multiple_objects(self, request: models.DeleteMultipleObjectsResult, **kwargs + def delete_multiple_objects(self, request: models.DeleteMultipleObjectsRequest, **kwargs ) -> models.DeleteMultipleObjectsResult: """ Deletes multiple objects from a bucket. Args: - request (DeleteMultipleObjectsResult): Request parameters for DeleteMultipleObjects operation. + request (DeleteMultipleObjectsRequest): Request parameters for DeleteMultipleObjects operation. Returns: - DeleteMultipleObjectsResult: Reponse result for DeleteMultipleObjects operation. + DeleteMultipleObjectsResult: Response result for DeleteMultipleObjects operation. """ return operations.delete_multiple_objects(self._client, request, **kwargs) @@ -353,7 +353,7 @@ def head_object(self, request: models.HeadObjectRequest, **kwargs request (HeadObjectRequest): Request parameters for HeadObject operation. Returns: - HeadObjectResult: Reponse result for HeadObject operation. + HeadObjectResult: Response result for HeadObject operation. """ return operations.head_object(self._client, request, **kwargs) @@ -367,7 +367,7 @@ def get_object_meta(self, request: models.GetObjectMetaRequest, **kwargs request (GetObjectMetaRequest): Request parameters for GetObjectMeta operation. Returns: - GetObjectMetaResult: Reponse result for GetObjectMeta operation. + GetObjectMetaResult: Response result for GetObjectMeta operation. """ return operations.get_object_meta(self._client, request, **kwargs) @@ -381,7 +381,7 @@ def restore_object(self, request: models.RestoreObjectRequest, **kwargs request (RestoreObjectRequest): Request parameters for RestoreObject operation. Returns: - RestoreObjectResult: Reponse result for RestoreObject operation. + RestoreObjectResult: Response result for RestoreObject operation. """ return operations.restore_object(self._client, request, **kwargs) @@ -395,7 +395,7 @@ def put_object_acl(self, request: models.PutObjectAclRequest, **kwargs request (PutObjectAclRequest): Request parameters for PutObjectAcl operation. Returns: - PutObjectAclResult: Reponse result for PutObjectAcl operation. + PutObjectAclResult: Response result for PutObjectAcl operation. """ return operations.put_object_acl(self._client, request, **kwargs) @@ -409,7 +409,7 @@ def get_object_acl(self, request: models.GetObjectAclRequest, **kwargs request (GetObjectAclRequest): Request parameters for GetObjectAcl operation. Returns: - GetObjectAclResult: Reponse result for GetObjectAcl operation. + GetObjectAclResult: Response result for GetObjectAcl operation. """ return operations.get_object_acl(self._client, request, **kwargs) @@ -423,7 +423,7 @@ def initiate_multipart_upload(self, request: models.InitiateMultipartUploadReque request (InitiateMultipartUploadRequest): Request parameters for InitiateMultipartUpload operation. Returns: - InitiateMultipartUploadResult: Reponse result for InitiateMultipartUpload operation. + InitiateMultipartUploadResult: Response result for InitiateMultipartUpload operation. """ return operations.initiate_multipart_upload(self._client, request, **kwargs) @@ -437,7 +437,7 @@ def upload_part(self, request: models.UploadPartRequest, **kwargs request (UploadPartRequest): Request parameters for UploadPart operation. Returns: - UploadPartResult: Reponse result for UploadPart operation. + UploadPartResult: Response result for UploadPart operation. """ return operations.upload_part(self._client, request, **kwargs) @@ -452,7 +452,7 @@ def upload_part_copy(self, request: models.UploadPartCopyRequest, **kwargs request (UploadPartCopyRequest): Request parameters for UploadPartCopy operation. Returns: - UploadPartCopyResult: Reponse result for UploadPartCopy operation. + UploadPartCopyResult: Response result for UploadPartCopy operation. """ return operations.upload_part_copy(self._client, request, **kwargs) @@ -466,7 +466,7 @@ def complete_multipart_upload(self, request: models.CompleteMultipartUploadReque request (CompleteMultipartUploadRequest): Request parameters for CompleteMultipartUpload operation. Returns: - CompleteMultipartUploadResult: Reponse result for CompleteMultipartUpload operation. + CompleteMultipartUploadResult: Response result for CompleteMultipartUpload operation. """ return operations.complete_multipart_upload(self._client, request, **kwargs) @@ -480,7 +480,7 @@ def abort_multipart_upload(self, request: models.AbortMultipartUploadRequest, ** request (AbortMultipartUploadRequest): Request parameters for AbortMultipartUpload operation. Returns: - AbortMultipartUploadResult: Reponse result for AbortMultipartUpload operation. + AbortMultipartUploadResult: Response result for AbortMultipartUpload operation. """ return operations.abort_multipart_upload(self._client, request, **kwargs) @@ -494,7 +494,7 @@ def list_multipart_uploads(self, request: models.ListMultipartUploadsRequest, ** request (ListMultipartUploadsRequest): Request parameters for ListMultipartUploads operation. Returns: - ListMultipartUploadsResult: Reponse result for ListMultipartUploads operation. + ListMultipartUploadsResult: Response result for ListMultipartUploads operation. """ return operations.list_multipart_uploads(self._client, request, **kwargs) @@ -508,7 +508,7 @@ def list_parts(self, request: models.ListPartsRequest, **kwargs request (ListPartsRequest): Request parameters for ListParts operation. Returns: - ListPartsResult: Reponse result for ListParts operation. + ListPartsResult: Response result for ListParts operation. """ return operations.list_parts(self._client, request, **kwargs) @@ -523,7 +523,7 @@ def put_symlink(self, request: models.PutSymlinkRequest, **kwargs request (PutSymlinkRequest): Request parameters for PutSymlink operation. Returns: - PutSymlinkResult: Reponse result for PutSymlink operation. + PutSymlinkResult: Response result for PutSymlink operation. """ return operations.put_symlink(self._client, request, **kwargs) @@ -537,7 +537,7 @@ def get_symlink(self, request: models.GetSymlinkRequest, **kwargs request (GetSymlinkRequest): Request parameters for GetSymlink operation. Returns: - GetSymlinkResult: Reponse result for GetSymlink operation. + GetSymlinkResult: Response result for GetSymlink operation. """ return operations.get_symlink(self._client, request, **kwargs) @@ -551,7 +551,7 @@ def put_object_tagging(self, request: models.PutObjectTaggingRequest, **kwargs request (PutObjectTaggingRequest): Request parameters for PutObjectTagging operation. Returns: - PutObjectTaggingResult: Reponse result for PutObjectTagging operation. + PutObjectTaggingResult: Response result for PutObjectTagging operation. """ return operations.put_object_tagging(self._client, request, **kwargs) @@ -565,7 +565,7 @@ def get_object_tagging(self, request: models.GetObjectTaggingRequest, **kwargs request (GetObjectTaggingRequest): Request parameters for GetObjectTagging operation. Returns: - GetObjectTaggingResult: Reponse result for GetObjectTagging operation. + GetObjectTaggingResult: Response result for GetObjectTagging operation. """ return operations.get_object_tagging(self._client, request, **kwargs) @@ -579,7 +579,7 @@ def delete_object_tagging(self, request: models.DeleteObjectTaggingRequest, **kw request (DeleteObjectTaggingRequest): Request parameters for DeleteObjectTagging operation. Returns: - DeleteObjectTaggingResult: Reponse result for DeleteObjectTagging operation. + DeleteObjectTaggingResult: Response result for DeleteObjectTagging operation. """ return operations.delete_object_tagging(self._client, request, **kwargs) @@ -593,7 +593,7 @@ def process_object(self, request: models.ProcessObjectRequest, **kwargs request (ProcessObjectRequest): Request parameters for ProcessObject operation. Returns: - ProcessObjectResult: Reponse result for ProcessObject operation. + ProcessObjectResult: Response result for ProcessObject operation. """ return operations.process_object(self._client, request, **kwargs) @@ -607,7 +607,7 @@ def async_process_object(self, request: models.AsyncProcessObjectRequest, **kwar request (AsyncProcessObjectRequest): Request parameters for AsyncProcessObject operation. Returns: - AsyncProcessObjectResult: Reponse result for AsyncProcessObject operation. + AsyncProcessObjectResult: Response result for AsyncProcessObject operation. """ return operations.async_process_object(self._client, request, **kwargs) @@ -635,7 +635,7 @@ def list_objects_paginator(self, **kwargs) -> ListObjectsPaginator: """ return ListObjectsPaginator(self, **kwargs) - def list_objects_v2_paginator(self, **kwargs) -> ListObjectsPaginator: + def list_objects_v2_paginator(self, **kwargs) -> ListObjectsV2Paginator: """Creates a paginator for ListObjectsV2 Returns: @@ -679,7 +679,7 @@ def list_multipart_uploads_paginator(self, **kwargs) -> ListMultipartUploadsPagi # transfer managers def downloader(self, **kwargs) -> Downloader: - """_summary_ + """downloader Args: @@ -689,7 +689,7 @@ def downloader(self, **kwargs) -> Downloader: return Downloader(self, **kwargs) def uploader(self, **kwargs) -> Uploader: - """_summary_ + """uploader Returns: Uploader: _description_ @@ -818,7 +818,7 @@ def is_bucket_exist(self, bucket: str, request_payer: Optional[str] = None, **kw return result is not None def put_object_from_file(self, request: models.PutObjectRequest, filepath: str, **kwargs) -> models.PutObjectResult: - """_summary_ + """put object from file Args: request (models.PutObjectRequest): _description_ @@ -833,7 +833,7 @@ def put_object_from_file(self, request: models.PutObjectRequest, filepath: str, return self.put_object(req, **kwargs) def get_object_to_file(self, request: models.GetObjectRequest, filepath: str, **kwargs) -> models.GetObjectResult: - """_summary_ + """get object to file Args: request (models.GetObjectRequest): _description_ @@ -2148,3 +2148,16 @@ def put_bucket_https_config(self, request: models.PutBucketHttpsConfigRequest, * """ return operations.put_bucket_https_config(self._client, request, **kwargs) + # clean restored + def clean_restored_object(self, request: models.CleanRestoredObjectRequest, **kwargs + ) -> models.CleanRestoredObjectResult: + """ + You can call this operation to clean an object restored from Archive or Cold Archive state. After that, the restored object returns to the frozen state. + + Args: + request (CleanRestoredObjectRequest): Request parameters for CleanRestoredObject operation. + + Returns: + CleanRestoredObjectResult: Response result for CleanRestoredObject operation. + """ + return operations.clean_restored_object(self._client, request, **kwargs) \ No newline at end of file diff --git a/alibabacloud_oss_v2/crc.py b/alibabacloud_oss_v2/crc.py index 89114fd..9ce1499 100644 --- a/alibabacloud_oss_v2/crc.py +++ b/alibabacloud_oss_v2/crc.py @@ -225,7 +225,7 @@ def write(self, data: bytes): @staticmethod def combine(crc1, crc2, size) -> int: - """_summary_ + """combine Args: crc1 (_type_): _description_ diff --git a/alibabacloud_oss_v2/crypto/aes_ctr.py b/alibabacloud_oss_v2/crypto/aes_ctr.py index dd37e96..3ca9a38 100644 --- a/alibabacloud_oss_v2/crypto/aes_ctr.py +++ b/alibabacloud_oss_v2/crypto/aes_ctr.py @@ -17,7 +17,7 @@ def _iv_to_big_int(iv: bytes) -> int: return iv_big_int class IteratorEncryptor(): - """_summary_ + """Iterator Encryptor """ def __init__( @@ -73,7 +73,7 @@ def __next__(self): raise err class IterableEncryptor(): - """_summary_ + """Iterable Encryptor """ def __init__( @@ -93,7 +93,7 @@ def __iter__(self): counter=self._counter) class FileLikeEncryptor(): - """_summary_ + """File Like Encryptor """ def __init__( self, @@ -109,7 +109,7 @@ def __init__( self._offset = offset def read(self, n: int = -1) -> AnyStr: - """_summary_ + """read Args: n (int, optional): _description_. Defaults to -1. @@ -131,7 +131,7 @@ def read(self, n: int = -1) -> AnyStr: return self._cipher.encrypt(self._reader.read(n)) def seek(self, offset: int, whence: int = 0) -> int: - """_summary_ + """seek Args: offset (int): _description_ @@ -149,13 +149,13 @@ def seek(self, offset: int, whence: int = 0) -> int: return offset def tell(self) -> int: - """_summary_ + """tell """ return self._reader.tell() class StreamBodyDecryptor(StreamBody): - """_summary_ + """Stream Body Decryptor """ def __init__( self, @@ -219,7 +219,7 @@ def __init__( self.no_str = False def encrypt(self, src: Any) -> Any: - """_summary_ + """encrypt data Args: src (Any): _description_ @@ -246,7 +246,7 @@ def encrypt(self, src: Any) -> Any: raise TypeError(f'src is not str/bytes/file-like/Iterable type, got {type(src)}') def decrypt(self, src: Any) -> Any: - """_summary_ + """decrypt data Args: src (Any): _description_ @@ -268,7 +268,7 @@ def _get_cipher(self): @staticmethod def random_key() -> bytes: - """_summary_ + """random key Returns: bytes: _description_ @@ -277,7 +277,7 @@ def random_key() -> bytes: @staticmethod def random_iv() -> bytes: - """_summary_ + """random iv Returns: bytes: _description_ diff --git a/alibabacloud_oss_v2/crypto/aes_ctr_cipher.py b/alibabacloud_oss_v2/crypto/aes_ctr_cipher.py index e6721b9..64965cd 100644 --- a/alibabacloud_oss_v2/crypto/aes_ctr_cipher.py +++ b/alibabacloud_oss_v2/crypto/aes_ctr_cipher.py @@ -19,18 +19,18 @@ def __init__( self._cipher = _AesCtr(cipher_data, offset) def encrypt_content(self, data: Any) -> Any: - """_summary_ + """encrypt content """ return self._cipher.encrypt(data) def decrypt_content(self, data: Any) -> Any: - """_summary_ + """decrypt content """ reader = self._cipher.decrypt(data) return reader def clone(self, **kwargs) -> ContentCipher: - """_summary_ + """clone """ return _AESCtrCipher( cipher_data=self._cipher_data, @@ -50,7 +50,7 @@ def get_align_len(self) -> int: class AESCtrCipherBuilder(ContentCipherBuilder): - """_summary_ + """AES Ctr Cipher Builder Args: ContentCipherBuilder (_type_): _description_ diff --git a/alibabacloud_oss_v2/crypto/cipher.py b/alibabacloud_oss_v2/crypto/cipher.py index 60baa60..c83037a 100644 --- a/alibabacloud_oss_v2/crypto/cipher.py +++ b/alibabacloud_oss_v2/crypto/cipher.py @@ -6,7 +6,7 @@ class Encrypter(abc.ABC): @abc.abstractmethod def encrypt(self, reader: Any) -> Any: - """_summary_ + """encrypt """ @@ -15,9 +15,9 @@ class Decrypter(abc.ABC): @abc.abstractmethod def decrypt(self, reader: Any) -> Any: - """_summary_ + """decrypt """ class Cipher(Encrypter, Decrypter): - """_summary_ + """Cipher """ diff --git a/alibabacloud_oss_v2/crypto/types.py b/alibabacloud_oss_v2/crypto/types.py index f7be42a..9bfb74b 100644 --- a/alibabacloud_oss_v2/crypto/types.py +++ b/alibabacloud_oss_v2/crypto/types.py @@ -9,22 +9,22 @@ class MasterCipher(abc.ABC): @abc.abstractmethod def encrypt(self, data: bytes) -> bytes: - """_summary_ + """encrypt data """ @abc.abstractmethod def decrypt(self, data: bytes) -> bytes: - """_summary_ + """decrypt data """ @abc.abstractmethod def get_wrap_algorithm(self) -> str: - """_summary_ + """get wrap algorithm """ @abc.abstractmethod def get_mat_desc(self) -> str: - """_summary_ + """get mat desc """ class ContentCipher(abc.ABC): @@ -32,32 +32,32 @@ class ContentCipher(abc.ABC): @abc.abstractmethod def encrypt_content(self, data: Any) -> Any: - """_summary_ + """encrypt content """ @abc.abstractmethod def decrypt_content(self, data: Any) -> Any: - """_summary_ + """decrypt content """ @abc.abstractmethod def clone(self, **kwargs) -> "ContentCipher": - """_summary_ + """clone """ @abc.abstractmethod def get_encrypted_len(self, plain_text_len: int) -> int: - """_summary_ + """get encrypted len """ @abc.abstractmethod def get_cipher_data(self) -> "CipherData": - """_summary_ + """get cipher data """ @abc.abstractmethod def get_align_len(self) -> int: - """_summary_ + """get align len """ @@ -83,7 +83,7 @@ def __init__( self.unencrypted_content_length = unencrypted_content_length def is_valid(self) -> bool: - """_summary_ + """is valid Returns: bool: _description_ @@ -95,7 +95,7 @@ def is_valid(self) -> bool: def random_key_iv(self): - """_summary_ + """random key iv """ class CipherData: @@ -120,7 +120,7 @@ def __init__( self.cek_algorithm = cek_algorithm def clone(self) -> "CipherData": - """_summary_ + """clone Returns: CipherData: _description_ @@ -128,7 +128,7 @@ def clone(self) -> "CipherData": return copy.deepcopy(self) def random_key_iv(self): - """_summary_ + """random key iv """ @@ -137,15 +137,15 @@ class ContentCipherBuilder(abc.ABC): @abc.abstractmethod def content_cipher(self) -> ContentCipher: - """_summary_ + """content cipher """ @abc.abstractmethod def content_cipher_from_env(self, env: Envelope, **kwargs) -> ContentCipher: - """_summary_ + """content cipher from env """ @abc.abstractmethod def get_mat_desc(self) -> str: - """_summary_ + """get mat desc """ diff --git a/alibabacloud_oss_v2/downloader.py b/alibabacloud_oss_v2/downloader.py index 7f94cd9..4360bcb 100644 --- a/alibabacloud_oss_v2/downloader.py +++ b/alibabacloud_oss_v2/downloader.py @@ -29,7 +29,7 @@ def get_object(self, request: models.GetObjectRequest, **kwargs) -> models.GetOb """ class DownloaderOptions: - """_summary_ + """downloader options """ def __init__( @@ -52,7 +52,7 @@ def __init__( class DownloadResult: - """_summary_ + """download result """ def __init__( @@ -116,7 +116,7 @@ def download_file( filepath: str, **kwargs: Any ) -> DownloadResult: - """_summary_ + """download file Args: request (models.GetObjectRequest): _description_ @@ -156,7 +156,7 @@ def download_to( writer: IO[bytes], **kwargs: Any ) -> DownloadResult: - """_summary_ + """download to Args: request (models.GetObjectRequest): _description_ @@ -270,12 +270,12 @@ def __init__( @property def writer_filepath(self) -> str: - """_summary_ + """writer filepath """ return self._temp_filepath def check_source(self): - """_summary_ + """check source """ request = models.HeadObjectRequest(self._reqeust.bucket, self._reqeust.key) copy_request(request, self._reqeust) @@ -287,7 +287,7 @@ def check_source(self): self._headers = result.headers def check_destination(self, filepath: str): - """_summary_ + """check destination """ if len(utils.safety_str(filepath)) == 0: raise exceptions.ParamInvalidError(field='filepath') @@ -302,7 +302,7 @@ def check_destination(self, filepath: str): def adjust_range(self): - """_summary_ + """adjust range """ self._pos = 0 self._rstart = 0 @@ -320,7 +320,7 @@ def adjust_range(self): self._epos = min(range_header[1] + 1, self._size_in_bytes) def check_checkpoint(self): - """_summary_ + """check checkpoint """ if not self._options.enable_checkpoint: return @@ -347,7 +347,7 @@ def check_checkpoint(self): def adjust_writer(self, writer:IO[bytes]): - """_summary_ + """adjust writer Args: writer (_type_): _description_ @@ -360,7 +360,7 @@ def adjust_writer(self, writer:IO[bytes]): self._writer = writer def close_writer(self, writer:IO[bytes]): - """_summary_ + """close writer Args: writer (_type_): _description_ @@ -378,7 +378,7 @@ def close_writer(self, writer:IO[bytes]): self._checkpoint = None def update_crc_flag(self): - """_summary_ + """update crc flag """ #FF_ENABLE_CRC64_CHECK_DOWNLOAD if (self._base._feature_flags & 0x00000010) > 0: @@ -386,7 +386,7 @@ def update_crc_flag(self): self._calc_crc = (self._checkpoint is not None and self._checkpoint.verify_data) or self._check_crc def download(self) -> DownloadResult: - """_summary_ + """Breakpoint download """ parallel = self._options.parallel_num > 1 seekable = utils.is_seekable(self._writer) diff --git a/alibabacloud_oss_v2/encryption_client.py b/alibabacloud_oss_v2/encryption_client.py index f5a010a..3675c3a 100644 --- a/alibabacloud_oss_v2/encryption_client.py +++ b/alibabacloud_oss_v2/encryption_client.py @@ -1,5 +1,5 @@ # pylint: disable=line-too-long -"""_summary_""" +"""Encryption Client""" import copy import base64 from typing import MutableMapping, List, Optional, cast @@ -27,7 +27,7 @@ def __init__( self.part_size = part_size def is_valid(self) -> bool: - """_summary_ + """is valid """ if (self.content_cipher is None or self.data_size == 0 or @@ -37,7 +37,7 @@ def is_valid(self) -> bool: return True class EncryptionClient: - """_summary_ + """Encryption Client """ def __init__( @@ -57,7 +57,7 @@ def __init__( self._ccbuilders[mat_desc] = AESCtrCipherBuilder(mc) def unwrap(self) -> Client: - """_summary_ + """unwrap Returns: Client: _description_ diff --git a/alibabacloud_oss_v2/exceptions.py b/alibabacloud_oss_v2/exceptions.py index c0125e8..459c84f 100644 --- a/alibabacloud_oss_v2/exceptions.py +++ b/alibabacloud_oss_v2/exceptions.py @@ -1,4 +1,4 @@ -"""_summary_ +"""exception information """ diff --git a/alibabacloud_oss_v2/filelike.py b/alibabacloud_oss_v2/filelike.py index 96b66d0..adb6c99 100644 --- a/alibabacloud_oss_v2/filelike.py +++ b/alibabacloud_oss_v2/filelike.py @@ -793,7 +793,7 @@ def __next__(self): return None def get_task(self) -> Future: - """_summary_ + """get task Returns: Future: _description_ @@ -801,7 +801,7 @@ def get_task(self) -> Future: return self._task def close(self): - """_summary_ + """close """ if self._closed: return diff --git a/alibabacloud_oss_v2/io_utils.py b/alibabacloud_oss_v2/io_utils.py index 84bc5fd..cf92877 100644 --- a/alibabacloud_oss_v2/io_utils.py +++ b/alibabacloud_oss_v2/io_utils.py @@ -26,12 +26,12 @@ def __next__(self): return d def seekable(self): - """_summary_ + """Is there a file pointer offset """ return self._seekable def reset(self) -> None: - """_summary_ + """Resets the buffer to the marked position. The marked position """ if self._writers is not None: for w in self._writers: @@ -76,7 +76,7 @@ def from_source(source: Any, writers: List[Any], **kwargs: Any) -> "TeeIterator" class _TeeIteratorStr(TeeIterator): - """_summary_ + """Iterator str information """ def __init__( @@ -97,7 +97,7 @@ def __len__(self): return len(self._data) def iter_bytes(self): - """_summary_ + """iter bytes """ self._content = self._data.encode() self._total = len(self._content) @@ -105,7 +105,7 @@ def iter_bytes(self): return self def next(self): - """_summary_ + """Next data """ if self._offset >= self._total: raise StopIteration @@ -120,7 +120,7 @@ def next(self): class _TeeIteratorBytes(TeeIterator): - """_summary_ + """Iterator bytes information """ def __init__( @@ -141,7 +141,7 @@ def __len__(self): return len(self._data) def iter_bytes(self): - """_summary_ + """iter bytes """ self._content = self._data self._total = len(self._content) @@ -149,7 +149,7 @@ def iter_bytes(self): return self def next(self): - """_summary_ + """Next data """ if self._offset >= self._total: raise StopIteration @@ -163,7 +163,7 @@ def next(self): return ret class _TeeIteratorIOLen(TeeIterator): - """_summary_ + """Iterator io len information """ def __init__( @@ -185,7 +185,7 @@ def __len__(self): return self._total def iter_bytes(self): - """_summary_ + """iter bytes """ if self._seekable: self._data.seek(self._start_offset, os.SEEK_SET) @@ -193,7 +193,7 @@ def iter_bytes(self): return self def next(self): - """_summary_ + """Next data """ d = self._data.read(self._block_size) @@ -203,7 +203,7 @@ def next(self): raise StopIteration class _TeeIteratorIO(TeeIterator): - """_summary_ + """Iterator io information """ def __init__( @@ -225,7 +225,7 @@ def __init__( setattr(self, '__len__', lambda x: x._total) def iter_bytes(self): - """_summary_ + """iter bytes """ if self._seekable: self._data.seek(self._start_offset, os.SEEK_SET) @@ -233,7 +233,7 @@ def iter_bytes(self): return self def next(self): - """_summary_ + """Next data """ d = self._data.read(self._block_size) @@ -244,7 +244,7 @@ def next(self): class _TeeIteratorIter(TeeIterator): - """_summary_ + """Iterator iter information """ def __init__( @@ -260,7 +260,7 @@ def __init__( self._cast_func = None def iter_bytes(self): - """_summary_ + """iter bytes """ if isinstance(self._data, Iterator): self._iter = self._data @@ -269,7 +269,7 @@ def iter_bytes(self): return self def next(self): - """_summary_ + """Next data """ return self._to_bytes(next(self._iter)) @@ -288,7 +288,7 @@ def _to_bytes(self, d) -> bytes: def is_seekable_io(fileobj): - """_summary_ + """is seekable io """ if hasattr(fileobj, 'seekable'): return fileobj.seekable() @@ -327,81 +327,81 @@ def __init__( @property def mode(self) -> str: - """_summary_ + """mode """ return self._reader.mode @property def name(self) -> str: - """_summary_ + """name """ return f'{self._reader.name} with read_at' def close(self) -> None: - """_summary_ + """close """ self._reader.close() @property def closed(self) -> bool: - """_summary_ + """closed """ return self._reader.closed def fileno(self) -> int: - """_summary_ + """file no """ return self._reader.fileno() def flush(self) -> None: - """_summary_ + """flush """ self._reader.flush() def isatty(self) -> bool: - """_summary_ + """is atty """ return self._reader.isatty() def read(self, n: int = -1) -> AnyStr: - """_summary_ + """read """ return self._reader.read(n) def read_at(self, off: int, n: int = -1) -> AnyStr: - """_summary_ + """read at """ with self._readat_lock: self._reader.seek(off) return self._reader.read(n) def readable(self) -> bool: - """_summary_ + """read able """ return self._reader.readable() def readline(self, limit: int = -1) -> AnyStr: - """_summary_ + """read line """ return self._reader.readline(limit) def readlines(self, hint: int = -1) -> List[AnyStr]: - """_summary_ + """read lines """ return self._reader.readlines(hint) def seek(self, offset: int, whence: int = 0) -> int: - """_summary_ + """seek """ return self._reader.seek(offset, whence) def seekable(self) -> bool: - """_summary_ + """seek able """ return self._reader.seekable() def tell(self) -> int: - """_summary_ + """tell """ return self._reader.tell() @@ -432,7 +432,7 @@ def __init__( self._limit = remaining def read(self, n: int = -1) -> AnyStr: - """_summary_ + """read """ if self._off >= self._limit: return b'' @@ -446,7 +446,7 @@ def read(self, n: int = -1) -> AnyStr: return d def read_at(self, off: int, n: int = -1) -> AnyStr: - """_summary_ + """read at """ if off < 0 or off >= self._limit - self._base: return b'' @@ -459,12 +459,12 @@ def read_at(self, off: int, n: int = -1) -> AnyStr: return self._reader.read_at(self._off, n) def readable(self) -> bool: - """_summary_ + """read able """ return self._reader.readable() def seek(self, offset: int, whence: int = 0) -> int: - """_summary_ + """seek """ if whence == os.SEEK_SET: offset += self._base @@ -483,12 +483,12 @@ def seek(self, offset: int, whence: int = 0) -> int: return offset - self._base def seekable(self) -> bool: - """_summary_ + """seek able """ return self._reader.seekable() def tell(self) -> int: - """_summary_ + """tell """ return self._off - self._base @@ -536,7 +536,7 @@ def iter_bytes(self, **kwargs: Any) -> Iterator[bytes]: return self._response.iter_bytes(**kwargs) class StreamBodyDiscarder(StreamBody): - """_summary_ + """stream body discarder information """ def __init__( self, @@ -588,7 +588,7 @@ def iter_bytes(self, **kwargs: Any) -> Iterator[bytes]: class LimitReader: - """_summary_ + """limit reader information """ def __init__( self, @@ -599,7 +599,7 @@ def __init__( self._n = n def read(self, n: int = -1) -> AnyStr: - """_summary_ + """read data """ if self._n <= 0: return b'' diff --git a/alibabacloud_oss_v2/models/bucket_basic.py b/alibabacloud_oss_v2/models/bucket_basic.py index 0da3833..50da493 100644 --- a/alibabacloud_oss_v2/models/bucket_basic.py +++ b/alibabacloud_oss_v2/models/bucket_basic.py @@ -131,6 +131,7 @@ class ObjectProperties(serde.Model): "storage_class": {"tag": "xml", "rename": "StorageClass"}, "owner": {"tag": "xml", "rename": "Owner", "type": "Owner"}, "restore_info": {"tag": "xml", "rename": "RestoreInfo"}, + "transition_time": {"tag": "xml", "rename": "TransitionTime"}, } _dependency_map = { @@ -151,6 +152,7 @@ def __init__( storage_class: Optional[str] = None, owner: Optional[Owner] = None, restore_info: Optional[str] = None, + transition_time: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -164,6 +166,7 @@ def __init__( storage_class (str, optional): The storage class of the object. owner (str, optional): The container that stores information about the bucket owner. restore_info (Owner, optional): The restoration status of the object. + transition_time (str): The time when the storage class of the object is converted to Cold Archive or Deep Cold Archive based on lifecycle rules. """ super().__init__(**kwargs) self.key = key @@ -174,6 +177,7 @@ def __init__( self.storage_class = storage_class self.owner = owner self.restore_info = restore_info + self.transition_time = transition_time class CommonPrefix(serde.Model): @@ -1082,6 +1086,7 @@ class ObjectVersionProperties(serde.Model): "storage_class": {"tag": "xml", "rename": "StorageClass"}, "owner": {"tag": "xml", "rename": "Owner", "type": "Owner"}, "restore_info": {"tag": "xml", "rename": "RestoreInfo"}, + "transition_time": {"tag": "xml", "rename": "TransitionTime"}, } _dependency_map = { @@ -1104,6 +1109,7 @@ def __init__( storage_class: Optional[str] = None, owner: Optional[Owner] = None, restore_info: Optional[str] = None, + transition_time: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -1119,6 +1125,7 @@ def __init__( storage_class (str, optional): The storage class of the object. owner (str, optional): The container that stores information about the bucket owner. restore_info (Owner, optional): The restoration status of the object. + transition_time (str): The time when the storage class of the object is converted to Cold Archive or Deep Cold Archive based on lifecycle rules. """ super().__init__(**kwargs) self.key = key @@ -1131,6 +1138,7 @@ def __init__( self.storage_class = storage_class self.owner = owner self.restore_info = restore_info + self.transition_time = transition_time class DeleteMarkerProperties(serde.Model): diff --git a/alibabacloud_oss_v2/models/bucket_inventory.py b/alibabacloud_oss_v2/models/bucket_inventory.py index f62c4da..9dfd093 100644 --- a/alibabacloud_oss_v2/models/bucket_inventory.py +++ b/alibabacloud_oss_v2/models/bucket_inventory.py @@ -31,6 +31,7 @@ class InventoryOptionalFieldType(str, Enum): STORAGE_CLASS = 'StorageClass' IS_MULTIPART_UPLOADED = 'IsMultipartUploaded' ENCRYPTION_STATUS = 'EncryptionStatus' + TRANSITION_TIME = 'TransitionTime' class SSEKMS(serde.Model): diff --git a/alibabacloud_oss_v2/models/object_basic.py b/alibabacloud_oss_v2/models/object_basic.py index 29966ac..fde7295 100644 --- a/alibabacloud_oss_v2/models/object_basic.py +++ b/alibabacloud_oss_v2/models/object_basic.py @@ -247,6 +247,7 @@ class HeadObjectResult(serde.ResultModel): "allow_age": {"tag": "output", "position": "header", "rename": "Access-Control-Allow-Age"}, "allow_headers": {"tag": "output", "position": "header", "rename": "Access-Control-Allow-Headers"}, "expose_headers": {"tag": "output", "position": "header", "rename": "Access-Control-Expose-Headers"}, + 'transition_time': {'tag': 'output', 'position': 'header', 'rename': 'x-oss-transition-time'}, } def __init__( @@ -279,6 +280,7 @@ def __init__( allow_age: Optional[str] = None, allow_headers: Optional[str] = None, expose_headers: Optional[str] = None, + transition_time: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -324,6 +326,7 @@ def __init__( allow_age (str, optional): The maximum caching period for CORS. allow_headers (str, optional): The headers allowed for CORS. expose_headers (str, optional): The headers that can be accessed by JavaScript applications on the client. + transition_time (str, optional): The time when the storage class of the object is converted to Cold Archive or Deep Cold Archive based on lifecycle rules. """ super().__init__(**kwargs) self.content_length = content_length @@ -354,6 +357,7 @@ def __init__( self.allow_age = allow_age self.allow_headers = allow_headers self.expose_headers = expose_headers + self.transition_time = transition_time class GetObjectRequest(serde.RequestModel): """The request for the GetObject operation.""" @@ -940,9 +944,7 @@ def __init__( source_version_id (str, optional): The version ID of the source object. server_side_encryption (str, optional): The encryption method on the server side when an object is created. Valid values: AES256 and KMS - server_side_data_encryption (str, optional): The ID of the customer master key (CMK) - that is managed by Key Management Service (KMS). This header is valid only when the x-oss-server-side-encryption header - is set to KMS. + server_side_data_encryption (str, optional): The server side data encryption algorithm. server_side_encryption_key_id (str, optional): The ID of the customer master key (CMK) that is managed by Key Management Service (KMS). last_modified (str, optional): The time when the returned objects were last modified. etag (str, optional): The entity tag (ETag). @@ -974,7 +976,7 @@ def __init__( bucket: str = None, key: str = None, version_id: Optional[str] = None, - request_payer: Optional[str] = None, + request_payer: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -1057,7 +1059,7 @@ def __init__( encoding_type: Optional[str] = None, objects: Optional[List[DeleteObject]] = None, quiet: Optional[bool] = None, - request_payer: Optional[str] = None, + request_payer: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -1103,7 +1105,7 @@ def __init__( _attribute_map = { "key": {"tag": "xml", "rename": "Key"}, "version_id": {"tag": "xml", "rename": "VersionId"}, - "delete_marker": {"tag": "xml", "rename": "DeleteMarker"}, + "delete_marker": {"tag": "xml", "rename": "DeleteMarker", "type": "bool"}, "delete_marker_version_id": {"tag": "xml", "rename": "DeleteMarkerVersionId"}, } _xml_map = { @@ -1184,6 +1186,7 @@ class GetObjectMetaResult(serde.ResultModel): "last_access_time": {"tag": "output", "position": "header", "rename": "x-oss-last-access-time", "type": "datetime,httptime"}, "version_id": {"tag": "output", "position": "header", "rename": "x-oss-version-id"}, "hash_crc64": {"tag": "output", "position": "header", "rename": "x-oss-hash-crc64ecma"}, + 'transition_time': {'tag': 'output', 'position': 'header', 'rename': 'x-oss-transition-time'}, } def __init__( @@ -1194,6 +1197,7 @@ def __init__( last_access_time: Optional[datetime.datetime] = None, version_id: Optional[str] = None, hash_crc64: Optional[str] = None, + transition_time: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -1206,6 +1210,7 @@ def __init__( version_id (str, optional): Version of the object. hash_crc64 (str, optional): The 64-bit CRC value of the object. This value is calculated based on the ECMA-182 standard. + transition_time (str, optional): The time when the storage class of the object is converted to Cold Archive or Deep Cold Archive based on lifecycle rules. """ super().__init__(**kwargs) self.content_length = content_length @@ -1214,6 +1219,7 @@ def __init__( self.last_access_time = last_access_time self.version_id = version_id self.hash_crc64 = hash_crc64 + self.transition_time = transition_time class RestoreRequest(serde.Model): @@ -2052,7 +2058,7 @@ def __init__( class ListMultipartUploadsResult(serde.ResultModel): - """The result for the ListBuckets operation.""" + """The result for the ListMultipartUploads operation.""" _attribute_map = { "encoding_type": {"tag": "xml", "rename": "EncodingType"}, @@ -2804,3 +2810,34 @@ def __init__( "task_id": {"tag": "json", "rename": "TaskId"}, "process_request_id": {"tag": "json", "rename": "RequestId"}, } + + +class CleanRestoredObjectRequest(serde.RequestModel): + """ + The request for the CleanRestoredObject operation. + """ + + _attribute_map = { + 'bucket': {'tag': 'input', 'position': 'host', 'rename': 'bucket', 'type': 'str', 'required': True}, + 'key': {'tag': 'input', 'position': 'path', 'rename': 'key', 'type': 'str', 'required': True}, + } + + def __init__( + self, + bucket: str = None, + key: str = None, + **kwargs: Any + ) -> None: + """ + bucket (str, required): The name of the bucket + key (str, required): The name of the object. + """ + super().__init__(**kwargs) + self.bucket = bucket + self.key = key + + +class CleanRestoredObjectResult(serde.ResultModel): + """ + The request for the CleanRestoredObject operation. + """ \ No newline at end of file diff --git a/alibabacloud_oss_v2/operations/object_basic.py b/alibabacloud_oss_v2/operations/object_basic.py index 9677fcf..c5bc5eb 100644 --- a/alibabacloud_oss_v2/operations/object_basic.py +++ b/alibabacloud_oss_v2/operations/object_basic.py @@ -283,7 +283,7 @@ def delete_multiple_objects(client: _SyncClientImpl, request: models.DeleteMulti ) -def get_object_meta(client: _SyncClientImpl, request: models.HeadObjectRequest, **kwargs) -> models.GetObjectMetaResult: +def get_object_meta(client: _SyncClientImpl, request: models.GetObjectMetaRequest, **kwargs) -> models.GetObjectMetaResult: """ get object meta synchronously @@ -990,3 +990,45 @@ def async_process_object(client: _SyncClientImpl, request: models.AsyncProcessOb serde_utils.deserialize_process_body ], ) + +def clean_restored_object(client: _SyncClientImpl, request: models.CleanRestoredObjectRequest, **kwargs) -> models.CleanRestoredObjectResult: + """ + clean_restored_object synchronously + + Args: + client (_SyncClientImpl): A agent that sends the request. + request (CleanRestoredObjectRequest): The request for the CleanRestoredObject operation. + + Returns: + CleanRestoredObjectResult: The result for the CleanRestoredObject operation. + """ + + op_input = serde.serialize_input( + request=request, + op_input=OperationInput( + op_name='CleanRestoredObject', + method='POST', + headers=CaseInsensitiveDict({ + 'Content-Type': 'application/xml', + }), + parameters={ + 'cleanRestoredObject': '', + }, + bucket=request.bucket, + key=request.key, + op_metadata={'sub-resource': ['cleanRestoredObject']}, + ), + custom_serializer=[ + serde_utils.add_content_md5 + ] + ) + + op_output = client.invoke_operation(op_input, **kwargs) + + return serde.deserialize_output( + result=models.CleanRestoredObjectResult(), + op_output=op_output, + custom_deserializer=[ + serde.deserialize_output_xmlbody + ], + ) diff --git a/alibabacloud_oss_v2/progress.py b/alibabacloud_oss_v2/progress.py index 8ed7dea..d8c3c19 100644 --- a/alibabacloud_oss_v2/progress.py +++ b/alibabacloud_oss_v2/progress.py @@ -3,7 +3,7 @@ class Progress: - """_summary_ + """Progress """ def __init__( @@ -17,13 +17,13 @@ def __init__( self._lwritten = 0 def reset(self): - """_summary_ + """reset """ self._lwritten = self._written self._written = 0 def write(self, s: bytes): - """_summary_ + """write """ n = _len(s) self._written = self._written + n diff --git a/alibabacloud_oss_v2/serde.py b/alibabacloud_oss_v2/serde.py index b762404..8a2dc51 100644 --- a/alibabacloud_oss_v2/serde.py +++ b/alibabacloud_oss_v2/serde.py @@ -1,4 +1,4 @@ -"""_summary_ +"""Serializer & Deserializer for models """ import datetime import sys @@ -294,7 +294,7 @@ def _serialize_xml_any(tag: str, value: Any, atype: str) -> ET.Element: def _serialize_xml_model(obj, root: Optional[str] = None) -> ET.Element: - """_summary_ + """serialize xml model Args: model (Model): _description_ @@ -358,7 +358,7 @@ def _serialize_to_str(value: Any, atype: str) -> str: def _deserialize_xml_model(root: ET.Element, obj: Any) -> None: - """_summary_ + """deserialize xml model """ attributes = getattr(obj, '_attribute_map') for attr, attr_desc in attributes.items(): @@ -455,7 +455,7 @@ def _deserialize_to_any(value: Optional[str], atype: str) -> Any: def serialize_xml(obj, root: Optional[str] = None) -> Any: - """_summary_ + """serialize xml Args: model (Model): _description_ @@ -470,7 +470,7 @@ def serialize_xml(obj, root: Optional[str] = None) -> Any: def deserialize_xml(xml_data: Any, obj: Any, expect_tag: Optional[str] = None) -> None: - """_summary_ + """deserialize xml """ if not isinstance(obj, Model): return @@ -486,7 +486,7 @@ def deserialize_xml(xml_data: Any, obj: Any, expect_tag: Optional[str] = None) - def serialize_input(request: Model, op_input: OperationInput, custom_serializer: Optional[List[Any]] = None) -> OperationInput: - """_summary_ + """serialize input Args: request (Model): _description_ @@ -568,7 +568,7 @@ def serialize_input(request: Model, op_input: OperationInput, def deserialize_output(result: Model, op_output: OperationOutput, custom_deserializer: Optional[List[Any]] = None) -> Model: - """_summary_ + """deserialize output Args: result (Model): _description_ @@ -596,7 +596,7 @@ def deserialize_output(result: Model, op_output: OperationOutput, def deserialize_output_headers(result: Model, op_output: OperationOutput) -> Model: - """_summary_ + """deserialize output headers Args: result (Model): _description_ @@ -633,7 +633,7 @@ def deserialize_output_headers(result: Model, op_output: OperationOutput) -> Mod def deserialize_output_xmlbody(result: Model, op_output: OperationOutput) -> Model: - """_summary_ + """deserialize output xmlbody Args: result (Model): _description_ @@ -681,7 +681,7 @@ def deserialize_output_xmlbody(result: Model, op_output: OperationOutput) -> Mod def deserialize_output_discardbody(result: Model, op_output: OperationOutput) -> Model: - """_summary_ + """deserialize output discardbody Args: result (Model): _description_ @@ -696,7 +696,7 @@ def deserialize_output_discardbody(result: Model, op_output: OperationOutput) -> def copy_request(dst: RequestModel, src: RequestModel): - """_summary_ + """copy request Args: dst (RequestModel): _description_ diff --git a/alibabacloud_oss_v2/serde_utils.py b/alibabacloud_oss_v2/serde_utils.py index d0dec4a..47fcc04 100644 --- a/alibabacloud_oss_v2/serde_utils.py +++ b/alibabacloud_oss_v2/serde_utils.py @@ -275,7 +275,7 @@ def add_process_action(request: serde.Model, op_input: OperationInput) -> Operat def deserialize_process_body(result: serde.Model, op_output: OperationOutput) -> serde.Model: - """_summary_ + """deserialize process body Args: result (Model): _description_ diff --git a/alibabacloud_oss_v2/signer/v1.py b/alibabacloud_oss_v2/signer/v1.py index 0aee07b..6bd94df 100644 --- a/alibabacloud_oss_v2/signer/v1.py +++ b/alibabacloud_oss_v2/signer/v1.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +"""V1 signature information +""" import base64 import datetime from typing import Optional @@ -10,7 +12,7 @@ from ..types import SigningContext, Signer class SignerV1(Signer): - """_summary_ + """Signer V1 """ _subresource_key_set = frozenset( ['acl', 'bucketInfo', 'location', 'stat', 'delete', 'append', diff --git a/alibabacloud_oss_v2/signer/v4.py b/alibabacloud_oss_v2/signer/v4.py index fdb7992..9987dac 100644 --- a/alibabacloud_oss_v2/signer/v4.py +++ b/alibabacloud_oss_v2/signer/v4.py @@ -1,4 +1,4 @@ -"""_summary_ +"""V4 signature information """ import datetime from email.utils import format_datetime @@ -12,7 +12,7 @@ class SignerV4(Signer): - """_summary_ + """Signer V4 """ def sign(self, signing_ctx: SigningContext) -> None: diff --git a/alibabacloud_oss_v2/types.py b/alibabacloud_oss_v2/types.py index 484584b..ad10c87 100644 --- a/alibabacloud_oss_v2/types.py +++ b/alibabacloud_oss_v2/types.py @@ -1,4 +1,4 @@ -"""_summary_ +"""Type Information """ import abc import datetime @@ -344,7 +344,7 @@ def sign(self, signing_ctx: SigningContext) -> None: class OperationInput: - """_summary_ + """Operation Input """ def __init__( @@ -371,7 +371,7 @@ def __str__(self) -> str: return str(self.__dict__) class OperationOutput: - """_summary_ + """Operation Output """ def __init__( diff --git a/alibabacloud_oss_v2/uploader.py b/alibabacloud_oss_v2/uploader.py index eedcc66..ec5618a 100644 --- a/alibabacloud_oss_v2/uploader.py +++ b/alibabacloud_oss_v2/uploader.py @@ -66,7 +66,8 @@ def list_parts(self, request: models.ListPartsRequest, **kwargs """ class UploaderOptions: - """_summary_ + """ + uploader options """ def __init__( @@ -85,7 +86,8 @@ def __init__( class UploadResult: - """_summary_ + """ + upload result """ def __init__( @@ -163,7 +165,7 @@ def upload_file( filepath: str, **kwargs: Any ) -> UploadResult: - """_summary_ + """upload file Args: request (models.PutObjectRequest): _description_ @@ -198,7 +200,7 @@ def upload_from( reader: IO[bytes], **kwargs: Any ) -> UploadResult: - """_summary_ + """upload from Args: request (models.PutObjectRequest): _description_ @@ -307,12 +309,12 @@ def __init__( @property def reader_filepath(self) -> str: - """_summary_ + """reader filepath """ return self._filepath def check_source(self, filepath:str): - """_summary_ + """check source """ if len(filepath) == 0: raise exceptions.ParamInvalidError(field='filepath') @@ -328,7 +330,7 @@ def check_source(self, filepath:str): self._file_stat = os.stat(absfilepath) def apply_source(self, reader): - """_summary_ + """apply source """ if reader is None: raise exceptions.ParamInvalidError(field = 'reader') @@ -348,7 +350,7 @@ def apply_source(self, reader): self._reader_seekable = utils.is_seekable(reader) def check_checkpoint(self): - """_summary_ + """check checkpoint """ if not self._options.enable_checkpoint: return @@ -372,7 +374,7 @@ def check_checkpoint(self): def update_crc_flag(self): - """_summary_ + """update crc flag """ #FF_ENABLE_CRC64_CHECK_UPLOAD = 0x00000008 if (self._base._feature_flags & 0x00000008) > 0: @@ -408,12 +410,12 @@ def adjust_source(self): def set_reader(self, reader) ->IO[bytes]: - """_summary_ + """set reader """ self._reader = reader def close_reader(self): - """_summary_ + """close reader """ if self._checkpoint: @@ -423,7 +425,7 @@ def close_reader(self): self._checkpoint = None def upload(self) -> UploadResult: - """_summary_ + """Breakpoint upload """ if self._total_size >= 0 and self._total_size < self._options.part_size: return self._single_part() diff --git a/tests/integration/test_clean_restored_object_client.py b/tests/integration/test_clean_restored_object_client.py new file mode 100644 index 0000000..99c593c --- /dev/null +++ b/tests/integration/test_clean_restored_object_client.py @@ -0,0 +1,174 @@ +# pylint: skip-file +import time +from typing import cast +import alibabacloud_oss_v2 as oss +from . import TestIntegration, random_bucket_name + + +class TestCleanRestoredObject(TestIntegration): + + def test_clean_restored_object(self): + key = 'demo.txt' + data = b'hello world' + bucket_name = random_bucket_name() + + # create bucket + result = self.client.put_bucket(oss.PutBucketRequest( + bucket=bucket_name, + acl='private', + create_bucket_configuration=oss.CreateBucketConfiguration( + storage_class='IA', + ) + )) + self.assertEqual(200, result.status_code) + self.assertEqual('OK', result.status) + self.assertEqual(24, len(result.request_id)) + self.assertEqual(24, len(result.headers.get('x-oss-request-id'))) + + result = self.client.put_object(oss.PutObjectRequest( + bucket=bucket_name, + key=key, + storage_class='ColdArchive', + body=data, + )) + self.assertEqual(200, result.status_code) + self.assertEqual('OK', result.status) + self.assertEqual(24, len(result.request_id)) + self.assertEqual(24, len(result.headers.get('x-oss-request-id'))) + + # clean restored object + try: + self.client.clean_restored_object(oss.CleanRestoredObjectRequest( + bucket=bucket_name, + key=key, + )) + except Exception as e: + ope = cast(oss.exceptions.OperationError, e) + self.assertIsInstance(ope.unwrap(), oss.exceptions.ServiceError) + serr = cast(oss.exceptions.ServiceError, ope.unwrap()) + self.assertEqual(409, serr.status_code) + self.assertEqual(24, len(serr.request_id)) + self.assertEqual('ArchiveRestoreFileStale', serr.code) + + # restore object + self.client.restore_object(oss.RestoreObjectRequest( + bucket=bucket_name, + key=key, + restore_request=oss.RestoreRequest( + days=1, + tier="Expedited", + ) + )) + + time.sleep(1) + + # clean restored object + try: + self.client.clean_restored_object(oss.CleanRestoredObjectRequest( + bucket=bucket_name, + key=key, + )) + except Exception as e: + ope = cast(oss.exceptions.OperationError, e) + self.assertIsInstance(ope.unwrap(), oss.exceptions.ServiceError) + serr = cast(oss.exceptions.ServiceError, ope.unwrap()) + self.assertEqual(409, serr.status_code) + self.assertEqual(24, len(serr.request_id)) + self.assertEqual('ArchiveRestoreNotFinished', serr.code) + + + def test_clean_restored_object_v1(self): + key = 'demo.txt' + data = b'hello world' + bucket_name = random_bucket_name() + + # create bucket + result = self.signv1_client.put_bucket(oss.PutBucketRequest( + bucket=bucket_name, + acl='private', + create_bucket_configuration=oss.CreateBucketConfiguration( + storage_class='IA', + ) + )) + self.assertEqual(200, result.status_code) + self.assertEqual('OK', result.status) + self.assertEqual(24, len(result.request_id)) + self.assertEqual(24, len(result.headers.get('x-oss-request-id'))) + + result = self.signv1_client.put_object(oss.PutObjectRequest( + bucket=bucket_name, + key=key, + storage_class='ColdArchive', + body=data, + )) + self.assertEqual(200, result.status_code) + self.assertEqual('OK', result.status) + self.assertEqual(24, len(result.request_id)) + self.assertEqual(24, len(result.headers.get('x-oss-request-id'))) + + # clean restored object + try: + self.signv1_client.clean_restored_object(oss.CleanRestoredObjectRequest( + bucket=bucket_name, + key=key, + )) + except Exception as e: + ope = cast(oss.exceptions.OperationError, e) + self.assertIsInstance(ope.unwrap(), oss.exceptions.ServiceError) + serr = cast(oss.exceptions.ServiceError, ope.unwrap()) + self.assertEqual(409, serr.status_code) + self.assertEqual(24, len(serr.request_id)) + self.assertEqual('ArchiveRestoreFileStale', serr.code) + + # restore object + self.signv1_client.restore_object(oss.RestoreObjectRequest( + bucket=bucket_name, + key=key, + restore_request=oss.RestoreRequest( + days=1, + tier="Expedited", + ) + )) + + time.sleep(1) + + # clean restored object + try: + self.signv1_client.clean_restored_object(oss.CleanRestoredObjectRequest( + bucket=bucket_name, + key=key, + )) + except Exception as e: + ope = cast(oss.exceptions.OperationError, e) + self.assertIsInstance(ope.unwrap(), oss.exceptions.ServiceError) + serr = cast(oss.exceptions.ServiceError, ope.unwrap()) + self.assertEqual(409, serr.status_code) + self.assertEqual(24, len(serr.request_id)) + self.assertEqual('ArchiveRestoreNotFinished', serr.code) + + + def test_clean_restored_object_fail(self): + # create bucket + bucket_name = random_bucket_name() + self.client.put_bucket(oss.PutBucketRequest( + bucket=bucket_name, + acl='private', + create_bucket_configuration=oss.CreateBucketConfiguration( + storage_class='IA' + ) + )) + + # clean restored object + try: + self.invalid_client.clean_restored_object(oss.CleanRestoredObjectRequest( + bucket=bucket_name, + key='demo.jpg', + )) + self.fail("should not here") + except Exception as e: + ope = cast(oss.exceptions.OperationError, e) + self.assertIsInstance(ope.unwrap(), oss.exceptions.ServiceError) + serr = cast(oss.exceptions.ServiceError, ope.unwrap()) + self.assertEqual(403, serr.status_code) + self.assertEqual(24, len(serr.request_id)) + self.assertEqual('InvalidAccessKeyId', serr.code) diff --git a/tests/unit/models/test_bucket_basic.py b/tests/unit/models/test_bucket_basic.py index 22bd76e..ee0c9f8 100644 --- a/tests/unit/models/test_bucket_basic.py +++ b/tests/unit/models/test_bucket_basic.py @@ -445,6 +445,7 @@ def test_constructor_result(self): display_name='user_example', ), restore_info='ongoing-request="false", expiry-date="Sat, 05 Nov 2022 07:38:08 GMT"', + transition_time='2023-12-17T00:20:57.000Z', )], common_prefixes=[model.CommonPrefix( prefix='fun/movie/', @@ -472,6 +473,7 @@ def test_constructor_result(self): self.assertEqual('0022012****', result.contents[0].owner.id) self.assertEqual('user_example', result.contents[0].owner.display_name) self.assertEqual('fun/movie/', result.common_prefixes[0].prefix) + self.assertEqual('2023-12-17T00:20:57.000Z', result.contents[0].transition_time) result = model.ListObjectsV2Result( name='example-bucket', @@ -518,6 +520,7 @@ def test_deserialize_result(self): user-example22 ongoing-request="false", expiry-date="Sat, 05 Nov 2022 07:38:08 GMT" + 2023-12-08T08:12:20.000Z a/b/ @@ -556,6 +559,7 @@ def test_deserialize_result(self): self.assertEqual('ongoing-request="false", expiry-date="Sat, 05 Nov 2022 07:38:08 GMT"', result.contents[1].restore_info) self.assertEqual('0022012****22', result.contents[1].owner.id) self.assertEqual('user-example22', result.contents[1].owner.display_name) + self.assertEqual('2023-12-08T08:12:20.000Z', result.contents[1].transition_time) class TestGetBucketStat(unittest.TestCase): @@ -817,6 +821,7 @@ def test_constructor_result(self): display_name='user_example', ), restore_info='ongoing-request="false", expiry-date="Sat, 05 Nov 2022 07:38:08 GMT"', + transition_time='2023-12-17T00:20:57.000Z', )], common_prefixes=[model.CommonPrefix( prefix='fun/movie/', @@ -840,6 +845,7 @@ def test_constructor_result(self): self.assertEqual('0022012****', result.contents[0].owner.id) self.assertEqual('user_example', result.contents[0].owner.display_name) self.assertEqual('fun/movie/', result.common_prefixes[0].prefix) + self.assertEqual('2023-12-17T00:20:57.000Z', result.contents[0].transition_time) result = model.ListObjectsV2Result( name='example-bucket', @@ -885,6 +891,7 @@ def test_deserialize_result(self): user-example22 ongoing-request="false", expiry-date="Sat, 05 Nov 2022 07:38:08 GMT" + 2023-12-08T08:12:20.000Z a/b/ @@ -920,6 +927,7 @@ def test_deserialize_result(self): self.assertEqual('ongoing-request="false", expiry-date="Sat, 05 Nov 2022 07:38:08 GMT"', result.contents[1].restore_info) self.assertEqual('0022012****22', result.contents[1].owner.id) self.assertEqual('user-example22', result.contents[1].owner.display_name) + self.assertEqual('2023-12-08T08:12:20.000Z', result.contents[1].transition_time) class TestGetBucketInfo(unittest.TestCase): @@ -1436,6 +1444,7 @@ def test_constructor_result(self): display_name='1250000000', ), restore_info='ongoing-request="true"', + transition_time='2023-12-17T00:20:57.000Z', )], delete_marker=[model.DeleteMarkerProperties( key='demo%2FREADME-CN.md', @@ -1510,6 +1519,7 @@ def test_constructor_result(self): self.assertEqual('250692521021****', result.delete_marker[1].owner.display_name) self.assertEqual('demo%2F.git%2F', result.common_prefixes[0].prefix) self.assertEqual('demo%2F.idea%2F', result.common_prefixes[1].prefix) + self.assertEqual('2023-12-17T00:20:57.000Z', result.version[1].transition_time) result = model.ListObjectVersionsResult( version_id_marker='BgICDzK6NnBgiIGRlZWJhY', @@ -1560,6 +1570,7 @@ def test_deserialize_result(self): 1250000000 ongoing-request="true" + 2023-12-08T08:12:20.000Z demo%2FREADME-CN.md @@ -1636,4 +1647,5 @@ def test_deserialize_result(self): self.assertEqual('150692521021****', result.delete_marker[1].owner.id) self.assertEqual('250692521021****', result.delete_marker[1].owner.display_name) self.assertEqual('demo%2F.git%2F', result.common_prefixes[0].prefix) - self.assertEqual('demo%2F.idea%2F', result.common_prefixes[1].prefix) \ No newline at end of file + self.assertEqual('demo%2F.idea%2F', result.common_prefixes[1].prefix) + self.assertEqual('2023-12-08T08:12:20.000Z', result.version[1].transition_time) \ No newline at end of file diff --git a/tests/unit/models/test_bucket_inventory.py b/tests/unit/models/test_bucket_inventory.py index 6898f28..e11ab24 100644 --- a/tests/unit/models/test_bucket_inventory.py +++ b/tests/unit/models/test_bucket_inventory.py @@ -298,6 +298,7 @@ def test_deserialize_result(self): StorageClass IsMultipartUploaded EncryptionStatus + TransitionTime ''' @@ -331,6 +332,7 @@ def test_deserialize_result(self): self.assertEqual(InventoryOptionalFieldType.STORAGE_CLASS, result.inventory_configuration.optional_fields.fields[3]) self.assertEqual(InventoryOptionalFieldType.IS_MULTIPART_UPLOADED, result.inventory_configuration.optional_fields.fields[4]) self.assertEqual(InventoryOptionalFieldType.ENCRYPTION_STATUS, result.inventory_configuration.optional_fields.fields[5]) + self.assertEqual(InventoryOptionalFieldType.TRANSITION_TIME, result.inventory_configuration.optional_fields.fields[6]) class TestListBucketInventory(unittest.TestCase): diff --git a/tests/unit/models/test_clean_restored_object.py b/tests/unit/models/test_clean_restored_object.py new file mode 100644 index 0000000..2bc2eba --- /dev/null +++ b/tests/unit/models/test_clean_restored_object.py @@ -0,0 +1,72 @@ +# pylint: skip-file + +import unittest +from alibabacloud_oss_v2 import serde +from alibabacloud_oss_v2.models import object_basic as model +from alibabacloud_oss_v2.types import OperationInput, OperationOutput, CaseInsensitiveDict, HttpResponse +from .. import MockHttpResponse + +class TestCleanRestoredObject(unittest.TestCase): + def test_constructor_request(self): + request = model.CleanRestoredObjectRequest( + ) + self.assertIsNone(request.bucket) + self.assertIsNone(request.key) + self.assertFalse(hasattr(request, 'headers')) + self.assertFalse(hasattr(request, 'parameters')) + self.assertFalse(hasattr(request, 'payload')) + self.assertIsInstance(request, serde.RequestModel) + + request = model.CleanRestoredObjectRequest( + bucket='bucketexampletest', + key='multipart.data', + ) + self.assertEqual('bucketexampletest', request.bucket) + self.assertEqual('multipart.data', request.key) + + def test_serialize_request(self): + request = model.CleanRestoredObjectRequest( + bucket='bucketexampletest', + key='test.jpg', + ) + + op_input = serde.serialize_input(request, OperationInput( + op_name='CleanRestoredObject', + method='POST', + bucket=request.bucket, + )) + self.assertEqual('CleanRestoredObject', op_input.op_name) + self.assertEqual('POST', op_input.method) + self.assertEqual('bucketexampletest', op_input.bucket) + + def test_constructor_result(self): + result = model.CleanRestoredObjectResult() + self.assertIsInstance(result, serde.ResultModel) + + def test_deserialize_result(self): + xml_data = None + result = model.CleanRestoredObjectResult() + serde.deserialize_output( + result, + OperationOutput( + status='OK', + status_code=200, + headers=CaseInsensitiveDict({ + 'x-oss-request-id': '123', + 'x-oss-hash-crc64ecma': '316181249502703****', + 'x-oss-version-id': 'CAEQNhiBgMDJgZCA0BYiIDc4MGZjZGI2OTBjOTRmNTE5NmU5NmFhZjhjYmY0****', + }), + http_response=MockHttpResponse( + status_code=200, + reason='OK', + headers={'x-oss-request-id': 'id-1234'}, + body=xml_data, + ) + ) + ) + self.assertEqual('OK', result.status) + self.assertEqual(200, result.status_code) + self.assertEqual('123', result.request_id) + self.assertEqual('316181249502703****', result.headers.get('x-oss-hash-crc64ecma')) + self.assertEqual('CAEQNhiBgMDJgZCA0BYiIDc4MGZjZGI2OTBjOTRmNTE5NmU5NmFhZjhjYmY0****', result.headers.get('x-oss-version-id')) + diff --git a/tests/unit/models/test_object_basic.py b/tests/unit/models/test_object_basic.py index 93fae28..3d3375f 100644 --- a/tests/unit/models/test_object_basic.py +++ b/tests/unit/models/test_object_basic.py @@ -370,6 +370,7 @@ def test_constructor_result(self): self.assertIsNone(result.allow_age) self.assertIsNone(result.allow_headers) self.assertIsNone(result.expose_headers) + self.assertIsNone(result.transition_time) self.assertIsInstance(result, serde.Model) result = model.HeadObjectResult( @@ -406,6 +407,7 @@ def test_constructor_result(self): allow_age='1111', allow_headers='{a:a1, b:b2}', expose_headers='{a:a1, b:b2}', + transition_time='2024-10-12T00:00:00.000Z', ) self.assertEqual(1024, result.content_length) self.assertEqual('text/xml', result.content_type) @@ -435,6 +437,7 @@ def test_constructor_result(self): self.assertEqual('1111', result.allow_age) self.assertEqual('{a:a1, b:b2}', result.allow_headers) self.assertEqual('{a:a1, b:b2}', result.expose_headers) + self.assertEqual('2024-10-12T00:00:00.000Z', result.transition_time) result = model.HeadObjectResult( expose_headers='expose_headers-test', @@ -1497,11 +1500,11 @@ def test_deserialize_result(self): self.assertEqual("url", result.encoding_type) self.assertEqual("multipart.data", result.deleted_objects[0].key) self.assertEqual("CAEQNRiBgICEoPiC0BYiIGMxZWJmYmMzYjE0OTQ0ZmZhYjgzNzkzYjc2NjZk****", result.deleted_objects[0].version_id) - self.assertEqual("true", result.deleted_objects[0].delete_marker) + self.assertEqual(True, result.deleted_objects[0].delete_marker) self.assertEqual("CAEQMhiBgIDXiaaB0BYiIGQzYmRkZGUxMTM1ZDRjOTZhNjk4YjRjMTAyZjhl****", result.deleted_objects[0].delete_marker_version_id) self.assertEqual("test.jpg", result.deleted_objects[1].key) self.assertEqual("0BYiIGMxZWJmYmMzYjE0OTQ0ZmZhYjgzNzkzYjc2NjZk****", result.deleted_objects[1].version_id) - self.assertEqual("true", result.deleted_objects[1].delete_marker) + self.assertEqual(True, result.deleted_objects[1].delete_marker) self.assertEqual("CAEQMhiBgIDB3aWB0BYiIGUzYTA3YzliMzVmNzRkZGM5NjllYTVlMjYyYWEy****", result.deleted_objects[1].delete_marker_version_id) @@ -1572,10 +1575,37 @@ def test_serialize_request(self): self.assertEqual('GET', op_input.method) self.assertEqual('bucket_name', op_input.bucket) self.assertEqual('requester', op_input.headers.get('x-oss-request-payer')) + self.assertEqual('CAEQNhiBgMDJgZCA0BYiIDc4MGZjZGI2OTBjOTRmNTE5NmU5NmFhZjhjYmY0****', op_input.parameters.get('versionId')) def test_constructor_result(self): result = model.GetObjectMetaResult() - self.assertIsInstance(result, serde.ResultModel) + self.assertIsNone(result.content_length) + self.assertIsNone(result.etag) + self.assertIsNone(result.last_modified) + self.assertIsNone(result.last_access_time) + self.assertIsNone(result.version_id) + self.assertIsNone(result.hash_crc64) + self.assertIsNone(result.transition_time) + self.assertIsInstance(result, serde.Model) + + result = model.GetObjectMetaResult( + content_length=101, + etag='"D41D8CD98F00B204E9800998ECF8****"', + last_modified=datetime.datetime.fromtimestamp(1702743657), + last_access_time=datetime.datetime.fromtimestamp(1702743657), + version_id='CAEQNhiBgMDJgZCA0BYiIDc4MGZjZGI2OTBjOTRmNTE5NmU5NmFhZjhjYmY0****', + hash_crc64='316181249502703****', + transition_time='2024-10-12T00:00:00.000Z', + ) + self.assertEqual(101, result.content_length) + self.assertEqual('"D41D8CD98F00B204E9800998ECF8****"', result.etag) + self.assertEqual(datetime.datetime.fromtimestamp(1702743657), result.last_modified) + self.assertEqual('2023-12-17T00:20:57.000Z', result.last_modified.strftime("%Y-%m-%dT%H:%M:%S.000Z")) + self.assertEqual(datetime.datetime.fromtimestamp(1702743657), result.last_access_time) + self.assertEqual('2023-12-17T00:20:57.000Z', result.last_access_time.strftime('%Y-%m-%dT%H:%M:%S.000Z')) + self.assertEqual('CAEQNhiBgMDJgZCA0BYiIDc4MGZjZGI2OTBjOTRmNTE5NmU5NmFhZjhjYmY0****', result.version_id) + self.assertEqual('316181249502703****', result.hash_crc64) + self.assertEqual('2024-10-12T00:00:00.000Z', result.transition_time) def test_deserialize_result(self): xml_data = None