airflow.providers.google.suite.hooks.calendar¶
此模块包含一个 Google 日历 API hook。
类¶
通过 Google Cloud 连接与 Google 日历交互。 |
模块内容¶
- class airflow.providers.google.suite.hooks.calendar.GoogleCalendarHook(api_version, gcp_conn_id='google_cloud_default', impersonation_chain=None)[source]¶
基类:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
通过 Google Cloud 连接与 Google 日历交互。
Google 日历 API 参考: https://developers.google.com/calendar/api/v3/reference
- 参数:
gcp_conn_id (str) – 用来获取连接信息的连接 ID。
api_version (str) – API 版本。例如 v3
impersonation_chain (str | collections.abc.Sequence[str] | None) – 可选的服务账号,用于使用短期凭据进行模拟,或用于获取列表中最后一个账号(将在请求中模拟)的 access_token 所需的链式账号列表。如果设置为字符串,该账号必须授予发起账号 Service Account Token Creator IAM 角色。如果设置为序列,列表中的身份必须授予紧接前一个身份 Service Account Token Creator IAM 角色,其中列表中的第一个账号将此角色授予发起账号。
- get_events(calendar_id='primary', i_cal_uid=None, max_attendees=None, max_results=None, order_by=None, private_extended_property=None, q=None, shared_extended_property=None, show_deleted=False, show_hidden_invitation=False, single_events=False, sync_token=None, time_max=None, time_min=None, time_zone=None, updated_min=None)[source]¶
从单个 calendar_id 中获取 Google 日历事件。
https://developers.google.com/calendar/api/v3/reference/events/list
- 参数:
calendar_id (str) – 要交互的 Google 日历 ID
i_cal_uid (str | None) – 可选。指定响应中
iCalendar
格式的事件 ID。max_attendees (int | None) – 可选。如果参会人数量超过指定值,则仅返回参与者本人。
max_results (int | None) – 可选。一个结果页面上返回的最大事件数。可通过响应中非空的
nextPageToken
字段检测不完整的页面。默认值为 250 个事件。页面大小永远不能大于 2500 个事件order_by (str | None) – 可选。可接受的值为
"startTime"
或 “updated”private_extended_property (str | None) – 可选。以
propertyName=value
格式指定的扩展属性约束。仅匹配私有属性。此参数可以重复多次,以返回匹配所有给定约束的事件。q (str | None) – 可选。自由文本搜索。
shared_extended_property (str | None) – 可选。以
propertyName=value
格式指定的扩展属性约束。仅匹配共享属性。此参数可以重复多次,以返回匹配所有给定约束的事件。show_deleted (bool | None) – 可选。默认为 False
show_hidden_invitation (bool | None) – 可选。默认为 False
single_events (bool | None) – 可选。默认为 False
sync_token (str | None) – 可选。从返回的
nextSyncToken
字段中获得的令牌time_max (datetime.datetime | None) – 可选。过滤事件开始时间的上限(不含)。默认为不进行过滤
time_min (datetime.datetime | None) – 可选。过滤事件结束时间的下限(不含)。默认为不进行过滤
time_zone (str | None) – 可选。响应中使用的时区。默认为日历的时区。
updated_min (datetime.datetime | None) – 可选。事件上次修改时间的下限
- create_event(event, calendar_id='primary', conference_data_version=0, max_attendees=None, send_notifications=False, send_updates='false', supports_attachments=False)[source]¶
在指定的日历上创建事件。
https://developers.google.com/calendar/api/v3/reference/events/insert.
- 参数:
calendar_id (str) – 要交互的 Google 日历 ID
conference_data_version (int | None) – 可选。API 客户端支持的会议数据版本号。
max_attendees (int | None) – 可选。如果参会人数量超过指定值,则仅返回参与者本人。
send_notifications (bool | None) – 可选。默认为 False
send_updates (str | None) – 可选。默认为 “false”。可接受的值为 “all”、“none”、
"externalOnly"
https://developers.google.com/calendar/api/v3/reference/events#resource