def make_client(instance):
    """Returns an image service client"""
    image_client = utils.get_client_class(API_NAME,
                                          instance._api_version[API_NAME],
                                          API_VERSIONS)
    LOG.debug('Instantiating image client: %s', image_client)

    endpoint = instance.get_endpoint_for_service_type(
        API_NAME,
        region_name=instance._region_name,
        endpoint_type=instance._endpoint_type,
    )

    client = image_client(
        endpoint,
        token=instance.auth.get_token(instance.session),
        cacert=instance._cacert,
        insecure=instance._insecure,
    )

    # Create the low-level API

    image_api = utils.get_client_class(API_NAME,
                                       instance._api_version[API_NAME],
                                       IMAGE_API_VERSIONS)
    LOG.debug('Instantiating image api: %s', image_api)

    client.api = image_api(session=instance.session,
                           endpoint=instance.get_endpoint_for_service_type(
                               IMAGE_API_TYPE,
                               region_name=instance._region_name,
                               endpoint_type=instance._endpoint_type,
                           ))

    return client
def make_client(instance):
    """Returns an network service client"""
    network_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating network client: %s', network_client)

    endpoint = instance.get_endpoint_for_service_type(
        API_NAME,
        region_name=instance._region_name,
    )

    client = network_client(
        session=instance.session,
        region_name=instance._region_name,
    )

    network_api = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        NETWORK_API_VERSIONS)
    LOG.debug('Instantiating network api: %s', network_client)

    # v2 is hard-coded until discovery is completed, neutron only has one atm
    client.api = network_api(
        session=instance.session,
        service_type=NETWORK_API_TYPE,
        endpoint='/'.join([
            endpoint,
            API_VERSION_MAP[instance._api_version[API_NAME]],
        ])
    )

    return client
def make_client(instance):
    """Returns an network service client"""
    network_client = utils.get_client_class(API_NAME,
                                            instance._api_version[API_NAME],
                                            API_VERSIONS)
    LOG.debug('Instantiating network client: %s', network_client)

    endpoint = instance.get_endpoint_for_service_type(
        API_NAME,
        region_name=instance._region_name,
        endpoint_type=instance._endpoint_type,
    )

    # Remember endpoint_type only if it is set
    kwargs = utils.build_kwargs_dict('endpoint_type', instance._endpoint_type)

    client = network_client(session=instance.session,
                            region_name=instance._region_name,
                            **kwargs)

    network_api = utils.get_client_class(API_NAME,
                                         instance._api_version[API_NAME],
                                         NETWORK_API_VERSIONS)
    LOG.debug('Instantiating network api: %s', network_client)

    # v2 is hard-coded until discovery is completed, neutron only has one atm
    client.api = network_api(
        session=instance.session,
        service_type=NETWORK_API_TYPE,
        endpoint='/'.join([
            endpoint,
            API_VERSION_MAP[instance._api_version[API_NAME]],
        ]))

    return client
def make_client(instance):
    """Returns a compute service client."""
    compute_client = utils.get_client_class(API_NAME,
                                            instance._api_version[API_NAME],
                                            API_VERSIONS)
    LOG.debug('instantiating compute client: %s' % compute_client)
    client = compute_client(
        username=instance._username,
        api_key=instance._password,
        project_id=instance._project_name,
        auth_url=instance._auth_url,
        # FIXME(dhellmann): add constructor argument for this
        insecure=False,
        region_name=instance._region_name,
        # FIXME(dhellmann): get endpoint_type from option?
        endpoint_type='publicURL',
        # FIXME(dhellmann): add extension discovery
        extensions=[],
        service_type=API_NAME,
        # FIXME(dhellmann): what is service_name?
        service_name='')

    # Populate the Nova client to skip another auth query to Identity
    if instance._url:
        # token flow
        client.client.management_url = instance._url
    else:
        # password flow
        client.client.management_url = instance.get_endpoint_for_service_type(
            API_NAME)
        client.client.service_catalog = instance._service_catalog
    client.client.auth_token = instance._token
    return client
    def orchestration(self):
        """Returns an orchestration service client"""

        # TODO(d0ugal): This code is based on the upstream WIP implementation
        # and should be removed when it lands:
        # https://review.openstack.org/#/c/111786

        if self._orchestration is not None:
            return self._orchestration

        API_VERSIONS = {
            '1': 'heatclient.v1.client.Client',
        }

        heat_client = utils.get_client_class(
            API_NAME, self._instance._api_version[API_NAME], API_VERSIONS)
        LOG.debug('Instantiating orchestration client: %s', heat_client)

        endpoint = self._instance.get_endpoint_for_service_type(
            'orchestration')
        token = self._instance.auth.get_token(self._instance.session)

        client = heat_client(
            endpoint=endpoint,
            auth_url=self._instance._auth_url,
            token=token,
            username=self._instance._username,
            password=self._instance._password,
            region_name=self._instance._region_name,
            insecure=self._instance._insecure,
            ca_file=self._instance._cli_options.os_cacert,
        )

        self._orchestration = client
        return self._orchestration
