in oss-torch-connector/osstorchconnector/_oss_tar_iterable.py [0:0]
def generate_tar_archive(endpoint: str, cred_path: str, config_path: str, tar_path: str,
index_path: str, source_path: str, index_only: bool = False,
cred_provider: Any = None):
""" Generate tar archive and its index.
Args:
endpoint(str): Endpoint of the OSS bucket where the objects are stored.
cred_path(str): Credential info of the OSS bucket where the objects are stored.
config_path(str): Configuration file path of the OSS connector.
tar_path(str): Path to the tar archive. (OSS URI or local path)
index_path(str): Path to the tar index. (OSS URI or local path)
source_path(str): Path to the source directory. (OSS URI or local path)
index_only(bool): If True, generate tar index from tar archive specified by 'tar_path',
otherwise (by default) generate tar archive and its index from
source directory specified by 'source_path'.
cred_provider: OSS credential provider.
"""
if not endpoint:
raise ValueError("endpoint must be non-empty")
if not cred_path and not cred_provider:
raise ValueError("neither cred_path nor cred_provider is specified")
client = OssClient(endpoint, cred_path, config_path, cred_provider=cred_provider)
return client.gen_tar_archive(tar_path, index_path, source_path, index_only)