keystone.notifications module¶
OpenStack Identity Service 资源通知模块。
- keystone.notifications.ACTIONS = ('created', 'deleted', 'disabled', 'updated', 'internal')¶
资源上的操作。
- class keystone.notifications.Audit[source]¶
基类:
object审计通知函数命名空间。
这是一个命名空间对象,包含所有直接通知函数,用于
Manager方法。- classmethod added_to(target_type, target_id, actor_type, actor_id, initiator=None, public=True, reason=None)[source]¶
- class keystone.notifications.CadfNotificationWrapper(operation)[source]¶
基类:
object发送 CADF 事件通知,用于各种方法。
此函数仅用于身份验证事件。 其
action和event_type在下面规定。action:
authenticateevent_type:
identity.authenticate
发送 CADF 通知,用于诸如身份验证是否成功之类的事件。
- 参数:
operation – 正在执行的身份验证相关操作
- class keystone.notifications.CadfRoleAssignmentNotificationWrapper(operation)[source]¶
基类:
object发送
role_assignment方法的 CADF 通知。此函数仅用于角色分配事件。 其
action和event_type在下面规定。action:
created.role_assignment或deleted.role_assignment- event_type:
identity.role_assignment.created或 identity.role_assignment.deleted
- event_type:
如果包装的方法未引发
Exception(例如keystone.exception.NotFound),则发送 CADF 通知。- 参数:
operation – 来自 ACTIONS 的值之一 (created 或 deleted)
- ROLE_ASSIGNMENT = 'role_assignment'¶
- keystone.notifications.emit_event¶
- keystone.notifications.invalidate_token_cache_notification(reason)[source]¶
用于使 token 缓存失效的特定通知。
- 参数:
reason (string) – 使 token 缓存失效的具体原因。
- keystone.notifications.listener(cls)[source]¶
一个类装饰器,用于声明一个类作为通知监听器。
一个通知监听器必须通过定义
event_callbacks属性或属性来指定它感兴趣的事件。event_callbacks是一个字典,其中键是事件类型,值是包含资源类型到回调的映射的字典。ACTIONS包含当前支持的事件的常量。 目前没有单个位置可以找到资源类型的常量。示例
@listener class Something(object): def __init__(self): self.event_callbacks = { notifications.ACTIONS.created: { 'user': self._user_created_callback }, notifications.ACTIONS.deleted: { 'project': [ self._project_deleted_callback, self._do_cleanup, ] }, }
- keystone.notifications.notify_event_callbacks(service, resource_type, operation, payload)[source]¶
向已注册的扩展发送通知。
- keystone.notifications.register_event_callback(event, resource_type, callbacks)[source]¶
将每个回调与事件注册。
- 参数:
event (keystone.notifications.ACTIONS) – 正在注册的操作
resource_type (str) – 正在操作的资源类型
callbacks (list) – 要与事件注册的回调项
- 引发:
ValueError – 如果事件不是有效的 ACTION
TypeError – 如果回调不可调用
- keystone.notifications.role_assignment¶
- keystone.notifications.send_saml_audit_notification(action, user_id, group_ids, identity_provider, protocol, token_id, outcome)[source]¶
发送通知,以告知观察者 SAML 事件。
- 参数:
action (str) – 正在审计的操作
user_id (str) – 来自 Keystone token 的用户 ID
group_ids (list) – 来自 Keystone token 的 Group ID 列表
identity_provider (str or None) – 来自 Keystone token 的 IdP 的 ID
protocol (str) – 来自 Keystone token 的 IdP 的协议 ID
token_id (str or None) – 来自 Keystone token 的 audit_id
outcome (str) –
pycadf.cadftaxonomy的其中之一