Exemple #6
0
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(API_NAME,
                                             instance._api_version[API_NAME],
                                             API_VERSIONS)
    LOG.debug('Instantiating identity client: %s', identity_client)

    # TODO(dtroyer): Something doesn't like the session.auth when using
    #                token auth, chase that down.
    if instance._url:
        LOG.debug('Using token auth')
        client = identity_client(
            endpoint=instance._url,
            token=instance._token,
            cacert=instance._cacert,
            insecure=instance._insecure,
            trust_id=instance._trust_id,
        )
    else:
        LOG.debug('Using password auth')
        client = identity_client(
            session=instance.session,
            cacert=instance._cacert,
        )

    # TODO(dtroyer): the identity v2 role commands use this yet, fix that
    #                so we can remove it
    if not instance._url:
        instance.auth_ref = instance.auth.get_auth_ref(instance.session)

    return client
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating identity client: %s', identity_client)

    # TODO(dtroyer): Something doesn't like the session.auth when using
    #                token auth, chase that down.
    if instance._url:
        LOG.debug('Using token auth')
        client = identity_client(
            endpoint=instance._url,
            token=instance._token,
            cacert=instance._cacert,
            insecure=instance._insecure,
            trust_id=instance._trust_id,
        )
    else:
        LOG.debug('Using password auth')
        client = identity_client(
            session=instance.session,
            cacert=instance._cacert,
        )

    # TODO(dtroyer): the identity v2 role commands use this yet, fix that
    #                so we can remove it
    if not instance._url:
        instance.auth_ref = instance.auth.get_auth_ref(instance.session)

    return client
    def orchestration(self):
        """Returns an orchestration service client"""

        # TODO(d0ugal): This code is based on the upstream WIP implementation
        # and should be removed when it lands:
        # https://review.openstack.org/#/c/111786

        if self._orchestration is not None:
            return self._orchestration

        API_VERSIONS = {
            '1': 'heatclient.v1.client.Client',
        }

        heat_client = utils.get_client_class(
            API_NAME,
            self._instance._api_version[API_NAME],
            API_VERSIONS)
        LOG.debug('Instantiating orchestration client: %s', heat_client)

        endpoint = self._instance.get_endpoint_for_service_type('orchestration')
        token = self._instance.auth.get_token(self._instance.session)

        client = heat_client(
            endpoint=endpoint,
            auth_url=self._instance._auth_url,
            token=token,
            username=self._instance._username,
            password=self._instance._password,
            region_name=self._instance._region_name,
            insecure=self._instance._insecure,
        )

        self._orchestration = client
        return self._orchestration
Exemple #9
0
def make_client(instance):
    cls = oscutils.get_client_class(API_NAME, instance._api_version[API_NAME],
                                    API_VERSIONS)
    kwargs = oscutils.build_kwargs_dict('endpoint_type', instance._interface)
    return cls(session=instance.session,
               region_name=instance._region_name,
               **kwargs)
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    if instance._url:
        LOG.debug('instantiating identity client: token flow')
        client = identity_client(
            endpoint=instance._url,
            token=instance._token,
            cacert=instance._cacert,
            insecure=instance._insecure,
        )
    else:
        LOG.debug('instantiating identity client: password flow')
        client = identity_client(
            username=instance._username,
            password=instance._password,
            user_domain_id=instance._user_domain_id,
            user_domain_name=instance._user_domain_name,
            project_domain_id=instance._project_domain_id,
            project_domain_name=instance._project_domain_name,
            domain_id=instance._domain_id,
            domain_name=instance._domain_name,
            tenant_name=instance._project_name,
            tenant_id=instance._project_id,
            auth_url=instance._auth_url,
            region_name=instance._region_name,
            cacert=instance._cacert,
            insecure=instance._insecure,
        )
        instance.auth_ref = client.auth_ref
    return client
