예제 #1
0
def _get_client_class_and_version(version):
    if not isinstance(version, api_versions.APIVersion):
        version = api_versions.get_api_version(version)
    else:
        api_versions.check_major_version(version)
    if version.is_latest():
        raise exceptions.UnsupportedVersion(("The version should be explicit, "
                                             "not latest."))
    return version, importutils.import_class("harborclient.v%s.client.Client" %
                                             version.ver_major)
예제 #2
0
파일: client.py 프로젝트: fan301306/harbor
def _get_client_class_and_version(version):
    if not isinstance(version, api_versions.APIVersion):
        version = api_versions.get_api_version(version)
    else:
        api_versions.check_major_version(version)
    if version.is_latest():
        raise exceptions.UnsupportedVersion(("The version should be explicit, "
                                             "not latest."))
    return version, importutils.import_class(
        "harborclient.v%s.client.Client" % version.ver_major)