airflow.providers.google.cloud.hooks.cloud_build¶
用於 Google Cloud Build 服務的 Hook。
屬性¶
類¶
用於 Google Cloud Build 服務的 Hook。 |
|
用於 Google Cloud Build 服務的非同步 Hook。 |
模組內容¶
- class airflow.providers.google.cloud.hooks.cloud_build.CloudBuildHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
基類:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook,airflow.providers.google.common.hooks.operation_helpers.OperationHelper用於 Google Cloud Build 服務的 Hook。
- 引數:
gcp_conn_id (str) – 獲取連線資訊時使用的連線 ID。
impersonation_chain (str | collections.abc.Sequence[str] | None) – 可選的服務賬號,用於使用短期憑據進行模擬,或者獲取列表中最後一個賬號的 access_token 所需的賬號鏈列表,該賬號將在請求中被模擬。如果設定為字串,該賬號必須授予發起賬號 Service Account Token Creator IAM 角色。如果設定為序列,列表中的身份必須授予其直接前一個身份 Service Account Token Creator IAM 角色,列表中第一個賬號將此角色授予發起賬號。
- get_conn(location='global')[source]¶
檢索與 Google Cloud Build 的連線。
- 引數:
location (str) – 專案的位置。
- 返回:
Google Cloud Build 客戶端物件。
- 返回型別:
google.cloud.devtools.cloudbuild_v1.CloudBuildClient
- cancel_build(id_, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
取消正在進行的構建。
- 引數:
id – 構建的 ID。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- create_build_without_waiting_for_result(build, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
使用指定的配置啟動構建,而不等待其完成。
- 引數:
build (dict | google.cloud.devtools.cloudbuild_v1.types.Build) – 要建立的構建資源。如果提供了 dict,其形式必須與 protobuf 訊息 google.cloud.devtools.cloudbuild_v1.types.Build 相同。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- create_build_trigger(trigger, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
建立一個新的 BuildTrigger。
- 引數:
trigger (dict | google.cloud.devtools.cloudbuild_v1.types.BuildTrigger) – 要建立的 BuildTrigger。如果提供了 dict,其形式必須與 protobuf 訊息 google.cloud.devtools.cloudbuild_v1.types.BuildTrigger 相同。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- delete_build_trigger(trigger_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
按專案 ID 和觸發器 ID 刪除 BuildTrigger。
- 引數:
trigger_id (str) – 要刪除的 BuildTrigger 的 ID。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- get_build(id_, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
返回有關之前請求的構建的資訊。
- 引數:
id – 構建的 ID。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- get_build_trigger(trigger_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
返回有關 BuildTrigger 的資訊。
- 引數:
trigger_id (str) – 要獲取的 BuildTrigger 的 ID。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- list_build_triggers(location='global', project_id=PROVIDE_PROJECT_ID, page_size=None, page_token=None, retry=DEFAULT, timeout=None, metadata=())[source]¶
列出現有的 BuildTriggers。
- 引數:
project_id (str) – 函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
location (str) – 專案的位置。
page_size (int | None) – 可選,在列表中返回的結果數量。
page_token (str | None) – 可選,用於跳到列表中特定位置的令牌。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
- list_builds(location='global', project_id=PROVIDE_PROJECT_ID, page_size=None, page_token=None, filter_=None, retry=DEFAULT, timeout=None, metadata=())[source]¶
列出之前請求的構建。
- 引數:
project_id (str) – 函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 Google Cloud 連線中的預設專案 ID。
location (str) – 專案的位置。
page_size (int | None) – 可選,在列表中返回的結果數量。
page_token (int | None) – 可選,用於跳到列表中特定位置的令牌。
filter – 可選,用於限制結果的原始過濾文字。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
- retry_build(id_, project_id=PROVIDE_PROJECT_ID, wait=True, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
使用原始構建請求建立新構建;結果可能與原構建相同,也可能不同。
- 引數:
id – 原始構建的構建 ID。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
wait (bool) – 可選,等待操作完成。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- run_build_trigger(trigger_id, source, project_id=PROVIDE_PROJECT_ID, wait=True, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
在特定的源修訂版本上執行 BuildTrigger。
- 引數:
trigger_id (str) – 觸發器的 ID。
source (dict | google.cloud.devtools.cloudbuild_v1.types.RepoSource) – 要針對此觸發器構建的源。如果提供了 dict,其形式必須與 protobuf 訊息 google.cloud.devtools.cloudbuild_v1.types.RepoSource 相同。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
wait (bool) – 可選,等待操作完成。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- update_build_trigger(trigger_id, trigger, project_id, retry=DEFAULT, timeout=None, metadata=(), location='global')[source]¶
按專案 ID 和觸發器 ID 更新 BuildTrigger。
- 引數:
trigger_id (str) – 觸發器的 ID。
trigger (dict | google.cloud.devtools.cloudbuild_v1.types.BuildTrigger) – 要建立的 BuildTrigger。如果提供了 dict,其形式必須與 protobuf 訊息 google.cloud.devtools.cloudbuild_v1.types.BuildTrigger 相同。
project_id (str) – 可選,函式所屬的 Google Cloud Project 專案 ID。如果設定為 None 或缺失,則使用 GCP 連線中的預設專案 ID。
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – 可選,用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – 可選,等待請求完成的時間量,單位為秒。請注意,如果指定了 retry,則超時應用於每次單獨嘗試。
metadata (collections.abc.Sequence[tuple[str, str]]) – 可選,提供給方法的附加元資料。
location (str) – 專案的位置。
- class airflow.providers.google.cloud.hooks.cloud_build.CloudBuildAsyncHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
基類:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook用於 Google Cloud Build 服務的非同步 Hook。