watcherclient.client 模块¶
- watcherclient.client.Client(version, *args, **kwargs)[source]¶
基于给定的版本初始化客户端对象。
操作指南:创建客户端实例的最简单方法是用您的凭据进行初始化
>>> from watcherclient import client >>> watcher = client.Client(VERSION, USERNAME, PASSWORD, ... PROJECT_ID, AUTH_URL)
这里
VERSION可以是一个字符串或watcherclient.api_versions.APIVersion对象。如果您更喜欢字符串值,可以使用1或1.X(其中 X 是一个微版本)。或者,您可以使用 keystoneauth 会话 API 创建客户端实例。请参阅 python-watcherclient 文档中的“The watcherclient Python API”页面。
- watcherclient.client.get_client(api_version, os_auth_token=None, watcher_url=None, os_username=None, os_password=None, os_auth_url=None, os_project_id=None, os_project_name=None, os_tenant_id=None, os_tenant_name=None, os_region_name=None, os_user_domain_id=None, os_user_domain_name=None, os_project_domain_id=None, os_project_domain_name=None, os_service_type=None, os_endpoint_type=None, insecure=None, timeout=None, os_cacert=None, ca_file=None, os_cert=None, cert_file=None, os_key=None, key_file=None, os_infra_optim_api_version=None, max_retries=None, retry_interval=None, session=None, os_endpoint_override=None, **ignored_kwargs)[source]¶
基于凭据获取经过身份验证的客户端。
- 参数:
api_version – 要使用的 API 版本。有效值:‘1’。
os_auth_token – 要重用的预先存在的令牌
watcher_url – watcher API 端点
os_username – 用户的名称
os_password – 用户的密码
os_auth_url – 用于进行身份验证的端点
os_project_id – 项目的 ID
os_project_name – 项目的名称
os_tenant_id – 租户的 ID(已弃用,推荐使用 os_project_id)
os_tenant_name – 租户的名称(已弃用,推荐使用 os_project_name)
os_region_name – keystone 区域的名称
os_user_domain_id – 用户所属的域的 ID
os_user_domain_name – 用户所属的域的名称
os_project_domain_id – 项目所属的域的 ID
os_project_domain_name – 项目所属的域的名称
os_service_type – 要查找端点的服务类型
os_endpoint_type – 端点的类型(暴露方式)
insecure – 允许不安全的 SSL(不进行证书验证)
timeout – 允许自定义客户端 HTTP 请求的超时时间
os_cacert – cacert 文件的路径
ca_file – cacert 文件的路径,已弃用,推荐使用 os_cacert
os_cert – cert 文件的路径
cert_file – cert 文件的路径,已弃用,推荐使用 os_cert
os_key – key 文件的路径
key_file – key 文件的路径,已弃用,推荐使用 os_key
os_infra_optim_api_version – 要使用的 watcher API 版本
max_retries – 发生冲突错误时的最大重试次数
retry_interval – 发生冲突错误时重试之间的时间间隔(秒)
session – 要使用的 Keystone 会话
os_endpoint_override – watcher API 端点
ignored_kwargs – 传递的所有其他参数。为了向后兼容而保留。它们将被忽略。