Exemple #11
0
def make_client(instance):
    """Returns a volume service client."""

    # Defer client imports until we actually need them
    from cinderclient import extension
    from cinderclient.v1.contrib import list_extensions
    from cinderclient.v1 import volume_snapshots
    from cinderclient.v1 import volumes

    # Monkey patch for v1 cinderclient
    volumes.Volume.NAME_ATTR = 'display_name'
    volume_snapshots.Snapshot.NAME_ATTR = 'display_name'

    volume_client = utils.get_client_class(API_NAME,
                                           instance._api_version[API_NAME],
                                           API_VERSIONS)
    LOG.debug('Instantiating volume client: %s', volume_client)

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    extensions = [extension.Extension('list_extensions', list_extensions)]

    client = volume_client(
        session=instance.session,
        extensions=extensions,
        http_log_debug=http_log_debug,
        region_name=instance._region_name,
    )

    return client
Exemple #12
0
def make_client(instance):
    """Returns an charging service client"""
    king_client = utils.get_client_class(API_NAME,
                                         instance._api_version[API_NAME],
                                         API_VERSIONS)
    LOG.debug('Instantiating charging client: %s', king_client)

    kwargs = {
        'region_name': instance.region_name,
        'interface': instance.interface
    }

    if instance.session:
        kwargs.update({'session': instance.session, 'service_type': API_NAME})
    else:
        endpoint = instance.get_endpoint_for_service_type(
            API_NAME,
            region_name=instance.region_name,
            interface=instance.interface,
        )

        kwargs.update({
            'endpoint': endpoint,
            'auth_url': instance.auth.auth_url,
            'username': instance.auth_ref.username,
            'token': instance.auth_ref.auth_token
        })

    client = king_client(**kwargs)

    return client
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    if instance._url:
        LOG.debug('instantiating identity client: token flow')
        client = identity_client(
            endpoint=instance._url,
            token=instance._token)
    else:
        LOG.debug('instantiating identity client: password flow')
        client = identity_client(
            username=instance._username,
            password=instance._password,
            user_domain_id=instance._user_domain_id,
            user_domain_name=instance._user_domain_name,
            project_domain_id=instance._project_domain_id,
            project_domain_name=instance._project_domain_name,
            domain_id=instance._domain_id,
            domain_name=instance._domain_name,
            tenant_name=instance._project_name,
            tenant_id=instance._project_id,
            auth_url=instance._auth_url,
            region_name=instance._region_name,
            cacert=instance._cacert,
            insecure=instance._insecure,
        )
        instance.auth_ref = client.auth_ref
    return client
def make_client(instance):
    """Returns a volume service client."""
    volume_client = utils.get_client_class(API_NAME,
                                           instance._api_version[API_NAME],
                                           API_VERSIONS)
    LOG.debug('Instantiating volume client: %s', volume_client)

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    extensions = [extension.Extension('list_extensions', list_extensions)]
    client = volume_client(
        username=instance._username,
        api_key=instance._password,
        project_id=instance._project_name,
        auth_url=instance._auth_url,
        cacert=instance._cacert,
        insecure=instance._insecure,
        region_name=instance._region_name,
        extensions=extensions,
        http_log_debug=http_log_debug,
    )

    # Populate the Cinder client to skip another auth query to Identity
    if instance._url:
        # token flow
        client.client.management_url = instance._url
    else:
        # password flow
        client.client.management_url = instance.get_endpoint_for_service_type(
            API_NAME)
        client.client.service_catalog = instance._service_catalog
    client.client.auth_token = instance._token

    return client
