forked from TrueCloudLab/frostfs-testlib
[#188] Add CredentialsProvider
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
22b41b227f
commit
09a7f66d1e
5 changed files with 79 additions and 48 deletions
25
src/frostfs_testlib/credentials/interfaces.py
Normal file
25
src/frostfs_testlib/credentials/interfaces.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue