airflow.providers.google.cloud.hooks.cloud_composer

Module Contents

Classes

CloudComposerHook

Hook for Google Cloud Composer APIs.

CloudComposerAsyncHook

Hook for Google Cloud Composer async APIs.

class airflow.providers.google.cloud.hooks.cloud_composer.CloudComposerHook(**kwargs)[source]

Bases: airflow.providers.google.common.hooks.base_google.GoogleBaseHook

Hook for Google Cloud Composer APIs.

client_options[source]
get_environment_client()[source]

Retrieves client library object that allow access Environments service.

get_image_versions_client()[source]

Retrieves client library object that allow access Image Versions service.

wait_for_operation(operation, timeout=None)[source]

Waits for long-lasting operation to complete.

get_operation(operation_name)[source]
get_environment_name(project_id, region, environment_id)[source]
get_parent(project_id, region)[source]
create_environment(project_id, region, environment, retry=DEFAULT, timeout=None, metadata=())[source]

Create a new environment.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) – The environment to create. This corresponds to the environment field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

delete_environment(project_id, region, environment_id, retry=DEFAULT, timeout=None, metadata=())[source]

Delete an environment.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment_id (str) – Required. The ID of the Google Cloud environment that the service belongs to.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

get_environment(project_id, region, environment_id, retry=DEFAULT, timeout=None, metadata=())[source]

Get an existing environment.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment_id (str) – Required. The ID of the Google Cloud environment that the service belongs to.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

list_environments(project_id, region, page_size=None, page_token=None, retry=DEFAULT, timeout=None, metadata=())[source]

List environments.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • page_size (int | None) – The maximum number of environments to return.

  • page_token (str | None) – The next_page_token value returned from a previous List request, if any.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

update_environment(project_id, region, environment_id, environment, update_mask, retry=DEFAULT, timeout=None, metadata=())[source]

Update an environment.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment_id (str) – Required. The ID of the Google Cloud environment that the service belongs to.

  • environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) –

    A patch environment. Fields specified by the updateMask will be copied from the patch environment into the environment under update.

    This corresponds to the environment field on the request instance; if request is provided, this should not be set.

  • update_mask (dict | google.protobuf.field_mask_pb2.FieldMask) – Required. A comma-separated list of paths, relative to Environment, of fields to update. If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

list_image_versions(project_id, region, page_size=None, page_token=None, include_past_releases=False, retry=DEFAULT, timeout=None, metadata=())[source]

List ImageVersions for provided location.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • page_size (int | None) – The maximum number of environments to return.

  • page_token (str | None) – The next_page_token value returned from a previous List request, if any.

  • include_past_releases (bool) – Flag to include past releases

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

class airflow.providers.google.cloud.hooks.cloud_composer.CloudComposerAsyncHook(**kwargs)[source]

Bases: airflow.providers.google.common.hooks.base_google.GoogleBaseHook

Hook for Google Cloud Composer async APIs.

client_options[source]
get_environment_client()[source]

Retrieves client library object that allow access Environments service.

get_environment_name(project_id, region, environment_id)[source]
get_parent(project_id, region)[source]
async get_operation(operation_name)[source]
async create_environment(project_id, region, environment, retry=DEFAULT, timeout=None, metadata=())[source]

Create a new environment.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) – The environment to create. This corresponds to the environment field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_environment(project_id, region, environment_id, retry=DEFAULT, timeout=None, metadata=())[source]

Delete an environment.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment_id (str) – Required. The ID of the Google Cloud environment that the service belongs to.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async update_environment(project_id, region, environment_id, environment, update_mask, retry=DEFAULT, timeout=None, metadata=())[source]

Update an environment.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • environment_id (str) – Required. The ID of the Google Cloud environment that the service belongs to.

  • environment (google.cloud.orchestration.airflow.service_v1.types.Environment | dict) –

    A patch environment. Fields specified by the updateMask will be copied from the patch environment into the environment under update.

    This corresponds to the environment field on the request instance; if request is provided, this should not be set.

  • update_mask (dict | google.protobuf.field_mask_pb2.FieldMask) – Required. A comma-separated list of paths, relative to Environment, of fields to update. If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.

  • timeout (float | None) – The timeout for this request.

  • metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Was this entry helpful?