def make_client(instance):
    """Returns a compute service client."""
    compute_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('instantiating compute client: %s' % compute_client)
    client = compute_client(
        username=instance._username,
        api_key=instance._password,
        project_id=instance._project_name,
        auth_url=instance._auth_url,
        # FIXME(dhellmann): add constructor argument for this
        insecure=False,
        region_name=instance._region_name,
        # FIXME(dhellmann): get endpoint_type from option?
        endpoint_type='publicURL',
        # FIXME(dhellmann): add extension discovery
        extensions=[],
        service_type=API_NAME,
        # FIXME(dhellmann): what is service_name?
        service_name='')

    # Populate the Nova client to skip another auth query to Identity
    if instance._url:
        # token flow
        client.client.management_url = instance._url
    else:
        # password flow
        client.client.management_url = instance.get_endpoint_for_service_type(
            API_NAME)
        client.client.service_catalog = instance._service_catalog
    client.client.auth_token = instance._token
    return client
Exemple #16
0
def make_client(instance):
    """Returns a volume service client."""

    # Defer client imports until we actually need them
    from cinderclient import extension
    from cinderclient.v1.contrib import list_extensions
    from cinderclient.v1 import volume_snapshots
    from cinderclient.v1 import volumes

    # Monkey patch for v1 cinderclient
    volumes.Volume.NAME_ATTR = 'display_name'
    volume_snapshots.Snapshot.NAME_ATTR = 'display_name'

    volume_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS
    )
    LOG.debug('Instantiating volume client: %s', volume_client)

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    extensions = [extension.Extension('list_extensions', list_extensions)]

    client = volume_client(
        session=instance.session,
        extensions=extensions,
        http_log_debug=http_log_debug,
        region_name=instance._region_name,
    )

    return client
def make_client(instance):
    """Returns a volume service client."""
    volume_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS
    )

    LOG.debug('instantiating volume client')

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    client = volume_client(
        username=instance._username,
        api_key=instance._password,
        project_id=instance._project_name,
        auth_url=instance._auth_url,
        cacert=instance._cacert,
        insecure=instance._insecure,
        region_name=instance._region_name,
        http_log_debug=http_log_debug
    )

    return client
def make_client(instance):
    cls = oscutils.get_client_class(
        API_NAME, instance._api_version[API_NAME],
        API_VERSIONS)
    kwargs = oscutils.build_kwargs_dict('endpoint_type', instance._interface)
    return cls(session=instance.session,
               region_name=instance._region_name, **kwargs)
Exemple #19
0
def make_client(instance):
    """Returns an identity service client.
    """
    identity_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS,
    )
    if instance._url:
        LOG.debug('instantiating identity client: token flow')
        client = identity_client(
            endpoint=instance._url,
            token=instance._token,
        )
    else:
        LOG.debug('instantiating identity client: password flow')
        client = identity_client(
            username=instance._username,
            password=instance._password,
            tenant_name=instance._tenant_name,
            tenant_id=instance._tenant_id,
            auth_url=instance._auth_url,
            region_name=instance._region_name,
        )
    return client
def make_client(instance):
    """Returns an appcatalog service client."""
    plugin_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating app catalog client: %s', plugin_client)
    client = plugin_client()
    return client
Exemple #21
0
def make_client(instance):
    """Returns an queues service client."""
    queues_client = utils.get_client_class(API_NAME,
                                           instance._api_version[API_NAME],
                                           API_VERSIONS)

    if not instance._url:
        instance._url = instance.get_endpoint_for_service_type(API_NAME)

    return queues_client(url=instance._url)
Exemple #22
0
def make_client(instance):
    """Returns an image service client."""
    image_client = utils.get_client_class(API_NAME,
                                          instance._api_version[API_NAME],
                                          API_VERSIONS)

    if not instance._url:
        instance._url = instance.get_endpoint_for_service_type(API_NAME)

    return image_client(instance._url, token=instance._token)
Exemple #23
0
def make_client(instance):
    data_processing_client = utils.get_client_class(
        API_NAME, instance._api_version[API_NAME], API_VERSIONS)
    LOG.debug('Instantiating data-processing client: %s',
              data_processing_client)

    client = data_processing_client(session=instance.session,
                                    region_name=instance._region_name,
                                    cacert=instance._cacert,
                                    insecure=instance._insecure)
    return client
def make_client(instance):
    """Returns an image service client."""
    image_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)

    if not instance._url:
        instance._url = instance.get_endpoint_for_service_type(API_NAME)

    return image_client(instance._url, token=instance._token)
