blob: 42da3cb09dd1de4dcbb30a4840585ed87f29feb5 [file] [log] [blame]
:py:mod:`airflow.providers.google.cloud.hooks.vision`
=====================================================
.. py:module:: airflow.providers.google.cloud.hooks.vision
.. autoapi-nested-parse::
This module contains a Google Cloud Vision Hook.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.vision.NameDeterminer
airflow.providers.google.cloud.hooks.vision.CloudVisionHook
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.vision.ERR_DIFF_NAMES
airflow.providers.google.cloud.hooks.vision.ERR_UNABLE_TO_CREATE
.. py:data:: ERR_DIFF_NAMES
:annotation: = Multiline-String
.. raw:: html
<details><summary>Show Value</summary>
.. code-block:: text
:linenos:
The {label} name provided in the object ({explicit_name}) is different
than the name created from the input parameters ({constructed_name}). Please either:
1) Remove the {label} name,
2) Remove the location and {id_label} parameters,
3) Unify the {label} name and input parameters.
.. raw:: html
</details>
.. py:data:: ERR_UNABLE_TO_CREATE
:annotation: = Multiline-String
.. raw:: html
<details><summary>Show Value</summary>
.. code-block:: text
:linenos:
Unable to determine the {label} name. Please either set the name directly
in the {label} object or provide the `location` and `{id_label}` parameters.
.. raw:: html
</details>
.. py:class:: NameDeterminer(label, id_label, get_path)
Helper class to determine entity name.
.. py:method:: get_entity_with_name(self, entity, entity_id, location, project_id)
Check if entity has the `name` attribute set:
* If so, no action is taken.
* If not, and the name can be constructed from other parameters provided, it is created and filled in
the entity.
* If both the entity's 'name' attribute is set and the name can be constructed from other parameters
provided:
* If they are the same - no action is taken
* if they are different - an exception is thrown.
:param entity: Entity
:param entity_id: Entity id
:param location: Location
:param project_id: The id of Google Cloud Vision project.
:return: The same entity or entity with new name
:rtype: str
:raises: AirflowException
.. py:class:: CloudVisionHook(gcp_conn_id = 'google_cloud_default', delegate_to = None, impersonation_chain = None)
Bases: :py:obj:`airflow.providers.google.common.hooks.base_google.GoogleBaseHook`
Hook for Google Cloud Vision APIs.
All the methods in the hook where project_id is used must be called with
keyword arguments rather than positional.
.. py:attribute:: product_name_determiner
.. py:attribute:: product_set_name_determiner
.. py:method:: get_conn(self)
Retrieves connection to Cloud Vision.
:return: Google Cloud Vision client object.
:rtype: google.cloud.vision_v1.ProductSearchClient
.. py:method:: annotator_client(self)
Creates ImageAnnotatorClient.
:return: Google Image Annotator client object.
:rtype: google.cloud.vision_v1.ImageAnnotatorClient
.. py:method:: create_product_set(self, location, product_set, project_id = PROVIDE_PROJECT_ID, product_set_id = None, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionCreateProductSetOperator`
.. py:method:: get_product_set(self, location, product_set_id, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionGetProductSetOperator`
.. py:method:: update_product_set(self, product_set, project_id = PROVIDE_PROJECT_ID, location = None, product_set_id = None, update_mask = None, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionUpdateProductSetOperator`
.. py:method:: delete_product_set(self, location, product_set_id, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDeleteProductSetOperator`
.. py:method:: create_product(self, location, product, project_id = PROVIDE_PROJECT_ID, product_id = None, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionCreateProductOperator`
.. py:method:: get_product(self, location, product_id, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionGetProductOperator`
.. py:method:: update_product(self, product, project_id = PROVIDE_PROJECT_ID, location = None, product_id = None, update_mask = None, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionUpdateProductOperator`
.. py:method:: delete_product(self, location, product_id, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDeleteProductOperator`
.. py:method:: create_reference_image(self, location, product_id, reference_image, project_id, reference_image_id = None, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionCreateReferenceImageOperator`
.. py:method:: delete_reference_image(self, location, product_id, reference_image_id, project_id, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDeleteReferenceImageOperator`
.. py:method:: add_product_to_product_set(self, product_set_id, product_id, project_id, location = None, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionAddProductToProductSetOperator`
.. py:method:: remove_product_from_product_set(self, product_set_id, product_id, project_id, location = None, retry = DEFAULT, timeout = None, metadata = ())
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionRemoveProductFromProductSetOperator`
.. py:method:: annotate_image(self, request, retry = DEFAULT, timeout = None)
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionImageAnnotateOperator`
.. py:method:: batch_annotate_images(self, requests, retry = DEFAULT, timeout = None)
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionImageAnnotateOperator`
.. py:method:: text_detection(self, image, max_results = None, retry = DEFAULT, timeout = None, additional_properties = None)
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDetectTextOperator`
.. py:method:: document_text_detection(self, image, max_results = None, retry = DEFAULT, timeout = None, additional_properties = None)
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionTextDetectOperator`
.. py:method:: label_detection(self, image, max_results = None, retry = DEFAULT, timeout = None, additional_properties = None)
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDetectImageLabelsOperator`
.. py:method:: safe_search_detection(self, image, max_results = None, retry = DEFAULT, timeout = None, additional_properties = None)
For the documentation see:
:py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDetectImageSafeSearchOperator`