當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.get_client_class方法代碼示例

本文整理匯總了Python中osc_lib.utils.get_client_class方法的典型用法代碼示例。如果您正苦於以下問題:Python utils.get_client_class方法的具體用法?Python utils.get_client_class怎麽用?Python utils.get_client_class使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在osc_lib.utils的用法示例。


在下文中一共展示了utils.get_client_class方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: make_client

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
def make_client(instance):
    """Returns a workflow_engine service client."""
    version = instance._api_version[API_NAME]
    workflow_client = utils.get_client_class(
        API_NAME,
        version,
        API_VERSIONS)

    LOG.debug('Instantiating workflow engine client: %s', workflow_client)

    mistral_url = instance.get_endpoint_for_service_type(
        'workflowv2',
        region_name=instance.region_name,
        interface='publicURL'
    )

    client = workflow_client(mistral_url=mistral_url, session=instance.session)

    return client 
開發者ID:openstack,項目名稱:python-mistralclient,代碼行數:21,代碼來源:plugin.py

示例2: make_client

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
def make_client(instance):
    """Return a metrics service client."""
    version = instance._api_version[API_NAME]
    try:
        version = int(version)
    except ValueError:
        version = float(version)

    gnocchi_client = utils.get_client_class(
        API_NAME,
        version,
        API_VERSIONS)
    # NOTE(sileht): ensure setup of the session is done
    instance.setup_auth()
    return gnocchi_client(session=instance.session,
                          adapter_options={
                              'interface': instance.interface,
                              'region_name': instance.region_name
                          }) 
開發者ID:gnocchixyz,項目名稱:python-gnocchiclient,代碼行數:21,代碼來源:osc.py

示例3: make_client

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
def make_client(instance):
    """Returns a client to the ClientManager."""

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

    kwargs = {'service_type': 'nfv-orchestration',
              'region_name': instance._region_name,
              'endpoint_type': instance._interface,
              'interface': instance._interface,
              'session': instance.session
              }

    client = tacker_client(**kwargs)

    return client 
開發者ID:openstack,項目名稱:python-tackerclient,代碼行數:21,代碼來源:plugin.py

示例4: make_client

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
def make_client(api_version, session=None,
                endpoint=None, service_type='monitoring'):
    """Returns an monitoring API client."""

    client_cls = utils.get_client_class('monitoring', api_version, VERSION_MAP)
    c = client_cls(
        session=session,
        service_type=service_type,
        endpoint=endpoint,
        app_name='monascaclient',
        app_version=version.version_string,
    )

    return c 
開發者ID:openstack,項目名稱:python-monascaclient,代碼行數:16,代碼來源:migration.py

示例5: local_orchestration

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
def local_orchestration(self, api_port):
        """Returns an local_orchestration service client"""

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

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

        heat_client = utils.get_client_class(
            API_NAME,
            '1',
            API_VERSIONS)
        LOG.debug('Instantiating local_orchestration client: %s', heat_client)

        client = heat_client(
            endpoint='http://127.0.0.1:%s/v1/admin' % api_port,
            username='admin',
            password='fake',
            region_name='regionOne',
            token='fake',
        )

        self._local_orchestration = client
        return self._local_orchestration 
開發者ID:openstack,項目名稱:python-tripleoclient,代碼行數:28,代碼來源:plugin.py

示例6: make_client

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
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) 
開發者ID:openstack,項目名稱:python-designateclient,代碼行數:10,代碼來源:plugin.py

示例7: make_client

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
def make_client(instance):
    """Returns a rating service client."""
    version = instance._api_version[API_NAME]
    ck_client = utils.get_client_class(
        API_NAME,
        version,
        API_VERSIONS)
    instance.setup_auth()
    adapter_options = dict(
        interface=instance.interface,
        region_name=instance.region_name,
    )
    return ck_client(session=instance.session,
                     adapter_options=adapter_options) 
開發者ID:openstack,項目名稱:python-cloudkittyclient,代碼行數:16,代碼來源:osc.py

示例8: make_client

# 需要導入模塊: from osc_lib import utils [as 別名]
# 或者: from osc_lib.utils import get_client_class [as 別名]
def make_client(instance):
    """Returns a magnum client."""
    magnum_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS)
    LOG.debug('Instantiating magnum client: %s', magnum_client)

    client = magnum_client(session=instance.session,
                           region_name=instance._region_name,
                           interface=instance._interface,
                           insecure=instance._insecure,
                           ca_cert=instance._cacert,
                           api_version=DEFAULT_MAGNUM_API_VERSION)
    return client 
開發者ID:openstack,項目名稱:python-magnumclient,代碼行數:17,代碼來源:plugin.py


注:本文中的osc_lib.utils.get_client_class方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。