Exemple #25
0
def make_client(instance):
    """Returns an queues service client."""
    queues_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)

    if not instance._url:
        instance._url = instance.get_endpoint_for_service_type(API_NAME)

    return queues_client(url=instance._url)
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(API_NAME,
                                             instance._api_version[API_NAME],
                                             API_VERSIONS)
    LOG.debug('Instantiating identity client: %s', identity_client)

    LOG.debug('Using auth plugin: %s' % instance._auth_plugin)
    client = identity_client(session=instance.session, )

    return client
def make_client(instance):
    """Returns an image service client"""
    image_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating image client: %s', image_client)

    endpoint = instance.get_endpoint_for_service_type(
        API_NAME,
        region_name=instance._region_name,
        interface=instance._interface,
    )

    client = image_client(
        endpoint,
        token=instance.auth.get_token(instance.session),
        cacert=instance._cacert,
        insecure=instance._insecure,
    )

    # Create the low-level API

    image_api = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        IMAGE_API_VERSIONS)
    LOG.debug('Instantiating image api: %s', image_api)

    client.api = image_api(
        session=instance.session,
        endpoint=instance.get_endpoint_for_service_type(
            IMAGE_API_TYPE,
            region_name=instance._region_name,
            interface=instance._interface,
        )
    )

    return client
Exemple #28
0
def make_client(instance):
    """Returns a baremetal service client."""
    baremetal_client_class = utils.get_client_class(
        API_NAME, instance._api_version[API_NAME], API_VERSIONS)
    LOG.debug('Instantiating baremetal client: %s', baremetal_client_class)

    client = baremetal_client_class(
        os_ironic_api_version=instance._api_version[API_NAME],
        session=instance.session,
        region_name=instance._region_name,
    )

    return client
Exemple #29
0
def make_client(instance):
    """Returns an application-catalog service client"""
    application_catalog_client = utils.get_client_class(
        API_NAME, instance._api_version[API_NAME], API_VERSIONS)
    LOG.debug("Instantiating application-catalog client: {0}".format(
        application_catalog_client))

    client = application_catalog_client(
        region_name=instance._region_name,
        session=instance.session,
        service_type='application-catalog',
    )
    return client
Exemple #30
0
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating identity client: %s', identity_client)

    LOG.debug('Using auth plugin: %s' % instance._auth_plugin)
    client = identity_client(
        session=instance.session,
    )

    return client
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating identity client: %s', identity_client)

    client = identity_client(
        session=instance.session,
        region_name=instance._region_name,
    )

    return client
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(API_NAME,
                                             instance._api_version[API_NAME],
                                             API_VERSIONS)
    LOG.debug('Instantiating identity client: %s', identity_client)

    # Remember interface only if endpoint_type is set
    kwargs = utils.build_kwargs_dict('interface', instance._endpoint_type)

    client = identity_client(session=instance.session,
                             region_name=instance._region_name,
                             **kwargs)

    return client
Exemple #33
0
def make_client(instance):
    """Returns an object service client."""
    object_client = utils.get_client_class(API_NAME,
                                           instance._api_version[API_NAME],
                                           API_VERSIONS)
    if instance._url:
        endpoint = instance._url
    else:
        endpoint = instance.get_endpoint_for_service_type(API_NAME)
    LOG.debug('instantiating object client')
    client = object_client(
        endpoint=endpoint,
        token=instance._token,
    )
    return client
def make_client(instance):
    """Returns a volume service client."""
    volume_client = utils.get_client_class(API_NAME,
                                           instance._api_version[API_NAME],
                                           API_VERSIONS)

    LOG.debug('instantiating volume client')
    client = volume_client(
        username=instance._username,
        api_key=instance._password,
        project_id=instance._tenant_name,
        auth_url=instance._auth_url,
    )

    return client
Exemple #35
0
def make_client(instance):
    """Returns an application-catalog service client"""
    application_catalog_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug("Instantiating application-catalog client: {0}".format(
              application_catalog_client))

    client = application_catalog_client(
        region_name=instance._region_name,
        session=instance.session,
        service_type='application-catalog',
    )
    return client
def make_client(instance):
    """Returns a baremetal service client."""
    baremetal_client_class = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating baremetal client: %s', baremetal_client_class)

    client = baremetal_client_class(
        os_ironic_api_version=instance._api_version[API_NAME],
        session=instance.session,
        region_name=instance._region_name,
    )

    return client
