[#188] Add CredentialsProvider

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2024-03-01 02:15:40 +03:00
parent 22b41b227f
commit 09a7f66d1e
5 changed files with 79 additions and 48 deletions

View file

@ -0,0 +1,25 @@
from abc import abstractmethod
from frostfs_testlib.plugins import load_plugin
from frostfs_testlib.storage.cluster import ClusterNode
class S3CredentialsProvider(object):
stash: dict
def __init__(self, stash: dict) -> None:
self.stash = stash
@abstractmethod
def provide(self, cluster_node: ClusterNode) -> tuple[str, str]:
raise NotImplementedError("Directly called abstract class?")
class CredentialsProvider(object):
stash: dict
S3: S3CredentialsProvider
def __init__(self, s3_plugin_name: str) -> None:
self.stash = {}
s3cls = load_plugin("frostfs.testlib.credentials_providers", s3_plugin_name)
self.S3 = s3cls(self.stash)