예제 #1
0
def make_client(instance):
    """Returns an vnfsvc client.
    """
    vnfsvc_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS,
    )
    instance.initialize()
    url = instance._url
    url = url.rstrip("/")
    if '1.0' == instance._api_version[API_NAME]:
        client = vnfsvc_client(username=instance._username,
                                tenant_name=instance._tenant_name,
                                password=instance._password,
                                region_name=instance._region_name,
                                auth_url=instance._auth_url,
                                endpoint_url=url,
                                token=instance._token,
                                auth_strategy=instance._auth_strategy,
                                insecure=instance._insecure,
                                ca_cert=instance._ca_cert,
                                retries=instance._retries,
                                raise_errors=instance._raise_errors,
                                session=instance._session,
                                auth=instance._auth)
        return client
    else:
        raise exceptions.UnsupportedVersion(_("API version %s is not "
                                              "supported") %
                                            instance._api_version[API_NAME])
예제 #2
0
def make_client(instance):
    """Returns an vnfsvc client.
    """
    vnfsvc_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS,
    )
    instance.initialize()
    url = instance._url
    url = url.rstrip("/")
    if '1.0' == instance._api_version[API_NAME]:
        client = vnfsvc_client(username=instance._username,
                               tenant_name=instance._tenant_name,
                               password=instance._password,
                               region_name=instance._region_name,
                               auth_url=instance._auth_url,
                               endpoint_url=url,
                               token=instance._token,
                               auth_strategy=instance._auth_strategy,
                               insecure=instance._insecure,
                               ca_cert=instance._ca_cert,
                               retries=instance._retries,
                               raise_errors=instance._raise_errors,
                               session=instance._session,
                               auth=instance._auth)
        return client
    else:
        raise exceptions.UnsupportedVersion(
            _("API version %s is not "
              "supported") % instance._api_version[API_NAME])
예제 #3
0
def Client(api_version, *args, **kwargs):
    """Return an vnfsvc client.
    @param api_version: only 1.0 is supported now
    """
    vnfsvc_client = utils.get_client_class(
        API_NAME,
        api_version,
        API_VERSIONS,
    )
    return vnfsvc_client(*args, **kwargs)
예제 #4
0
def Client(api_version, *args, **kwargs):
    """Return an vnfsvc client.
    @param api_version: only 1.0 is supported now
    """
    vnfsvc_client = utils.get_client_class(
        API_NAME,
        api_version,
        API_VERSIONS,
    )
    return vnfsvc_client(*args, **kwargs)