def make_client(instance):
    """Returns an object service client."""
    object_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    if instance._url:
        endpoint = instance._url
    else:
        endpoint = instance.get_endpoint_for_service_type(API_NAME)
    LOG.debug('instantiating object client')
    client = object_client(
        endpoint=endpoint,
        token=instance._token,
    )
    return client
Exemple #38
0
def make_client(instance):
    """Returns a client to the ClientManager

    Called to instantiate the requested client version.  instance has
    any available auth info that may be required to prepare the client.

    :param ClientManager instance: The ClientManager that owns the new client
    """
    plugin_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating plugin client: %s' % plugin_client)

    client = plugin_client()
    return client
def make_client(instance):
    data_processing_client = utils.get_client_class(
        API_NAME, instance._api_version[API_NAME], API_VERSIONS)
    LOG.debug('Instantiating data-processing client: %s',
              data_processing_client)

    kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)

    client = data_processing_client(
        session=instance.session,
        region_name=instance._region_name,
        cacert=instance._cacert,
        insecure=instance._insecure,
        sahara_url=instance._cli_options.data_processing_url,
        **kwargs)
    return client
def make_client(instance):
    """Returns a volume service client."""
    volume_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS
    )

    LOG.debug('instantiating volume client')
    client = volume_client(
        username=instance._username,
        api_key=instance._password,
        project_id=instance._tenant_name,
        auth_url=instance._auth_url,
    )

    return client
def make_client(instance):
    """Returns an image service client."""
    image_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating image client: %s', image_client)

    if not instance._url:
        instance._url = instance.get_endpoint_for_service_type(API_NAME)

    return image_client(
        instance._url,
        token=instance._token,
        cacert=instance._cacert,
        insecure=instance._insecure,
    )
Exemple #42
0
def make_client(instance):
    """Returns an orchestration service client"""
    heat_client = utils.get_client_class(API_NAME,
                                         instance._api_version[API_NAME],
                                         API_VERSIONS)
    LOG.debug('Instantiating orchestration client: %s', heat_client)

    client = heat_client(
        endpoint=instance.get_endpoint_for_service_type('orchestration'),
        session=instance.session,
        auth_url=instance._auth_url,
        username=instance._username,
        password=instance._password,
        region_name=instance._region_name,
    )

    return client
Exemple #43
0
def make_client(instance):
    """Returns an identity service client."""
    identity_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating identity client: %s', identity_client)

    # Remember interface only if interface is set
    kwargs = utils.build_kwargs_dict('interface', instance._interface)

    client = identity_client(
        session=instance.session,
        region_name=instance._region_name,
        **kwargs
        )

    return client
def make_client(instance):
    """Returns an orchestration service client"""
    heat_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating orchestration client: %s', heat_client)

    client = heat_client(
        endpoint=instance.get_endpoint_for_service_type('orchestration'),
        session=instance.session,
        auth_url=instance._auth_url,
        username=instance._username,
        password=instance._password,
        region_name=instance._region_name,
    )

    return client
def make_client(instance):
    """Returns a volume service client."""
    volume_client = utils.get_client_class(API_NAME,
                                           instance._api_version[API_NAME],
                                           API_VERSIONS)
    LOG.debug('Instantiating volume client: %s', volume_client)

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    extensions = [extension.Extension('list_extensions', list_extensions)]

    client = volume_client(
        session=instance.session,
        extensions=extensions,
        http_log_debug=http_log_debug,
    )

    return client
Exemple #46
0
def make_client(instance):
    """Returns an image service client."""
    image_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating image client: %s', image_client)

    endpoint = instance.get_endpoint_for_service_type(
        API_NAME,
        region_name=instance._region_name,
    )

    return image_client(
        endpoint,
        token=instance.auth.get_token(instance.session),
        cacert=instance._cacert,
        insecure=instance._insecure,
    )
def make_client(instance):
    """Returns an network service client."""
    network_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    if not instance._url:
        instance._url = instance.get_endpoint_for_service_type("network")
    return network_client(
        username=instance._username,
        tenant_name=instance._project_name,
        password=instance._password,
        region_name=instance._region_name,
        auth_url=instance._auth_url,
        endpoint_url=instance._url,
        token=instance._token,
        insecure=instance._insecure,
        ca_cert=instance._cacert,
    )
