Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object lifecycle archive ir #444

Merged
merged 3 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions qiniu/services/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def list(self, bucket, prefix=None, marker=None, limit=None, delimiter=None):
options['delimiter'] = delimiter

ak = self.auth.get_access_key()
rs_host = self.zone.get_rsf_host(ak, bucket)
url = '{0}/list'.format(rs_host)
rsf_host = self.zone.get_rsf_host(ak, bucket)
url = '{0}/list'.format(rsf_host)
ret, info = self.__get(url, options)

eof = False
Expand Down Expand Up @@ -289,7 +289,8 @@ def set_object_lifecycle(
to_archive_after_days=0,
to_deep_archive_after_days=0,
delete_after_days=0,
cond=None
cond=None,
to_archive_ir_after_days=0
):
"""

Expand All @@ -303,13 +304,15 @@ def set_object_lifecycle(
to_deep_archive_after_days: 多少天后将文件转为深度归档存储,设置为 -1 表示取消已设置的转深度归档存储的生命周期规则, 0 表示不修改转深度归档生命周期规则
delete_after_days: 多少天后将文件删除,设置为 -1 表示取消已设置的删除存储的生命周期规则, 0 表示不修改删除存储的生命周期规则。
cond: 匹配条件,只有条件匹配才会设置成功,当前支持设置 hash、mime、fsize、putTime。
to_archive_ir_after_days: 多少天后将文件转为归档直读存储,设置为 -1 表示取消已设置的转归档只读存储的生命周期规则, 0 表示不修改转归档只读存储生命周期规则。

Returns:
resBody, respInfo

"""
options = [
'toIAAfterDays', str(to_line_after_days),
'toArchiveIRAfterDays', str(to_archive_ir_after_days),
'toArchiveAfterDays', str(to_archive_after_days),
'toDeepArchiveAfterDays', str(to_deep_archive_after_days),
'deleteAfterDays', str(delete_after_days)
Expand Down
2 changes: 1 addition & 1 deletion qiniu/services/storage/uploaders/resume_uploader_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def __upload_part(
Parameters
----------
data: IOBase
chunk_info: IOChunked
chunk_info: ChunkInfo
up_hosts: list[str]
up_token: str
lock: Lock
Expand Down
2 changes: 2 additions & 0 deletions test_qiniu.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def test_set_object_lifecycle(self):
bucket=bucket_name,
key=key,
to_line_after_days=10,
to_archive_ir_after_days=15,
to_archive_after_days=20,
to_deep_archive_after_days=30,
delete_after_days=40
Expand All @@ -609,6 +610,7 @@ def test_set_object_lifecycle_with_cond(self):
bucket=bucket_name,
key=key,
to_line_after_days=10,
to_archive_ir_after_days=15,
to_archive_after_days=20,
to_deep_archive_after_days=30,
delete_after_days=40,
Expand Down
Loading