airflow.providers.google.cloud.operators.compute

This module contains Google Compute Engine operators.

Module Contents

Classes

ComputeEngineBaseOperator

Abstract base operator for Google Compute Engine operators to inherit from.

ComputeEngineInsertInstanceOperator

Creates an Instance in Google Compute Engine based on specified parameters.

ComputeEngineInsertInstanceFromTemplateOperator

Creates an Instance in Google Compute Engine based on specified parameters from existing Template.

ComputeEngineDeleteInstanceOperator

Deletes an Instance in Google Compute Engine.

ComputeEngineStartInstanceOperator

Starts an instance in Google Compute Engine.

ComputeEngineStopInstanceOperator

Stops an instance in Google Compute Engine.

ComputeEngineSetMachineTypeOperator

Changes the machine type for a stopped instance to the machine type specified in the request.

ComputeEngineInsertInstanceTemplateOperator

Creates an Instance Template using specified fields.

ComputeEngineDeleteInstanceTemplateOperator

Deletes an Instance Template in Google Compute Engine.

ComputeEngineCopyInstanceTemplateOperator

Copies the instance template, applying specified changes.

ComputeEngineInstanceGroupUpdateManagerTemplateOperator

Patches the Instance Group Manager, replacing source template URL with the destination one.

ComputeEngineInsertInstanceGroupManagerOperator

Creates an Instance Group Managers using the body specified.

ComputeEngineDeleteInstanceGroupManagerOperator

Permanently and irrevocably deletes an Instance Group Managers.

Attributes

SET_MACHINE_TYPE_VALIDATION_SPECIFICATION

GCE_INSTANCE_TEMPLATE_VALIDATION_PATCH_SPECIFICATION

GCE_INSTANCE_FIELDS_TO_SANITIZE

class airflow.providers.google.cloud.operators.compute.ComputeEngineBaseOperator(*, zone, resource_id, project_id=None, gcp_conn_id='google_cloud_default', api_version='v1', impersonation_chain=None, **kwargs)[source]

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

Abstract base operator for Google Compute Engine operators to inherit from.

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.compute.ComputeEngineInsertInstanceOperator(*, body, zone, resource_id=None, project_id=None, request_id=None, retry=None, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', api_version='v1', validate_body=True, impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Creates an Instance in Google Compute Engine based on specified parameters.

See also

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

Parameters
  • body (dict) – Instance representation as an object. Should at least include ‘name’, ‘machine_type’, ‘disks’ and ‘network_interfaces’ fields but doesn’t include ‘zone’ field, as it will be specified in ‘zone’ parameter. Full or partial URL and can be represented as examples below: 1. “machine_type”: “projects/your-project-name/zones/your-zone/machineTypes/your-machine-type” 2. “disk_type”: “projects/your-project-name/zones/your-zone/diskTypes/your-disk-type” 3. “subnetwork”: “projects/your-project-name/regions/your-region/subnetworks/your-subnetwork”

  • zone (str) – Google Cloud zone where the Instance exists

  • project_id (str | None) – Google Cloud project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • resource_id (str | None) – Name of the Instance. If the name of Instance is not specified in body[‘name’], the name will be taken from ‘resource_id’ parameter

  • request_id (str | None) – Unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new instance template again) It should be in UUID format as defined in RFC 4122

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | Sequence[str] | None) – 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).

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

  • timeout (float | None) – 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 (Sequence[tuple[str, str]]) – Additional metadata that is provided to the method.

template_fields: Sequence[str] = ('body', 'project_id', 'zone', 'request_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[source]
check_body_fields()[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.compute.ComputeEngineInsertInstanceFromTemplateOperator(*, source_instance_template, body, zone, resource_id=None, project_id=None, request_id=None, retry=None, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', api_version='v1', validate_body=True, impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Creates an Instance in Google Compute Engine based on specified parameters from existing Template.

See also

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

Parameters
  • body (dict) – Instance representation as object. For this Operator only ‘name’ parameter is required for creating new Instance since all other parameters will be passed through the Template.

  • source_instance_template (str) – Existing Instance Template that will be used as a base while creating new Instance. When specified, only name of new Instance should be provided as input arguments in ‘body’ parameter when creating new Instance. All other parameters, such as ‘machine_type’, ‘disks’ and ‘network_interfaces’ will be passed to Instance as they are specified in the Instance Template. Full or partial URL and can be represented as examples below: 1. “https://www.googleapis.com/compute/v1/projects/your-project-name/global/instanceTemplates/temp” 2. “projects/your-project-name/global/instanceTemplates/temp” 3. “global/instanceTemplates/temp”

  • zone (str) – Google Cloud zone where the instance exists.

  • project_id (str | None) – Google Cloud project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • resource_id (str | None) – Name of the Instance. If the name of Instance is not specified in body[‘name’], the name will be taken from ‘resource_id’ parameter

  • request_id (str | None) – Unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new instance template again) It should be in UUID format as defined in RFC 4122

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | Sequence[str] | None) – 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).

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

  • timeout (float | None) – 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 (Sequence[tuple[str, str]]) – Additional metadata that is provided to the method.

