当前位置: 首页>>代码示例>>Python>>正文


Python client.Client方法代码示例

本文整理汇总了Python中heatclient.v1.client.Client方法的典型用法代码示例。如果您正苦于以下问题:Python client.Client方法的具体用法?Python client.Client怎么用?Python client.Client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在heatclient.v1.client的用法示例。


在下文中一共展示了client.Client方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: authenticate_keystone_admin

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_keystone_admin(self, keystone_sentry, user, password,
                                    tenant=None, api_version=None,
                                    keystone_ip=None):
        """Authenticates admin user with the keystone admin endpoint."""
        self.log.debug('Authenticating keystone admin...')
        unit = keystone_sentry
        if not keystone_ip:
            keystone_ip = unit.relation('shared-db',
                                        'mysql:shared-db')['private-address']
        base_ep = "http://{}:35357".format(keystone_ip.strip().decode('utf-8'))
        if not api_version or api_version == 2:
            ep = base_ep + "/v2.0"
            return keystone_client.Client(username=user, password=password,
                                          tenant_name=tenant, auth_url=ep)
        else:
            ep = base_ep + "/v3"
            auth = keystone_id_v3.Password(
                user_domain_name='admin_domain',
                username=user,
                password=password,
                domain_name='admin_domain',
                auth_url=ep,
            )
            sess = keystone_session.Session(auth=auth)
            return keystone_client_v3.Client(session=sess) 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:27,代码来源:utils.py

示例2: authenticate_nova_user

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_nova_user(self, keystone, user, password, tenant):
        """Authenticates a regular user with nova-api."""
        self.log.debug('Authenticating nova user ({})...'.format(user))
        ep = keystone.service_catalog.url_for(service_type='identity',
                                              interface='publicURL')
        if keystone.session:
            return nova_client.Client(NOVA_CLIENT_VERSION,
                                      session=keystone.session,
                                      auth_url=ep)
        elif novaclient.__version__[0] >= "7":
            return nova_client.Client(NOVA_CLIENT_VERSION,
                                      username=user, password=password,
                                      project_name=tenant, auth_url=ep)
        else:
            return nova_client.Client(NOVA_CLIENT_VERSION,
                                      username=user, api_key=password,
                                      project_id=tenant, auth_url=ep) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:19,代码来源:utils.py

示例3: authenticate_cinder_admin

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_cinder_admin(self, keystone_sentry, username,
                                  password, tenant):
        """Authenticates admin user with cinder."""
        # NOTE(beisner): cinder python client doesn't accept tokens.
        service_ip = \
            keystone_sentry.relation('shared-db',
                                     'mysql:shared-db')['private-address']
        ept = "http://{}:5000/v2.0".format(service_ip.strip().decode('utf-8'))
        return cinder_client.Client(username, password, tenant, ept) 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:11,代码来源:utils.py

示例4: authenticate_keystone_user

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_keystone_user(self, keystone, user, password, tenant):
        """Authenticates a regular user with the keystone public endpoint."""
        self.log.debug('Authenticating keystone user ({})...'.format(user))
        ep = keystone.service_catalog.url_for(service_type='identity',
                                              endpoint_type='publicURL')
        return keystone_client.Client(username=user, password=password,
                                      tenant_name=tenant, auth_url=ep) 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:9,代码来源:utils.py

示例5: authenticate_glance_admin

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_glance_admin(self, keystone):
        """Authenticates admin user with glance."""
        self.log.debug('Authenticating glance admin...')
        ep = keystone.service_catalog.url_for(service_type='image',
                                              endpoint_type='adminURL')
        return glance_client.Client(ep, token=keystone.auth_token) 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:8,代码来源:utils.py

示例6: authenticate_heat_admin

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_heat_admin(self, keystone):
        """Authenticates the admin user with heat."""
        self.log.debug('Authenticating heat admin...')
        ep = keystone.service_catalog.url_for(service_type='orchestration',
                                              endpoint_type='publicURL')
        return heat_client.Client(endpoint=ep, token=keystone.auth_token) 
开发者ID:openstack,项目名称:charm-plumgrid-gateway,代码行数:8,代码来源:utils.py

示例7: authenticate_cinder_admin

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_cinder_admin(self, keystone_sentry, username,
                                  password, tenant, api_version=2):
        """Authenticates admin user with cinder."""
        # NOTE(beisner): cinder python client doesn't accept tokens.
        keystone_ip = keystone_sentry.info['public-address']
        ept = "http://{}:5000/v2.0".format(keystone_ip.strip().decode('utf-8'))
        _clients = {
            1: cinder_client.Client,
            2: cinder_clientv2.Client}
        return _clients[api_version](username, password, tenant, ept) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:12,代码来源:utils.py

示例8: authenticate_keystone

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_keystone(self, keystone_ip, username, password,
                              api_version=False, admin_port=False,
                              user_domain_name=None, domain_name=None,
                              project_domain_name=None, project_name=None):
        """Authenticate with Keystone"""
        self.log.debug('Authenticating with keystone...')
        port = 5000
        if admin_port:
            port = 35357
        base_ep = "http://{}:{}".format(keystone_ip.strip().decode('utf-8'),
                                        port)
        if not api_version or api_version == 2:
            ep = base_ep + "/v2.0"
            auth = v2.Password(
                username=username,
                password=password,
                tenant_name=project_name,
                auth_url=ep
            )
            sess = keystone_session.Session(auth=auth)
            client = keystone_client.Client(session=sess)
            # This populates the client.service_catalog
            client.auth_ref = auth.get_access(sess)
            return client
        else:
            ep = base_ep + "/v3"
            auth = v3.Password(
                user_domain_name=user_domain_name,
                username=username,
                password=password,
                domain_name=domain_name,
                project_domain_name=project_domain_name,
                project_name=project_name,
                auth_url=ep
            )
            sess = keystone_session.Session(auth=auth)
            client = keystone_client_v3.Client(session=sess)
            # This populates the client.service_catalog
            client.auth_ref = auth.get_access(sess)
            return client 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:42,代码来源:utils.py

示例9: authenticate_glance_admin

# 需要导入模块: from heatclient.v1 import client [as 别名]
# 或者: from heatclient.v1.client import Client [as 别名]
def authenticate_glance_admin(self, keystone):
        """Authenticates admin user with glance."""
        self.log.debug('Authenticating glance admin...')
        ep = keystone.service_catalog.url_for(service_type='image',
                                              interface='adminURL')
        if keystone.session:
            return glance_client.Client(ep, session=keystone.session)
        else:
            return glance_client.Client(ep, token=keystone.auth_token) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:11,代码来源:utils.py


注:本文中的heatclient.v1.client.Client方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。