本文整理汇总了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
示例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
})
示例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
示例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
示例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
示例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)
示例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)
示例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