Fix put object with --grant-full-control id=mycanonicaluserid
Signed-off-by: Yulia Kovshova <y.kovshova@yadro.com>
This commit is contained in:
parent
3f41fbc14b
commit
5cab1ecf19
3 changed files with 25 additions and 3 deletions
|
@ -171,7 +171,7 @@ class AwsCliClient:
|
||||||
if ObjectLockLegalHoldStatus:
|
if ObjectLockLegalHoldStatus:
|
||||||
cmd += f" --object-lock-legal-hold-status {ObjectLockLegalHoldStatus}"
|
cmd += f" --object-lock-legal-hold-status {ObjectLockLegalHoldStatus}"
|
||||||
if GrantFullControl:
|
if GrantFullControl:
|
||||||
cmd += f" --grant-full-control {GrantFullControl}"
|
cmd += f" --grant-full-control '{GrantFullControl}'"
|
||||||
if GrantRead:
|
if GrantRead:
|
||||||
cmd += f" --grant-read {GrantRead}"
|
cmd += f" --grant-read {GrantRead}"
|
||||||
output = _cmd_run(cmd, LONG_TIMEOUT)
|
output = _cmd_run(cmd, LONG_TIMEOUT)
|
||||||
|
@ -326,6 +326,28 @@ class AwsCliClient:
|
||||||
output = _cmd_run(cmd)
|
output = _cmd_run(cmd)
|
||||||
return self._to_json(output)
|
return self._to_json(output)
|
||||||
|
|
||||||
|
def put_object_retention(
|
||||||
|
self, Bucket: str, Key: str, Retention: dict, VersionId: Optional[str] = None
|
||||||
|
) -> dict:
|
||||||
|
version = f" --version-id {VersionId}" if VersionId else ""
|
||||||
|
cmd = (
|
||||||
|
f"aws {self.common_flags} s3api put-object-retention --bucket {Bucket} --key {Key} "
|
||||||
|
f"{version} --retention '{json.dumps(Retention, indent=4, sort_keys=True, default=str)}' --endpoint {S3_GATE}"
|
||||||
|
)
|
||||||
|
output = _cmd_run(cmd)
|
||||||
|
return self._to_json(output)
|
||||||
|
|
||||||
|
def put_object_legal_hold(
|
||||||
|
self, Bucket: str, Key: str, LegalHold: dict, VersionId: Optional[str] = None
|
||||||
|
) -> dict:
|
||||||
|
version = f" --version-id {VersionId}" if VersionId else ""
|
||||||
|
cmd = (
|
||||||
|
f"aws {self.common_flags} s3api put-object-legal-hold --bucket {Bucket} --key {Key} "
|
||||||
|
f"{version} --legal-hold '{json.dumps(LegalHold)}' --endpoint {S3_GATE}"
|
||||||
|
)
|
||||||
|
output = _cmd_run(cmd)
|
||||||
|
return self._to_json(output)
|
||||||
|
|
||||||
def put_object_tagging(self, Bucket: str, Key: str, Tagging: dict) -> dict:
|
def put_object_tagging(self, Bucket: str, Key: str, Tagging: dict) -> dict:
|
||||||
cmd = (
|
cmd = (
|
||||||
f"aws {self.common_flags} s3api put-object-tagging --bucket {Bucket} --key {Key} "
|
f"aws {self.common_flags} s3api put-object-tagging --bucket {Bucket} --key {Key} "
|
||||||
|
|
|
@ -132,7 +132,7 @@ class TestS3GateBucket(TestS3GateBase):
|
||||||
ObjectLockLegalHoldStatus="ON",
|
ObjectLockLegalHoldStatus="ON",
|
||||||
)
|
)
|
||||||
assert_object_lock_mode(
|
assert_object_lock_mode(
|
||||||
self.s3_client, bucket, file_name, "COMPLIANCE", date_obj_1, "ON"
|
self.s3_client, bucket_1, file_name, "COMPLIANCE", date_obj_1, "ON"
|
||||||
)
|
)
|
||||||
|
|
||||||
@allure.title("Test S3: delete bucket")
|
@allure.title("Test S3: delete bucket")
|
||||||
|
|
|
@ -739,7 +739,7 @@ class TestS3GateObject(TestS3GateBase):
|
||||||
self.s3_client,
|
self.s3_client,
|
||||||
bucket,
|
bucket,
|
||||||
file_path_6,
|
file_path_6,
|
||||||
GrantFullControl=f"'id={self.other_public_key}'",
|
GrantFullControl=f"id={self.other_public_key}",
|
||||||
)
|
)
|
||||||
obj_acl = s3_gate_object.get_object_acl_s3(self.s3_client, bucket, file_name_5)
|
obj_acl = s3_gate_object.get_object_acl_s3(self.s3_client, bucket, file_name_5)
|
||||||
obj_permission = [permission.get("Permission") for permission in obj_acl]
|
obj_permission = [permission.get("Permission") for permission in obj_acl]
|
||||||
|
|
Loading…
Reference in a new issue