Esempio n. 1
0
    def delete_reference_image(
        self,
        location: str,
        product_id: str,
        reference_image_id: str,
        project_id: Optional[str] = None,
        retry: Optional[Retry] = None,
        timeout: Optional[float] = None,
        metadata: Optional[Sequence[Tuple[str, str]]] = None,
    ) -> Dict:
        """
        For the documentation see:
        :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionReferenceImageCreateOperator`
        """
        if not project_id:
            raise ValueError("Project ID should be set.")
        client = self.get_conn()
        self.log.info('Deleting ReferenceImage')
        name = ProductSearchClient.reference_image_path(
            project=project_id,
            location=location,
            product=product_id,
            reference_image=reference_image_id)
        response = client.delete_reference_image(
            name=name,  # pylint: disable=assignment-from-no-return
            retry=retry,
            timeout=timeout,
            metadata=metadata)

        self.log.info('ReferenceImage with the name [%s] deleted.', name)
        return MessageToDict(response)
Esempio n. 2
0
    def delete_reference_image(
        self,
        location,
        product_id,
        reference_image_id,
        project_id=None,
        retry=None,
        timeout=None,
        metadata=None,
    ):
        """
        For the documentation see:
        :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionReferenceImageCreateOperator`
        """
        client = self.get_conn()
        self.log.info('Deleting ReferenceImage')
        name = ProductSearchClient.reference_image_path(
            project=project_id,
            location=location,
            product=product_id,
            reference_image=reference_image_id)
        response = client.delete_reference_image(name=name,
                                                 retry=retry,
                                                 timeout=timeout,
                                                 metadata=metadata)
        self.log.info('ReferenceImage with the name [%s] deleted.', name)

        return MessageToDict(response)
Esempio n. 3
0
    def delete_reference_image(
        self,
        location: str,
        product_id: str,
        reference_image_id: str,
        project_id: str,
        retry: Optional[Retry] = None,
        timeout: Optional[float] = None,
        metadata: Optional[Sequence[Tuple[str, str]]] = None,
    ) -> dict:
        """
        For the documentation see:
        :py:class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDeleteReferenceImageOperator`
        """
        client = self.get_conn()
        self.log.info('Deleting ReferenceImage')
        name = ProductSearchClient.reference_image_path(
            project=project_id, location=location, product=product_id, reference_image=reference_image_id
        )
        # pylint: disable=assignment-from-no-return
        response = client.delete_reference_image(
            name=name,
            retry=retry,
            timeout=timeout,
            metadata=metadata,
        )

        self.log.info('ReferenceImage with the name [%s] deleted.', name)
        return MessageToDict(response)
    def delete_reference_image(
        self,
        location,
        product_id,
        reference_image_id,
        project_id=None,
        retry=None,
        timeout=None,
        metadata=None,
    ):
        """
        For the documentation see:
        :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionReferenceImageCreateOperator`
        """
        client = self.get_conn()
        self.log.info('Deleting ReferenceImage')
        name = ProductSearchClient.reference_image_path(
            project=project_id, location=location, product=product_id, reference_image=reference_image_id
        )
        response = client.delete_reference_image(name=name, retry=retry, timeout=timeout, metadata=metadata)
        self.log.info('ReferenceImage with the name [%s] deleted.', name)

        return MessageToDict(response)