template_fields: Sequence[str] = ('body', 'source_instance_template', 'project_id', 'zone', 'request_id', 'gcp_conn_id',...[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.compute.ComputeEngineDeleteInstanceOperator(*, resource_id, zone, request_id=None, project_id=None, retry=None, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', api_version='v1', validate_body=True, impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Deletes an Instance in Google Compute Engine.

See also

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

Parameters
  • project_id (str | None) – Google Cloud project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • zone (str) – Google Cloud zone where the instance exists.

  • resource_id (str) – Name of the Instance.

  • request_id (str | None) – Unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new instance template again) It should be in UUID format as defined in RFC 4122

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | Sequence[str] | None) – 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).

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

  • timeout (float | None) – 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 (Sequence[tuple[str, str]]) – Additional metadata that is provided to the method.

template_fields: Sequence[str] = ('zone', 'resource_id', 'request_id', 'project_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[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.compute.ComputeEngineStartInstanceOperator(*, zone, resource_id, project_id=None, gcp_conn_id='google_cloud_default', api_version='v1', impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Starts an instance in Google Compute Engine.

See also

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

Parameters
  • zone (str) – Google Cloud zone where the instance exists.

  • resource_id (str) – Name of the Compute Engine instance resource.

  • project_id (str | None) – Optional, Google Cloud Project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • gcp_conn_id (str) – Optional, The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – Optional, API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | 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: Sequence[str] = ('project_id', 'zone', 'resource_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[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.compute.ComputeEngineStopInstanceOperator(*, zone, resource_id, project_id=None, gcp_conn_id='google_cloud_default', api_version='v1', impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Stops an instance in Google Compute Engine.

See also

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

Parameters
  • zone (str) – Google Cloud zone where the instance exists.

  • resource_id (str) – Name of the Compute Engine instance resource.

  • project_id (str | None) – Optional, Google Cloud Project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • gcp_conn_id (str) – Optional, The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – Optional, API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | 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: Sequence[str] = ('project_id', 'zone', 'resource_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[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.

airflow.providers.google.cloud.operators.compute.SET_MACHINE_TYPE_VALIDATION_SPECIFICATION[source]
class airflow.providers.google.cloud.operators.compute.ComputeEngineSetMachineTypeOperator(*, zone, resource_id, body, project_id=None, gcp_conn_id='google_cloud_default', api_version='v1', validate_body=True, impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Changes the machine type for a stopped instance to the machine type specified in the request.

See also

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

Parameters
  • zone (str) – Google Cloud zone where the instance exists.

  • resource_id (str) – Name of the Compute Engine instance resource.

  • body (dict) – Body required by the Compute Engine setMachineType API, as described in https://cloud.google.com/compute/docs/reference/rest/v1/instances/setMachineType#request-body

  • project_id (str | None) – Optional, Google Cloud Project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • gcp_conn_id (str) – Optional, The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – Optional, API version used (for example v1 - or beta). Defaults to v1.

  • validate_body (bool) – Optional, If set to False, body validation is not performed. Defaults to False.

  • impersonation_chain (str | 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: Sequence[str] = ('project_id', 'zone', 'resource_id', 'body', 'gcp_conn_id', 'api_version', 'impersonation_chain')[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.

airflow.providers.google.cloud.operators.compute.GCE_INSTANCE_TEMPLATE_VALIDATION_PATCH_SPECIFICATION: list[dict[str, Any]][source]
airflow.providers.google.cloud.operators.compute.GCE_INSTANCE_FIELDS_TO_SANITIZE = ['kind', 'id', 'creationTimestamp', 'properties.disks.sha256', 'properties.disks.kind',...[source]
class airflow.providers.google.cloud.operators.compute.ComputeEngineInsertInstanceTemplateOperator(*, body, project_id=None, resource_id=None, request_id=None, retry=None, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', api_version='v1', validate_body=True, impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Creates an Instance Template using specified fields.

See also

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

Parameters
  • body (dict) – Instance template representation as object.

  • project_id (str | None) – Google Cloud project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • request_id (str | None) – Unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new instance template again) It should be in UUID format as defined in RFC 4122

  • resource_id (str | None) – Name of the Instance Template. If the name of Instance Template is not specified in body[‘name’], the name will be taken from ‘resource_id’ parameter

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | Sequence[str] | None) – 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).

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

  • timeout (float | None) – 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 (Sequence[tuple[str, str]]) – Additional metadata that is provided to the method.

template_fields: Sequence[str] = ('body', 'project_id', 'request_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[source]
check_body_fields()[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.compute.ComputeEngineDeleteInstanceTemplateOperator(*, resource_id, request_id=None, project_id=None, retry=None, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', api_version='v1', validate_body=True, impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Deletes an Instance Template in Google Compute Engine.

See also

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

Parameters
  • resource_id (str) – Name of the Instance Template.

  • project_id (str | None) – Google Cloud project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • request_id (str | None) – Unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new instance template again) It should be in UUID format as defined in RFC 4122

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | Sequence[str] | None) – 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).

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

  • timeout (float | None) – 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 (Sequence[tuple[str, str]]) – Additional metadata that is provided to the method.

template_fields: Sequence[str] = ('resource_id', 'request_id', 'project_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[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.compute.ComputeEngineCopyInstanceTemplateOperator(*, resource_id, body_patch, project_id=None, request_id=None, gcp_conn_id='google_cloud_default', api_version='v1', validate_body=True, impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Copies the instance template, applying specified changes.

See also

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

Parameters
  • resource_id (str) – Name of the Instance Template

  • body_patch (dict) – Patch to the body of instanceTemplates object following rfc7386 PATCH semantics. The body_patch content follows https://cloud.google.com/compute/docs/reference/rest/v1/instanceTemplates Name field is required as we need to rename the template, all the other fields are optional. It is important to follow PATCH semantics - arrays are replaced fully, so if you need to update an array you should provide the whole target array as patch element.

  • project_id (str | None) – Optional, Google Cloud Project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • request_id (str | None) – Optional, unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new instance template again). It should be in UUID format as defined in RFC 4122.

  • gcp_conn_id (str) – Optional, The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version (str) – Optional, API version used (for example v1 - or beta). Defaults to v1.

  • validate_body (bool) – Optional, If set to False, body validation is not performed. Defaults to False.

  • impersonation_chain (str | 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: Sequence[str] = ('project_id', 'resource_id', 'request_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[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.compute.ComputeEngineInstanceGroupUpdateManagerTemplateOperator(*, resource_id, zone, source_template, destination_template, project_id=None, update_policy=None, request_id=None, gcp_conn_id='google_cloud_default', api_version='beta', impersonation_chain=None, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Patches the Instance Group Manager, replacing source template URL with the destination one.

API V1 does not have update/patch operations for Instance Group Manager, so you must use beta or newer API version. Beta is the default.

See also

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

Parameters
  • resource_id (str) – Name of the Instance Group Manager

  • zone (str) – Google Cloud zone where the Instance Group Manager exists.

  • source_template (str) – URL of the template to replace.

  • destination_template (str) – URL of the target template.

  • project_id (str | None) – Optional, Google Cloud Project ID where the Compute Engine Instance exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • request_id (str | None) – Optional, unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new instance template again). It should be in UUID format as defined in RFC 4122.

  • gcp_conn_id (str) – Optional, The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version – Optional, API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | 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: Sequence[str] = ('project_id', 'resource_id', 'zone', 'request_id', 'source_template', 'destination_template',...[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.compute.ComputeEngineInsertInstanceGroupManagerOperator(*, body, zone, project_id=None, resource_id=None, request_id=None, gcp_conn_id='google_cloud_default', api_version='v1', retry=None, timeout=None, metadata=(), impersonation_chain=None, validate_body=True, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Creates an Instance Group Managers using the body specified.

After the group is created, instances in the group are created using the specified Instance Template.

See also

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

Parameters
  • body (dict) – Instance Group Managers representation as object.

  • project_id (str | None) – Google Cloud project ID where the Compute Engine Instance Group Managers exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • request_id (str | None) – Unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new Instance Group Managers again) It should be in UUID format as defined in RFC 4122

  • resource_id (str | None) – Name of the Instance Group Managers. If the name of Instance Group Managers is not specified in body[‘name’], the name will be taken from ‘resource_id’ parameter.

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version – API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | Sequence[str] | None) – 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).

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

  • timeout (float | None) – 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 (Sequence[tuple[str, str]]) – Additional metadata that is provided to the method.

template_fields: Sequence[str] = ('project_id', 'body', 'zone', 'request_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[source]
check_body_fields()[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.compute.ComputeEngineDeleteInstanceGroupManagerOperator(*, resource_id, zone, project_id=None, request_id=None, gcp_conn_id='google_cloud_default', api_version='v1', retry=None, timeout=None, metadata=(), impersonation_chain=None, validate_body=True, **kwargs)[source]

Bases: ComputeEngineBaseOperator

Permanently and irrevocably deletes an Instance Group Managers.

See also

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

Parameters
  • resource_id (str) – Name of the Instance Group Managers.

  • project_id (str | None) – Google Cloud project ID where the Compute Engine Instance Group Managers exists. If set to None or missing, the default project_id from the Google Cloud connection is used.

  • request_id (str | None) – Unique request_id that you might add to achieve full idempotence (for example when client call times out repeating the request with the same request id will not create a new Instance Group Managers again) It should be in UUID format as defined in RFC 4122

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud. Defaults to ‘google_cloud_default’.

  • api_version – API version used (for example v1 - or beta). Defaults to v1.

  • impersonation_chain (str | Sequence[str] | None) – 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).

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

  • timeout (float | None) – 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 (Sequence[tuple[str, str]]) – Additional metadata that is provided to the method.

template_fields: Sequence[str] = ('project_id', 'resource_id', 'zone', 'request_id', 'gcp_conn_id', 'api_version', 'impersonation_chain')[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?