airflow.providers.google.cloud.operators.vision
¶
This module contains a Google Cloud Vision operator.
Module Contents¶
Classes¶
Create a new ProductSet resource. |
|
Get information associated with a ProductSet. |
|
Make changes to a ProductSet resource. |
|
Permanently deletes a |
|
Create and return a new product resource. |
|
Get information associated with a |
|
Make changes to a Product resource. |
|
Permanently delete a product and its reference images. |
|
Run image detection and annotation for an image or a batch of images. |
|
Create and return a new ReferenceImage ID resource. |
|
Delete a ReferenceImage ID resource. |
|
Add a Product to the specified ProductSet. |
|
Remove a Product from the specified ProductSet. |
|
Detect Text in the image. |
|
Detect Document Text in the image. |
|
Detect Document Text in the image. |
|
Detect Document Text in the image. |
Functions¶
|
Create a value for the |
Attributes¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionCreateProductSetOperator(*, product_set, location, project_id=PROVIDE_PROJECT_ID, product_set_id=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Create a new ProductSet resource.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionProductSetCreateOperator
- Parameters
product_set (dict | google.cloud.vision_v1.ProductSet) – (Required) The ProductSet to create. If a dict is provided, it must be of the same form as the protobuf message ProductSet.
location (str) – (Required) The region where the ProductSet should be created. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
project_id (str) – (Optional) The project in which the ProductSet should be created. If set to None or missing, the default project_id from the Google Cloud connection is used.
product_set_id (str | None) – (Optional) A user-supplied resource id for this ProductSet. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character /.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_set_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionGetProductSetOperator(*, location, product_set_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Get information associated with a ProductSet.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionGetProductSetOperator
- Parameters
location (str) – (Required) The region where the ProductSet is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
product_set_id (str) – (Required) The resource id of this ProductSet.
project_id (str) – (Optional) The project in which the ProductSet is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_set_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionUpdateProductSetOperator(*, product_set, location=None, product_set_id=None, project_id=PROVIDE_PROJECT_ID, update_mask=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Make changes to a ProductSet resource.
Only
display_name
can be updated currently.Note
To locate the
ProductSet
resource, itsname
in the form projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID is necessary.You can provide the
name` directly as an attribute of the ``product_set
object. You can also leave it blank, in which casename
will be created by the operator fromlocation
andproduct_set_id
instead (and optionallyproject_id
; if not present, the connection default will be used).This mechanism exists for your convenience, to allow leaving the
project_id
empty and having Airflow use the connection default.See also
For more information on how to use this operator, take a look at the guide: CloudVisionUpdateProductSetOperator
- Parameters
product_set (dict | google.cloud.vision_v1.ProductSet) – (Required) The ProductSet resource which replaces the one on the server. If a dict is provided, it must be of the same form as the protobuf message ProductSet.
location (str | None) – (Optional) The region where the ProductSet is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
product_set_id (str | None) – (Optional) The resource id of this ProductSet.
project_id (str) – (Optional) The project in which the ProductSet should be created. If set to None or missing, the default project_id from the Google Cloud connection is used.
update_mask (dict | google.protobuf.field_mask_pb2.FieldMask | None) – (Optional) The FieldMask that specifies which fields to update. If update_mask isn’t specified, all mutable fields are to be updated. Valid mask path is display_name. 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) – (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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_set_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionDeleteProductSetOperator(*, location, product_set_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Permanently deletes a
ProductSet
.Products
andReferenceImages
in theProductSet
are not deleted. The actual image files are not deleted from Google Cloud Storage.See also
For more information on how to use this operator, take a look at the guide: CloudVisionDeleteProductSetOperator
- Parameters
location (str) – (Required) The region where the ProductSet is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
product_set_id (str) – (Required) The resource id of this ProductSet.
project_id (str) – (Optional) The project in which the ProductSet should be created. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_set_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionCreateProductOperator(*, location, product, project_id=PROVIDE_PROJECT_ID, product_id=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Create and return a new product resource.
Possible errors regarding the
Product
object provided:Returns
INVALID_ARGUMENT
ifdisplay_name
is missing or longer than 4096 characters.Returns
INVALID_ARGUMENT
ifdescription
is longer than 4096 characters.Returns
INVALID_ARGUMENT
ifproduct_category
is missing or invalid.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionCreateProductOperator
- Parameters
location (str) – (Required) The region where the Product should be created. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
product (str) – (Required) The product to create. If a dict is provided, it must be of the same form as the protobuf message Product.
project_id (str) – (Optional) The project in which the Product should be created. If set to None or missing, the default project_id from the Google Cloud connection is used.
product_id (str | None) – (Optional) A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character /.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionGetProductOperator(*, location, product_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Get information associated with a
Product
.Possible errors:
Returns NOT_FOUND if the Product does not exist.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionGetProductOperator
- Parameters
location (str) – (Required) The region where the Product is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
product_id (str) – (Required) The resource id of this Product.
project_id (str) – (Optional) The project in which the Product is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionUpdateProductOperator(*, product, location=None, product_id=None, project_id=PROVIDE_PROJECT_ID, update_mask=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Make changes to a Product resource.
Only the display_name, description, and labels fields can be updated right now.
If labels are updated, the change will not be reflected in queries until the next index time.
Note
To locate the Product resource, its name in the form projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID is necessary.
You can provide the name directly as an attribute of the product object. However, you can leave it blank and provide location and product_id instead (and optionally project_id - if not present, the connection default will be used) and the name will be created by the operator itself.
This mechanism exists for your convenience, to allow leaving the project_id empty and having Airflow use the connection default project_id.
Possible errors related to the provided Product:
Returns NOT_FOUND if the Product does not exist.
- Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request
or longer than 4096 characters.
- Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096
characters.
Returns INVALID_ARGUMENT if product_category is present in update_mask.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionUpdateProductOperator
- Parameters
product (dict | google.cloud.vision_v1.Product) – (Required) The Product resource which replaces the one on the server. product.name is immutable. If a dict is provided, it must be of the same form as the protobuf message Product.
location (str | None) – (Optional) The region where the Product is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
product_id (str | None) – (Optional) The resource id of this Product.
project_id (str) – (Optional) The project in which the Product is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
update_mask (dict | google.protobuf.field_mask_pb2.FieldMask | None) – (Optional) The FieldMask that specifies which fields to update. If update_mask isn’t specified, all mutable fields are to be updated. Valid mask paths include product_labels, display_name, and description. 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) – (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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionDeleteProductOperator(*, location, product_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Permanently delete a product and its reference images.
Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.
Possible errors:
Returns NOT_FOUND if the product does not exist.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionDeleteProductOperator
- Parameters
location (str) – (Required) The region where the Product is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
product_id (str) – (Required) The resource id of this Product.
project_id (str) – (Optional) The project in which the Product is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'project_id', 'product_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionImageAnnotateOperator(*, request, retry=DEFAULT, timeout=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Run image detection and annotation for an image or a batch of images.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionImageAnnotateOperator
- Parameters
request (dict | google.cloud.vision_v1.AnnotateImageRequest) – (Required) Annotation request for image or a batch. If a dict is provided, it must be of the same form as the protobuf message class:google.cloud.vision_v1.types.AnnotateImageRequest
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.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('request', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionCreateReferenceImageOperator(*, location, reference_image, product_id, reference_image_id=None, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Create and return a new ReferenceImage ID resource.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionCreateReferenceImageOperator
- Parameters
location (str) – (Required) The region where the Product is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
reference_image (dict | google.cloud.vision_v1.ReferenceImage) – (Required) The reference image to create. If an image ID is specified, it is ignored. If a dict is provided, it must be of the same form as the protobuf message
google.cloud.vision_v1.types.ReferenceImage
reference_image_id (str | None) – (Optional) A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character /.
product_id (str) – (Optional) The resource id of this Product.
project_id (str) – (Optional) The project in which the Product is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'reference_image', 'product_id', 'reference_image_id', 'project_id', 'gcp_conn_id',...[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionDeleteReferenceImageOperator(*, location, product_id, reference_image_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Delete a ReferenceImage ID resource.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionDeleteReferenceImageOperator
- Parameters
location (str) – (Required) The region where the Product is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
reference_image_id (str) – (Optional) A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character /.
product_id (str) – (Optional) The resource id of this Product.
project_id (str) – (Optional) The project in which the Product is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'product_id', 'reference_image_id', 'project_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionAddProductToProductSetOperator(*, product_set_id, product_id, location, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Add a Product to the specified ProductSet.
If the Product is already present, no change is made. One Product can be added to at most 100 ProductSets.
Possible errors:
Returns NOT_FOUND if the Product or the ProductSet doesn’t exist.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionAddProductToProductSetOperator
- Parameters
product_set_id (str) – (Required) The resource id for the ProductSet to modify.
product_id (str) – (Required) The resource id of this Product.
location (str) – (Required) The region where the ProductSet is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
project_id (str) – (Optional) The project in which the Product is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'product_set_id', 'product_id', 'project_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionRemoveProductFromProductSetOperator(*, product_set_id, product_id, location, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Remove a Product from the specified ProductSet.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionRemoveProductFromProductSetOperator
- Parameters
product_set_id (str) – (Required) The resource id for the ProductSet to modify.
product_id (str) – (Required) The resource id of this Product.
location (str) – (Required) The region where the ProductSet is located. Valid regions (as of 2019-02-05) are: us-east1, us-west1, europe-west1, asia-east1
project_id (str) – (Optional) The project in which the Product is located. If set to None or missing, the default project_id from the Google Cloud connection is used.
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 (MetaData) – (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('location', 'product_set_id', 'product_id', 'project_id', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionDetectTextOperator(image, max_results=None, retry=DEFAULT, timeout=None, language_hints=None, web_detection_params=None, additional_properties=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Detect Text in the image.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionDetectTextOperator
- Parameters
image (dict | google.cloud.vision_v1.Image) – (Required) The image to analyze. See more: https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.Image
max_results (int | None) – (Optional) Number of results to return.
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) – Number of seconds before timing out.
language_hints (str | list[str] | None) – List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting language_hints is not needed.
web_detection_params (dict | None) – Parameters for web detection.
additional_properties (dict | None) – Additional properties to be set on the AnnotateImageRequest. See more:
google.cloud.vision_v1.types.AnnotateImageRequest
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('image', 'max_results', 'timeout', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionTextDetectOperator(image, max_results=None, retry=DEFAULT, timeout=None, language_hints=None, web_detection_params=None, additional_properties=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Detect Document Text in the image.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionTextDetectOperator
- Parameters
image (dict | google.cloud.vision_v1.Image) – (Required) The image to analyze. See more: https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.Image
max_results (int | None) – Number of results to return.
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) – Number of seconds before timing out.
language_hints (str | list[str] | None) – List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting language_hints is not needed.
web_detection_params (dict | None) – Parameters for web detection.
additional_properties (dict | None) – Additional properties to be set on the AnnotateImageRequest. See more: https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.AnnotateImageRequest
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('image', 'max_results', 'timeout', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionDetectImageLabelsOperator(image, max_results=None, retry=DEFAULT, timeout=None, additional_properties=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Detect Document Text in the image.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionDetectImageLabelsOperator
- Parameters
image (dict | google.cloud.vision_v1.Image) – (Required) The image to analyze. See more: https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.Image
max_results (int | None) – Number of results to return.
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) – Number of seconds before timing out.
additional_properties (dict | None) – Additional properties to be set on the AnnotateImageRequest. See more: https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.AnnotateImageRequest
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('image', 'max_results', 'timeout', 'gcp_conn_id', 'impersonation_chain')[source]¶
- class airflow.providers.google.cloud.operators.vision.CloudVisionDetectImageSafeSearchOperator(image, max_results=None, retry=DEFAULT, timeout=None, additional_properties=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Detect Document Text in the image.
See also
For more information on how to use this operator, take a look at the guide: CloudVisionDetectImageSafeSearchOperator
- Parameters
image (dict | google.cloud.vision_v1.Image) – (Required) The image to analyze. See more: https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.Image
max_results (int | None) – Number of results to return.
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) – Number of seconds before timing out.
additional_properties (dict | None) – Additional properties to be set on the AnnotateImageRequest. See more: https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.AnnotateImageRequest
gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud.
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] = ('image', 'max_results', 'timeout', 'gcp_conn_id', 'impersonation_chain')[source]¶
- airflow.providers.google.cloud.operators.vision.prepare_additional_parameters(additional_properties, language_hints, web_detection_params)[source]¶
Create a value for the
additional_properties
parameter.The new value is based on
language_hints
,web_detection_params
, andadditional_properties
parameters specified by the user.