airflow.providers.google.cloud.operators.alloy_db

This module contains Google Cloud Alloy DB operators.

Module Contents

Classes

AlloyDBBaseOperator

Base class for all AlloyDB operators.

AlloyDBWriteBaseOperator

Base class for writing AlloyDB operators.

AlloyDBCreateClusterOperator

Create an Alloy DB cluster.

AlloyDBUpdateClusterOperator

Update an Alloy DB cluster.

AlloyDBDeleteClusterOperator

Delete an Alloy DB cluster.

class airflow.providers.google.cloud.operators.alloy_db.AlloyDBBaseOperator(project_id, location, gcp_conn_id='google_cloud_default', retry=DEFAULT, timeout=None, metadata=(), impersonation_chain=None, *args, **kwargs)[source]

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

Base class for all AlloyDB operators.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project where the service is used.

  • location (str) – Required. The ID of the Google Cloud region where the service is used.

  • gcp_conn_id (str) – Optional. The connection ID to use to connect to Google Cloud.

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional. A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (float | None) – Optional. The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (collections.abc.Sequence[tuple[str, str]]) – Optional. Additional metadata that is provided to the method.

  • 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', 'location', 'gcp_conn_id')[source]
hook()[source]
class airflow.providers.google.cloud.operators.alloy_db.AlloyDBWriteBaseOperator(request_id=None, validate_request=False, *args, **kwargs)[source]

Bases: AlloyDBBaseOperator

Base class for writing AlloyDB operators.

These operators perform create, update or delete operations. with the objects (not inside of database).

Parameters
  • request_id (str | None) – Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if the original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

  • validate_request (bool) – Optional. If set, performs request validation, but does not actually execute the request.

template_fields: collections.abc.Sequence[str][source]
get_operation_result(operation)[source]

Retrieve operation result as a proto.Message.

If the validate_request parameter is set, then no operation is performed and thus nothing to wait.

class airflow.providers.google.cloud.operators.alloy_db.AlloyDBCreateClusterOperator(cluster_id, cluster_configuration, is_secondary=False, *args, **kwargs)[source]

Bases: AlloyDBWriteBaseOperator

Create an Alloy DB cluster.

See also

For more information on how to use this operator, take a look at the guide: Create cluster

Parameters
  • cluster_id (str) – Required. ID of the cluster to create.

  • cluster_configuration (google.cloud.alloydb_v1.Cluster | dict) – Required. Cluster to create. For more details please see API documentation: https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Cluster

  • is_secondary (bool) – Required. Specifies if the Cluster to be created is Primary or Secondary. Please note, if set True, then specify the secondary_config field in the cluster so the created secondary cluster was pointing to the primary cluster.

  • request_id – Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if the original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

  • validate_request – Optional. If set, performs request validation, but does not actually execute the request.

  • project_id – Required. The ID of the Google Cloud project where the service is used.

  • location – Required. The ID of the Google Cloud region where the service is used.

  • gcp_conn_id – Optional. The connection ID to use to connect to Google Cloud.

  • retry – Optional. A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout – Optional. The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata – Optional. Additional metadata that is provided to the method.

  • impersonation_chain – 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][source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.alloy_db.AlloyDBUpdateClusterOperator(cluster_id, cluster_configuration, update_mask=None, allow_missing=False, *args, **kwargs)[source]

Bases: AlloyDBWriteBaseOperator

Update an Alloy DB cluster.

See also

For more information on how to use this operator, take a look at the guide: Update cluster

Parameters
  • cluster_id (str) – Required. ID of the cluster to create.

  • cluster_configuration (google.cloud.alloydb_v1.Cluster | dict) – Required. Cluster to update. For more details please see API documentation: https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Cluster

  • update_mask (google.protobuf.field_mask_pb2.FieldMask | dict | None) – Optional. Field mask is used to specify the fields to be overwritten in the Cluster resource by the update.

  • request_id – Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if the original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

  • validate_request – Optional. If set, performs request validation, but does not actually execute the request.

  • allow_missing (bool) – Optional. If set to true, update succeeds even if cluster is not found. In that case, a new cluster is created and update_mask is ignored.

  • project_id – Required. The ID of the Google Cloud project where the service is used.

  • location – Required. The ID of the Google Cloud region where the service is used.

  • gcp_conn_id – Optional. The connection ID to use to connect to Google Cloud.

  • retry – Optional. A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout – Optional. The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata – Optional. Additional metadata that is provided to the method.

  • impersonation_chain – 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][source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.alloy_db.AlloyDBDeleteClusterOperator(cluster_id, etag=None, force=False, *args, **kwargs)[source]

Bases: AlloyDBWriteBaseOperator

Delete an Alloy DB cluster.

See also

For more information on how to use this operator, take a look at the guide: Delete cluster

Parameters
  • cluster_id (str) – Required. ID of the cluster to create.

  • request_id – Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server ignores the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if the original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

  • validate_request – Optional. If set, performs request validation, but does not actually execute the request.

  • etag (str | None) – Optional. The current etag of the Cluster. If an etag is provided and does not match the current etag of the Cluster, deletion will be blocked and an ABORTED error will be returned.

  • force (bool) – Optional. Whether to cascade delete child instances for given cluster.

  • project_id – Required. The ID of the Google Cloud project where the service is used.

  • location – Required. The ID of the Google Cloud region where the service is used.

  • gcp_conn_id – Optional. The connection ID to use to connect to Google Cloud.

  • retry – Optional. A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout – Optional. The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata – Optional. Additional metadata that is provided to the method.

  • impersonation_chain – 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][source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?