diff --git a/src/frostfs_testlib/cli/frostfs_cli/object.py b/src/frostfs_testlib/cli/frostfs_cli/object.py index 0c00563..e536544 100644 --- a/src/frostfs_testlib/cli/frostfs_cli/object.py +++ b/src/frostfs_testlib/cli/frostfs_cli/object.py @@ -315,8 +315,9 @@ class FrostfsCliObject(CliCommand): ttl: TTL value in request meta header (default 2) wallet: WIF (NEP-2) string or path to the wallet or binary key xhdr: Dict with request X-Headers + Returns: - (str): ID of patched Object + Command's result. """ return self._execute( "object patch", diff --git a/src/frostfs_testlib/clients/s3/s3_http_client.py b/src/frostfs_testlib/clients/s3/s3_http_client.py index b83e7a8..f6f423d 100644 --- a/src/frostfs_testlib/clients/s3/s3_http_client.py +++ b/src/frostfs_testlib/clients/s3/s3_http_client.py @@ -21,12 +21,16 @@ class S3HttpClient: self, s3gate_endpoint: str, access_key_id: str, secret_access_key: str, profile: str = "default", region: str = "us-east-1" ) -> None: self.http_client = HttpClient() - self.s3gate_endpoint = s3gate_endpoint self.credentials = Credentials(access_key_id, secret_access_key) self.profile = profile self.region = region - self.service = "s3" - self.signature = SigV4Auth(self.credentials, self.service, self.region) + + self.iam_endpoint: str = None + self.s3gate_endpoint: str = None + self.service: str = None + self.signature: SigV4Auth = None + + self.set_endpoint(s3gate_endpoint) def _to_s3_header(self, header: str) -> dict: replacement_map = { @@ -104,6 +108,24 @@ class S3HttpClient: return data + @reporter.step("Set endpoint S3 to {s3gate_endpoint}") + def set_endpoint(self, s3gate_endpoint: str): + if self.s3gate_endpoint == s3gate_endpoint: + return + + self.s3gate_endpoint = s3gate_endpoint + self.service = "s3" + self.signature = SigV4Auth(self.credentials, self.service, self.region) + + @reporter.step("Set endpoint IAM to {iam_endpoint}") + def set_iam_endpoint(self, iam_endpoint: str): + if self.iam_endpoint == iam_endpoint: + return + + self.iam_endpoint = iam_endpoint + self.service = "iam" + self.signature = SigV4Auth(self.credentials, self.service, self.region) + @reporter.step("Patch object S3") def patch_object( self, diff --git a/src/frostfs_testlib/storage/dataclasses/ape.py b/src/frostfs_testlib/storage/dataclasses/ape.py index b7b5dfc..1199435 100644 --- a/src/frostfs_testlib/storage/dataclasses/ape.py +++ b/src/frostfs_testlib/storage/dataclasses/ape.py @@ -52,6 +52,7 @@ class Operations: SEARCH_OBJECT = "SearchObject" HEAD_OBJECT = "HeadObject" PUT_OBJECT = "PutObject" + PATCH_OBJECT = "PatchObject" class Verb(HumanReadableEnum):