def __init__(self, pai_uri: str=None, user: str=None, password: str=None, storages: list=[], default_storage_alias: str=None, **kwargs): __logger__.debug('creating cluster from info %s', get_args()) self.pai_uri = pai_uri self.user = user self.password = password self.storages = storages self.default_storage_alias = default_storage_alias self.storage_clients = {} for k, v in kwargs.items(): setattr(self, k, v) for cfg in storages: self.add_storage(**cfg) if len(storages) == 1: self.default_storage_alias = storages[0]["storage_alias"]
def load(self, cluster_alias: str = None, pai_uri: str = None, user: str = None, password: str = None, token: str = None, **kwargs): self.config.update(get_args()) # validate assert self.alias, "cluster must have an alias" assert self.user, "must specify a user name" assert re.match( "^(http|https)://(.*[^/])$", self.pai_uri ), "pai_uri should be a uri in the format of http(s)://x.x.x.x" return self
def new_unit(name: str, type: str, protocolVersion: int = 2, **kwargs): return get_args()
def foo(a, b, **kwargs): return get_args()
def bar(self, a, b, **kwargs): return get_args()