airflow.providers.google.cloud.operators.cloud_logging_sink

Classes

CloudLoggingCreateSinkOperator

Creates a Cloud Logging export sink in a GCP project.

CloudLoggingDeleteSinkOperator

Deletes a Cloud Logging export sink from a GCP project.

CloudLoggingUpdateSinkOperator

Updates an existing Cloud Logging export sink.

CloudLoggingListSinksOperator

Lists Cloud Logging export sinks in a Google Cloud project.

Module Contents

class airflow.providers.google.cloud.operators.cloud_logging_sink.CloudLoggingCreateSinkOperator(project_id, sink_config, unique_writer_identity=False, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Creates a Cloud Logging export sink in a GCP project.

This operator creates a sink that exports log entries from Cloud Logging to destinations like Cloud Storage, BigQuery, or Pub/Sub.

Parameters:
  • project_id (str) – Required. ID of the Google Cloud project where the sink will be created.

  • sink_config (dict | google.cloud.logging_v2.types.LogSink) – Required. The full sink configuration as a dictionary or a LogSink object. See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks

  • unique_writer_identity (bool) – If True, creates a unique service account for the sink. If False, uses the default Google-managed service account.

  • gcp_conn_id (str) – Optional. The connection ID used to connect to Google Cloud. Defaults to “google_cloud_default”.

  • impersonation_chain (str | collections.abc.Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: collections.abc.Sequence[str] = ('project_id', 'sink_config', 'gcp_conn_id', 'impersonation_chain', 'unique_writer_identity')[source]
project_id[source]
sink_config[source]
unique_writer_identity = False[source]
gcp_conn_id = 'google_cloud_default'[source]
impersonation_chain = None[source]
execute(context)[source]

Execute the operator.

class airflow.providers.google.cloud.operators.cloud_logging_sink.CloudLoggingDeleteSinkOperator(sink_name, project_id, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Deletes a Cloud Logging export sink from a GCP project.

Parameters:
  • sink_name (str) – Required. Name of the sink to delete.

  • project_id (str) – Required. The ID of the Google Cloud project.

  • gcp_conn_id (str) – Optional. The connection ID to use for connecting to Google Cloud. Defaults to “google_cloud_default”.

  • impersonation_chain (str | collections.abc.Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: collections.abc.Sequence[str] = ('sink_name', 'project_id', 'gcp_conn_id', 'impersonation_chain')[source]
sink_name[source]
project_id[source]
gcp_conn_id = 'google_cloud_default'[source]
impersonation_chain = None[source]
execute(context)[source]

Execute the operator.

class airflow.providers.google.cloud.operators.cloud_logging_sink.CloudLoggingUpdateSinkOperator(project_id, sink_name, sink_config, update_mask, unique_writer_identity=False, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Updates an existing Cloud Logging export sink.

Parameters:
  • project_id (str) – Required. The ID of the Google Cloud project that contains the sink.

  • sink_name (str) – Required. The name of the sink to update.

  • sink_config (dict | google.cloud.logging_v2.types.LogSink) – Required. The updated sink configuration. Can be a dictionary or a google.cloud.logging_v2.types.LogSink object. Refer to: https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks

  • update_mask (google.protobuf.field_mask_pb2.FieldMask | dict) – Required. A FieldMask or dictionary specifying which fields of the sink should be updated. For example, to update the destination and filter, use: {“paths”: [“destination”, “filter”]}.

  • unique_writer_identity (bool) – Optional. When set to True, a new unique service account will be created for the sink. Defaults to False.

  • gcp_conn_id (str) – Optional. The connection ID used to connect to Google Cloud. Defaults to “google_cloud_default”.

  • impersonation_chain (str | collections.abc.Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).

template_fields: collections.abc.Sequence[str] = ('sink_name', 'project_id', 'update_mask', 'sink_config', 'unique_writer_identity',...[source]
project_id[source]
sink_name[source]
sink_config[source]
update_mask[source]
unique_writer_identity = False[source]
gcp_conn_id = 'google_cloud_default'[source]
impersonation_chain = None[source]
execute(context)[source]

Execute the operator.

class airflow.providers.google.cloud.operators.cloud_logging_sink.CloudLoggingListSinksOperator(project_id, page_size=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Lists Cloud Logging export sinks in a Google Cloud project.

Parameters:
  • project_id (str) – Required. The ID of the Google Cloud project to list sinks from.

  • page_size (int | None) – Optional. The maximum number of sinks to return per page. Must be greater than 0. If None, the server will use a default value.

  • gcp_conn_id (str) – Optional. The connection ID used to connect to Google Cloud. Defaults to “google_cloud_default”.

  • impersonation_chain (str | collections.abc.Sequence[str] | None) –

    Optional. Service account or chained list of accounts to impersonate. If a string, the service account must grant the originating account the ‘Service Account Token Creator’ IAM role.

    If a sequence, each account in the chain must grant this role to the next. The first account must grant it to the originating account (templated).

template_fields: collections.abc.Sequence[str] = ('project_id', 'gcp_conn_id', 'impersonation_chain', 'page_size')[source]
project_id[source]
page_size = None[source]
gcp_conn_id = 'google_cloud_default'[source]
impersonation_chain = None[source]
execute(context)[source]

Execute the operator.

Was this entry helpful?