def make_client(instance):
    data_processing_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating data-processing client: %s',
              data_processing_client)

    kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)

    client = data_processing_client(
        session=instance.session,
        region_name=instance._region_name,
        cacert=instance._cacert,
        insecure=instance._insecure,
        sahara_url=instance._cli_options.data_processing_url,
        **kwargs
        )
    return client
Exemple #49
0
def make_client(instance):
    """Returns an network service client."""
    network_client = utils.get_client_class(API_NAME,
                                            instance._api_version[API_NAME],
                                            API_VERSIONS)
    LOG.debug('Instantiating network client: %s', network_client)

    if not instance._url:
        instance._url = instance.get_endpoint_for_service_type("network")
    return network_client(
        username=instance._username,
        tenant_name=instance._project_name,
        password=instance._password,
        region_name=instance._region_name,
        auth_url=instance._auth_url,
        endpoint_url=instance._url,
        token=instance._token,
        insecure=instance._insecure,
        ca_cert=instance._cacert,
    )
Exemple #50
0
def make_client(instance):
    """Returns a search service client"""
    search_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    # Remember interface only if it is set
    kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)
    client = search_client(
        session=instance.session,
        http_log_debug=http_log_debug,
        region_name=instance._region_name,
        **kwargs
    )

    return client
Exemple #51
0
def make_client(instance):
    client_class = utils.get_client_class(API_NAME,
                                          instance._api_version[API_NAME],
                                          API_VERSIONS)
    LOG.debug('instantiating KDS client: %s' % client_class)

    s = session.Session.construct({'verify': instance._verify,
                                   'cacert': instance._cacert,
                                   'insecure': instance._insecure})

    if instance._url:
        s.auth = token_endpoint.Token(instance._url, instance._token)
    else:
        s.auth = v2_auth.Password(instance._auth_url,
                                  instance._username,
                                  instance._password,
                                  tenant_id=instance._project_id,
                                  tenant_name=instance._project_name)

    return client_class(s)
def make_client(instance):
    """Returns a compute service client."""
    compute_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating compute client: %s', compute_client)

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    extensions = [extension.Extension('list_extensions', list_extensions)]
    client = compute_client(
        username=instance._username,
        api_key=instance._password,
        project_id=instance._project_name,
        auth_url=instance._auth_url,
        cacert=instance._cacert,
        insecure=instance._insecure,
        region_name=instance._region_name,
        # FIXME(dhellmann): get endpoint_type from option?
        endpoint_type='publicURL',
        extensions=extensions,
        service_type=API_NAME,
        # FIXME(dhellmann): what is service_name?
        service_name='',
        http_log_debug=http_log_debug,
        timings=instance.timing,
    )

    # Populate the Nova client to skip another auth query to Identity
    if instance._url:
        # token flow
        client.client.management_url = instance._url
    else:
        # password flow
        client.client.management_url = instance.get_endpoint_for_service_type(
            API_NAME)
        client.client.service_catalog = instance._service_catalog
    client.client.auth_token = instance._token
    return client
def make_client(instance):
    """Returns a volume service client."""
    volume_client = utils.get_client_class(API_NAME,
                                           instance._api_version[API_NAME],
                                           API_VERSIONS)

    LOG.debug('instantiating volume client')

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    client = volume_client(username=instance._username,
                           api_key=instance._password,
                           project_id=instance._project_name,
                           auth_url=instance._auth_url,
                           cacert=instance._cacert,
                           insecure=instance._insecure,
                           region_name=instance._region_name,
                           http_log_debug=http_log_debug)

    return client
Exemple #54
0
def make_client(instance):
    """Returns a volume service client."""
    volume_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS
    )
    LOG.debug('Instantiating volume client: %s', volume_client)

    # Set client http_log_debug to True if verbosity level is high enough
    http_log_debug = utils.get_effective_log_level() <= logging.DEBUG

    extensions = [extension.Extension('list_extensions', list_extensions)]

    client = volume_client(
        session=instance.session,
        extensions=extensions,
        http_log_debug=http_log_debug,
    )

    return client