From 6d4e33eda7208b29215d61ad8e1db82af23e2400 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:32:44 -0800 Subject: [PATCH 01/11] changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- .kokoro/test-samples.sh | 8 ++++---- .kokoro/trampoline_v2.sh | 2 +- google/cloud/vision_v1p3beta1/__init__.py | 4 ++-- synth.metadata | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index ec890026..b6bc8297 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do python3.6 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? - # If this is a periodic build, send the test log to the FlakyBot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. + # If this is a periodic build, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot + chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop + $KOKORO_GFILE_DIR/linux_amd64/buildcop fi if [[ $EXIT -ne 0 ]]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4af6cdc2..719bcd5b 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then "KOKORO_GITHUB_COMMIT" "KOKORO_GITHUB_PULL_REQUEST_NUMBER" "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For FlakyBot + # For Build Cop Bot "KOKORO_GITHUB_COMMIT_URL" "KOKORO_GITHUB_PULL_REQUEST_URL" ) diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index b38431b4..c00754cf 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,6 +143,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -172,7 +173,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/synth.metadata b/synth.metadata index a706fe1a..9cb7a306 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-vision.git", - "sha": "62f5df93426f6d7fd796a470c2fa049f90dd56ed" + "sha": "2fa6dcd06b59debf1dba80e7061c83e3e3f972a9" } }, { From 1a04f536889d29c2bdc221f6642a40400b7d2b4f Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:40:21 -0800 Subject: [PATCH 02/11] fix: remove client recv msg limit fix: add enums to `types/__init__.py` PiperOrigin-RevId: 347055288 Source-Author: Google APIs Source-Date: Fri Dec 11 12:44:37 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: dd372aa22ded7a8ba6f0e03a80e06358a3fa0907 Source-Link: https://github.com/googleapis/googleapis/commit/dd372aa22ded7a8ba6f0e03a80e06358a3fa0907 --- google/cloud/vision_v1/__init__.py | 4 ++-- google/cloud/vision_v1p3beta1/__init__.py | 4 ++-- google/cloud/vision_v1p4beta1/__init__.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/vision_v1/__init__.py b/google/cloud/vision_v1/__init__.py index 8b1d075a..df7114a8 100644 --- a/google/cloud/vision_v1/__init__.py +++ b/google/cloud/vision_v1/__init__.py @@ -152,7 +152,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -180,6 +179,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -198,5 +198,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index c00754cf..b38431b4 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,7 +143,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -173,6 +172,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/google/cloud/vision_v1p4beta1/__init__.py b/google/cloud/vision_v1p4beta1/__init__.py index 890dd009..c2b932ed 100644 --- a/google/cloud/vision_v1p4beta1/__init__.py +++ b/google/cloud/vision_v1p4beta1/__init__.py @@ -158,7 +158,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -186,6 +185,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -204,5 +204,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) From 200bcad702875e41a38422b60c9bdae0bb31fa0a Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:43:18 -0800 Subject: [PATCH 03/11] chore: upgrade gapic-generator-python to 0.39.1 feat: add 'from_service_account_info' factory to clients fix: fix sphinx identifiers PiperOrigin-RevId: 350246057 Source-Author: Google APIs Source-Date: Tue Jan 5 16:44:11 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 520682435235d9c503983a360a2090025aa47cd1 Source-Link: https://github.com/googleapis/googleapis/commit/520682435235d9c503983a360a2090025aa47cd1 --- docs/vision_v1/image_annotator.rst | 6 + docs/vision_v1/product_search.rst | 11 + docs/vision_v1/services.rst | 10 +- docs/vision_v1/types.rst | 1 + docs/vision_v1p2beta1/image_annotator.rst | 6 + docs/vision_v1p2beta1/services.rst | 6 +- docs/vision_v1p2beta1/types.rst | 1 + docs/vision_v1p3beta1/image_annotator.rst | 6 + docs/vision_v1p3beta1/product_search.rst | 11 + docs/vision_v1p3beta1/services.rst | 10 +- docs/vision_v1p3beta1/types.rst | 1 + docs/vision_v1p4beta1/image_annotator.rst | 6 + docs/vision_v1p4beta1/product_search.rst | 11 + docs/vision_v1p4beta1/services.rst | 10 +- docs/vision_v1p4beta1/types.rst | 1 + google/cloud/vision_v1/__init__.py | 4 +- .../services/image_annotator/async_client.py | 36 +-- .../services/image_annotator/client.py | 57 +++-- .../services/product_search/async_client.py | 163 +++++++------ .../services/product_search/client.py | 228 +++++++++++------- .../services/product_search/pagers.py | 64 ++--- google/cloud/vision_v1/types/geometry.py | 4 +- .../cloud/vision_v1/types/image_annotator.py | 156 ++++++------ .../cloud/vision_v1/types/product_search.py | 16 +- .../vision_v1/types/product_search_service.py | 46 ++-- .../cloud/vision_v1/types/text_annotation.py | 36 +-- google/cloud/vision_v1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 8 +- .../services/image_annotator/client.py | 29 ++- .../cloud/vision_v1p1beta1/types/geometry.py | 2 +- .../vision_v1p1beta1/types/image_annotator.py | 100 ++++---- .../vision_v1p1beta1/types/text_annotation.py | 36 +-- .../vision_v1p1beta1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 17 +- .../services/image_annotator/client.py | 38 ++- .../cloud/vision_v1p2beta1/types/geometry.py | 4 +- .../vision_v1p2beta1/types/image_annotator.py | 130 +++++----- .../vision_v1p2beta1/types/text_annotation.py | 36 +-- .../vision_v1p2beta1/types/web_detection.py | 16 +- google/cloud/vision_v1p3beta1/__init__.py | 4 +- .../services/image_annotator/async_client.py | 17 +- .../services/image_annotator/client.py | 38 ++- .../services/product_search/async_client.py | 138 ++++++----- .../services/product_search/client.py | 201 +++++++++------ .../services/product_search/pagers.py | 64 ++--- .../cloud/vision_v1p3beta1/types/geometry.py | 6 +- .../vision_v1p3beta1/types/image_annotator.py | 138 +++++------ .../vision_v1p3beta1/types/product_search.py | 18 +- .../types/product_search_service.py | 44 ++-- .../vision_v1p3beta1/types/text_annotation.py | 36 +-- .../vision_v1p3beta1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 36 +-- .../services/image_annotator/client.py | 57 +++-- .../services/product_search/async_client.py | 163 +++++++------ .../services/product_search/client.py | 228 +++++++++++------- .../services/product_search/pagers.py | 64 ++--- google/cloud/vision_v1p4beta1/types/face.py | 2 +- .../cloud/vision_v1p4beta1/types/geometry.py | 4 +- .../vision_v1p4beta1/types/image_annotator.py | 160 ++++++------ .../vision_v1p4beta1/types/product_search.py | 16 +- .../types/product_search_service.py | 46 ++-- .../vision_v1p4beta1/types/text_annotation.py | 36 +-- .../vision_v1p4beta1/types/web_detection.py | 16 +- synth.metadata | 11 +- .../gapic/vision_v1/test_image_annotator.py | 28 ++- .../gapic/vision_v1/test_product_search.py | 28 ++- .../vision_v1p1beta1/test_image_annotator.py | 28 ++- .../vision_v1p2beta1/test_image_annotator.py | 28 ++- .../vision_v1p3beta1/test_image_annotator.py | 28 ++- .../vision_v1p3beta1/test_product_search.py | 28 ++- .../vision_v1p4beta1/test_image_annotator.py | 28 ++- .../vision_v1p4beta1/test_product_search.py | 28 ++- 72 files changed, 1826 insertions(+), 1312 deletions(-) create mode 100644 docs/vision_v1/image_annotator.rst create mode 100644 docs/vision_v1/product_search.rst create mode 100644 docs/vision_v1p2beta1/image_annotator.rst create mode 100644 docs/vision_v1p3beta1/image_annotator.rst create mode 100644 docs/vision_v1p3beta1/product_search.rst create mode 100644 docs/vision_v1p4beta1/image_annotator.rst create mode 100644 docs/vision_v1p4beta1/product_search.rst diff --git a/docs/vision_v1/image_annotator.rst b/docs/vision_v1/image_annotator.rst new file mode 100644 index 00000000..83130a76 --- /dev/null +++ b/docs/vision_v1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1/product_search.rst b/docs/vision_v1/product_search.rst new file mode 100644 index 00000000..64e5cd02 --- /dev/null +++ b/docs/vision_v1/product_search.rst @@ -0,0 +1,11 @@ +ProductSearch +------------------------------- + +.. automodule:: google.cloud.vision_v1.services.product_search + :members: + :inherited-members: + + +.. automodule:: google.cloud.vision_v1.services.product_search.pagers + :members: + :inherited-members: diff --git a/docs/vision_v1/services.rst b/docs/vision_v1/services.rst index 0331ec53..5fe11bc5 100644 --- a/docs/vision_v1/services.rst +++ b/docs/vision_v1/services.rst @@ -1,9 +1,7 @@ Services for Google Cloud Vision v1 API ======================================= +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1.services.image_annotator - :members: - :inherited-members: -.. automodule:: google.cloud.vision_v1.services.product_search - :members: - :inherited-members: + image_annotator + product_search diff --git a/docs/vision_v1/types.rst b/docs/vision_v1/types.rst index dbbb594c..52d9869b 100644 --- a/docs/vision_v1/types.rst +++ b/docs/vision_v1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1 API .. automodule:: google.cloud.vision_v1.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p2beta1/image_annotator.rst b/docs/vision_v1p2beta1/image_annotator.rst new file mode 100644 index 00000000..d05fd549 --- /dev/null +++ b/docs/vision_v1p2beta1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1p2beta1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1p2beta1/services.rst b/docs/vision_v1p2beta1/services.rst index 55dc030c..2272ceb5 100644 --- a/docs/vision_v1p2beta1/services.rst +++ b/docs/vision_v1p2beta1/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Vision v1p2beta1 API ============================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1p2beta1.services.image_annotator - :members: - :inherited-members: + image_annotator diff --git a/docs/vision_v1p2beta1/types.rst b/docs/vision_v1p2beta1/types.rst index 898a797f..33ab32e0 100644 --- a/docs/vision_v1p2beta1/types.rst +++ b/docs/vision_v1p2beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1p2beta1 API .. automodule:: google.cloud.vision_v1p2beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p3beta1/image_annotator.rst b/docs/vision_v1p3beta1/image_annotator.rst new file mode 100644 index 00000000..a5ed7542 --- /dev/null +++ b/docs/vision_v1p3beta1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1p3beta1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1p3beta1/product_search.rst b/docs/vision_v1p3beta1/product_search.rst new file mode 100644 index 00000000..fd321a60 --- /dev/null +++ b/docs/vision_v1p3beta1/product_search.rst @@ -0,0 +1,11 @@ +ProductSearch +------------------------------- + +.. automodule:: google.cloud.vision_v1p3beta1.services.product_search + :members: + :inherited-members: + + +.. automodule:: google.cloud.vision_v1p3beta1.services.product_search.pagers + :members: + :inherited-members: diff --git a/docs/vision_v1p3beta1/services.rst b/docs/vision_v1p3beta1/services.rst index 591da113..06da9b3d 100644 --- a/docs/vision_v1p3beta1/services.rst +++ b/docs/vision_v1p3beta1/services.rst @@ -1,9 +1,7 @@ Services for Google Cloud Vision v1p3beta1 API ============================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1p3beta1.services.image_annotator - :members: - :inherited-members: -.. automodule:: google.cloud.vision_v1p3beta1.services.product_search - :members: - :inherited-members: + image_annotator + product_search diff --git a/docs/vision_v1p3beta1/types.rst b/docs/vision_v1p3beta1/types.rst index 8f60a298..5fdbaea1 100644 --- a/docs/vision_v1p3beta1/types.rst +++ b/docs/vision_v1p3beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1p3beta1 API .. automodule:: google.cloud.vision_v1p3beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p4beta1/image_annotator.rst b/docs/vision_v1p4beta1/image_annotator.rst new file mode 100644 index 00000000..28717262 --- /dev/null +++ b/docs/vision_v1p4beta1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1p4beta1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1p4beta1/product_search.rst b/docs/vision_v1p4beta1/product_search.rst new file mode 100644 index 00000000..e46b54b0 --- /dev/null +++ b/docs/vision_v1p4beta1/product_search.rst @@ -0,0 +1,11 @@ +ProductSearch +------------------------------- + +.. automodule:: google.cloud.vision_v1p4beta1.services.product_search + :members: + :inherited-members: + + +.. automodule:: google.cloud.vision_v1p4beta1.services.product_search.pagers + :members: + :inherited-members: diff --git a/docs/vision_v1p4beta1/services.rst b/docs/vision_v1p4beta1/services.rst index e8da2e62..2ebd0bbc 100644 --- a/docs/vision_v1p4beta1/services.rst +++ b/docs/vision_v1p4beta1/services.rst @@ -1,9 +1,7 @@ Services for Google Cloud Vision v1p4beta1 API ============================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1p4beta1.services.image_annotator - :members: - :inherited-members: -.. automodule:: google.cloud.vision_v1p4beta1.services.product_search - :members: - :inherited-members: + image_annotator + product_search diff --git a/docs/vision_v1p4beta1/types.rst b/docs/vision_v1p4beta1/types.rst index 214f01b1..a90d1fa2 100644 --- a/docs/vision_v1p4beta1/types.rst +++ b/docs/vision_v1p4beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1p4beta1 API .. automodule:: google.cloud.vision_v1p4beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/google/cloud/vision_v1/__init__.py b/google/cloud/vision_v1/__init__.py index df7114a8..8b1d075a 100644 --- a/google/cloud/vision_v1/__init__.py +++ b/google/cloud/vision_v1/__init__.py @@ -152,6 +152,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -179,7 +180,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -198,5 +198,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/google/cloud/vision_v1/services/image_annotator/async_client.py b/google/cloud/vision_v1/services/image_annotator/async_client.py index f441e263..8dc41443 100644 --- a/google/cloud/vision_v1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1/services/image_annotator/async_client.py @@ -83,6 +83,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -160,12 +161,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -177,7 +179,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -241,14 +243,15 @@ async def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1.types.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -260,7 +263,7 @@ async def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -327,18 +330,20 @@ async def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (:class:`google.cloud.vision_v1.types.OutputConfig`): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -350,11 +355,11 @@ async def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -427,12 +432,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -444,11 +450,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1/services/image_annotator/client.py b/google/cloud/vision_v1/services/image_annotator/client.py index cd963a34..8ca6b81f 100644 --- a/google/cloud/vision_v1/services/image_annotator/client.py +++ b/google/cloud/vision_v1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -365,12 +381,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -382,7 +399,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -442,14 +459,15 @@ def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (google.cloud.vision_v1.types.BatchAnnotateFilesRequest): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -461,7 +479,7 @@ def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -524,18 +542,20 @@ def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (google.cloud.vision_v1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -547,11 +567,11 @@ def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -622,12 +642,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -639,11 +660,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1/services/product_search/async_client.py b/google/cloud/vision_v1/services/product_search/async_client.py index 11b5e016..4535cd22 100644 --- a/google/cloud/vision_v1/services/product_search/async_client.py +++ b/google/cloud/vision_v1/services/product_search/async_client.py @@ -107,6 +107,7 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) + from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -190,7 +191,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -198,10 +199,11 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1.types.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -212,6 +214,7 @@ async def create_product_set( 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -223,7 +226,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -296,7 +299,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (:class:`google.cloud.vision_v1.types.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -304,6 +307,7 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -315,8 +319,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsAsyncPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -390,7 +394,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -398,6 +402,7 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -409,7 +414,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -484,20 +489,22 @@ async def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1.types.ProductSet`): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -509,7 +516,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -582,7 +589,7 @@ async def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -590,6 +597,7 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -668,7 +676,7 @@ async def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (:class:`google.cloud.vision_v1.types.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -676,10 +684,11 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1.types.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -690,6 +699,7 @@ async def create_product( 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -701,7 +711,7 @@ async def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -769,7 +779,7 @@ async def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (:class:`google.cloud.vision_v1.types.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -777,6 +787,7 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -788,8 +799,8 @@ async def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsAsyncPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -863,7 +874,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (:class:`google.cloud.vision_v1.types.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -871,6 +882,7 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -882,7 +894,7 @@ async def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -959,22 +971,24 @@ async def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (:class:`google.cloud.vision_v1.types.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1.types.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -986,7 +1000,7 @@ async def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1056,7 +1070,7 @@ async def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (:class:`google.cloud.vision_v1.types.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1064,6 +1078,7 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1154,7 +1169,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (:class:`google.cloud.vision_v1.types.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1163,13 +1178,15 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (:class:`google.cloud.vision_v1.types.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1179,6 +1196,7 @@ async def create_reference_image( 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1190,9 +1208,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1261,7 +1279,7 @@ async def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (:class:`google.cloud.vision_v1.types.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1271,6 +1289,7 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1344,7 +1363,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (:class:`google.cloud.vision_v1.types.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1353,6 +1372,7 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1364,8 +1384,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesAsyncPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1439,7 +1459,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (:class:`google.cloud.vision_v1.types.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1449,6 +1469,7 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1460,9 +1481,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1532,7 +1553,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1541,6 +1562,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1550,6 +1572,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1620,7 +1643,7 @@ async def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1629,6 +1652,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1638,6 +1662,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1714,7 +1739,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1723,6 +1748,7 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1734,8 +1760,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetAsyncPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1818,7 +1844,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (:class:`google.cloud.vision_v1.types.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1826,12 +1852,14 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (:class:`google.cloud.vision_v1.types.ImportProductSetsInputConfig`): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1843,18 +1871,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -1949,7 +1977,7 @@ async def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (:class:`google.cloud.vision_v1.types.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. parent (:class:`str`): @@ -1957,6 +1985,7 @@ async def purge_products( should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1968,24 +1997,22 @@ async def purge_products( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1/services/product_search/client.py b/google/cloud/vision_v1/services/product_search/client.py index b79cb3da..92d6b652 100644 --- a/google/cloud/vision_v1/services/product_search/client.py +++ b/google/cloud/vision_v1/services/product_search/client.py @@ -133,6 +133,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProductSearchClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -145,7 +161,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProductSearchClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -290,10 +306,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ProductSearchTransport]): The + transport (Union[str, ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -410,28 +426,30 @@ def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (google.cloud.vision_v1.types.CreateProductSetRequest): The request object. Request message for the `CreateProductSet` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (:class:`str`): + product_set_id (str): 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -443,7 +461,7 @@ def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -511,14 +529,15 @@ def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1.types.ListProductSetsRequest): The request object. Request message for the `ListProductSets` method. - parent (:class:`str`): + parent (str): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -530,8 +549,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -598,14 +617,15 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (google.cloud.vision_v1.types.GetProductSetRequest): The request object. Request message for the `GetProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -617,7 +637,7 @@ def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -685,20 +705,22 @@ def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (google.cloud.vision_v1.types.UpdateProductSetRequest): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -710,7 +732,7 @@ def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -776,14 +798,15 @@ def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (google.cloud.vision_v1.types.DeleteProductSetRequest): The request object. Request message for the `DeleteProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -855,28 +878,30 @@ def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (google.cloud.vision_v1.types.CreateProductRequest): The request object. Request message for the `CreateProduct` method. - parent (:class:`str`): + parent (str): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1.types.Product): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (:class:`str`): + product_id (str): 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -888,7 +913,7 @@ def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -951,14 +976,15 @@ def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1.types.ListProductsRequest): The request object. Request message for the `ListProducts` method. - parent (:class:`str`): + parent (str): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -970,8 +996,8 @@ def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductsPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1038,14 +1064,15 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (google.cloud.vision_v1.types.GetProductRequest): The request object. Request message for the `GetProduct` method. - name (:class:`str`): + name (str): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1057,7 +1084,7 @@ def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1127,22 +1154,24 @@ def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (google.cloud.vision_v1.types.UpdateProductRequest): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1154,7 +1183,7 @@ def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1217,14 +1246,15 @@ def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (google.cloud.vision_v1.types.DeleteProductRequest): The request object. Request message for the `DeleteProduct` method. - name (:class:`str`): + name (str): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1308,31 +1338,34 @@ def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (google.cloud.vision_v1.types.CreateReferenceImageRequest): The request object. Request message for the `CreateReferenceImage` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (google.cloud.vision_v1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (:class:`str`): + reference_image_id (str): 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1344,9 +1377,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1410,16 +1443,17 @@ def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (google.cloud.vision_v1.types.DeleteReferenceImageRequest): The request object. Request message for the `DeleteReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1486,15 +1520,16 @@ def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1.types.ListReferenceImagesRequest): The request object. Request message for the `ListReferenceImages` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1506,8 +1541,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1574,16 +1609,17 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (google.cloud.vision_v1.types.GetReferenceImageRequest): The request object. Request message for the `GetReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1595,9 +1631,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1660,24 +1696,26 @@ def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (google.cloud.vision_v1.types.AddProductToProductSetRequest): The request object. Request message for the `AddProductToProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1745,24 +1783,26 @@ def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (google.cloud.vision_v1.types.RemoveProductFromProductSetRequest): The request object. Request message for the `RemoveProductFromProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1836,15 +1876,16 @@ def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): The request object. Request message for the `ListProductsInProductSet` method. - name (:class:`str`): + name (str): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1856,8 +1897,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1937,20 +1978,22 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (google.cloud.vision_v1.types.ImportProductSetsRequest): The request object. Request message for the `ImportProductSets` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (google.cloud.vision_v1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1962,18 +2005,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -2063,14 +2106,15 @@ def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (google.cloud.vision_v1.types.PurgeProductsRequest): The request object. Request message for the `PurgeProducts` method. - parent (:class:`str`): + parent (str): Required. The project and location in which the Products should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2082,24 +2126,22 @@ def purge_products( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1/services/product_search/pagers.py b/google/cloud/vision_v1/services/product_search/pagers.py index 69bc017f..cf8c6a00 100644 --- a/google/cloud/vision_v1/services/product_search/pagers.py +++ b/google/cloud/vision_v1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1/types/geometry.py b/google/cloud/vision_v1/types/geometry.py index be6f5602..05db4f69 100644 --- a/google/cloud/vision_v1/types/geometry.py +++ b/google/cloud/vision_v1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1/types/image_annotator.py b/google/cloud/vision_v1/types/image_annotator.py index 462baf72..4f901266 100644 --- a/google/cloud/vision_v1/types/image_annotator.py +++ b/google/cloud/vision_v1/types/image_annotator.py @@ -93,7 +93,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -176,7 +176,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -193,7 +193,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human @@ -201,7 +201,7 @@ class FaceAnnotation(proto.Message): that one or more x and/or y coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -209,7 +209,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -228,19 +228,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1.types.Likelihood): Headwear likelihood. """ @@ -248,9 +248,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1.types.Position): Face landmark position. """ @@ -337,7 +337,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -392,17 +392,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -442,7 +442,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -464,21 +464,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -532,9 +532,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -548,7 +548,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -568,7 +568,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -580,7 +580,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -595,7 +595,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale. @@ -618,7 +618,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1.types.CropHint]): Crop hint results. """ @@ -673,7 +673,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -686,13 +686,13 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1.types.CropHintsParams): Parameters for crop hints annotation request. - product_search_params (~.product_search.ProductSearchParams): + product_search_params (google.cloud.vision_v1.types.ProductSearchParams): Parameters for product search. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -722,11 +722,11 @@ class AnnotateImageRequest(proto.Message): context information. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1.types.ImageContext): Additional context that may accompany the image. """ @@ -761,50 +761,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[google.cloud.vision_v1.types.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1.types.WebDetection): If present, web detection has completed successfully. - product_search_results (~.product_search.ProductSearchResults): + product_search_results (google.cloud.vision_v1.types.ProductSearchResults): If present, product search has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -867,7 +867,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. parent (str): @@ -896,7 +896,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -911,11 +911,11 @@ class AnnotateFileRequest(proto.Message): GIF file. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1.types.ImageContext): Additional context that may accompany the image(s) in the file. pages (Sequence[int]): @@ -951,16 +951,16 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]): Individual responses to images found within the file. This field will be empty if the ``error`` field is set. total_pages (int): This field gives the total number of pages in the file. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the failed request. The ``responses`` field will not be set in this case. """ @@ -981,7 +981,7 @@ class BatchAnnotateFilesRequest(proto.Message): BatchAnnotateFiles API. Attributes: - requests (Sequence[~.image_annotator.AnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in @@ -1012,7 +1012,7 @@ class BatchAnnotateFilesResponse(proto.Message): r"""A list of file annotation responses. Attributes: - responses (Sequence[~.image_annotator.AnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1.types.AnnotateFileResponse]): The list of file annotation responses, each response corresponding to each AnnotateFileRequest in @@ -1028,14 +1028,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1053,7 +1053,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -1065,10 +1065,10 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): r"""Request for async image annotation for a list of images. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). parent (str): @@ -1099,7 +1099,7 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): r"""Response to an async batch image annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): The output location and metadata from AsyncBatchAnnotateImagesRequest. """ @@ -1112,7 +1112,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. parent (str): @@ -1141,7 +1141,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -1156,7 +1156,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1.types.GcsSource): The Google Cloud Storage location to read the input from. content (bytes): @@ -1184,7 +1184,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1261,11 +1261,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1/types/product_search.py b/google/cloud/vision_v1/types/product_search.py index 6ae8f236..127bbb97 100644 --- a/google/cloud/vision_v1/types/product_search.py +++ b/google/cloud/vision_v1/types/product_search.py @@ -33,7 +33,7 @@ class ProductSearchParams(proto.Message): r"""Parameters for a product search request. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. @@ -83,14 +83,14 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of the index which provided these results. Products added to the product set and products removed from the product set after this time are not reflected in the current results. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]): List of results, one for each product match. - product_grouped_results (Sequence[~.product_search.ProductSearchResults.GroupedResult]): + product_grouped_results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.GroupedResult]): List of results grouped by products detected in the query image. Each entry corresponds to one bounding polygon in the query image, and @@ -103,7 +103,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1.types.Product): The Product. score (float): A confidence level on the match, ranging from @@ -151,12 +151,12 @@ class GroupedResult(proto.Message): a query image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon around the product detected in the query image. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]): List of results, one for each product match. - object_annotations (Sequence[~.product_search.ProductSearchResults.ObjectAnnotation]): + object_annotations (Sequence[google.cloud.vision_v1.types.ProductSearchResults.ObjectAnnotation]): List of generic predictions for the object in the bounding box. """ diff --git a/google/cloud/vision_v1/types/product_search_service.py b/google/cloud/vision_v1/types/product_search_service.py index f06e2eee..158deb5a 100644 --- a/google/cloud/vision_v1/types/product_search_service.py +++ b/google/cloud/vision_v1/types/product_search_service.py @@ -87,7 +87,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[~.product_search_service.Product.KeyValue]): + product_labels (Sequence[google.cloud.vision_v1.types.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -150,7 +150,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -160,7 +160,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (~.status.Status): + index_error (google.rpc.status_pb2.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -195,7 +195,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[~.geometry.BoundingPoly]): + bounding_polys (Sequence[google.cloud.vision_v1.types.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -226,7 +226,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (~.product_search_service.Product): + product (google.cloud.vision_v1.types.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -271,7 +271,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1.types.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -306,11 +306,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -345,7 +345,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -390,7 +390,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[~.product_search_service.ProductSet]): + product_sets (Sequence[google.cloud.vision_v1.types.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -425,10 +425,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -464,7 +464,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (~.product_search_service.ReferenceImage): + reference_image (google.cloud.vision_v1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -514,7 +514,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1.types.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -641,7 +641,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1.types.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -746,7 +746,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (~.product_search_service.ImportProductSetsGcsSource): + gcs_source (google.cloud.vision_v1.types.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -766,7 +766,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (~.product_search_service.ImportProductSetsInputConfig): + input_config (google.cloud.vision_v1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -788,9 +788,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1.types.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[~.status.Status]): + statuses (Sequence[google.rpc.status_pb2.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -815,12 +815,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (~.product_search_service.BatchOperationMetadata.State): + state (google.cloud.vision_v1.types.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (~.timestamp.Timestamp): + submit_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was submitted to the server. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. @@ -861,7 +861,7 @@ class PurgeProductsRequest(proto.Message): r"""Request message for the ``PurgeProducts`` method. Attributes: - product_set_purge_config (~.product_search_service.ProductSetPurgeConfig): + product_set_purge_config (google.cloud.vision_v1.types.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. delete_orphan_products (bool): diff --git a/google/cloud/vision_v1/types/text_annotation.py b/google/cloud/vision_v1/types/text_annotation.py index fa3b88ae..3f8e73a8 100644 --- a/google/cloud/vision_v1/types/text_annotation.py +++ b/google/cloud/vision_v1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertex order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1.types.Word]): List of all words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1/types/web_detection.py b/google/cloud/vision_v1/types/web_detection.py index 9395af29..7aa82a25 100644 --- a/google/cloud/vision_v1/types/web_detection.py +++ b/google/cloud/vision_v1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1.types.WebDetection.WebLabel]): The service's best guess as to the topic of the request image. Inferred from similar images on the open web. @@ -98,10 +98,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py index 9099dd92..a5154e9d 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py @@ -76,6 +76,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -153,12 +154,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -170,7 +172,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py index 9b133ea1..8214e06e 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py @@ -113,6 +113,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -125,7 +141,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -217,10 +233,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -331,12 +347,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -348,7 +365,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. diff --git a/google/cloud/vision_v1p1beta1/types/geometry.py b/google/cloud/vision_v1p1beta1/types/geometry.py index de248804..f581bee0 100644 --- a/google/cloud/vision_v1p1beta1/types/geometry.py +++ b/google/cloud/vision_v1p1beta1/types/geometry.py @@ -45,7 +45,7 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p1beta1.types.Vertex]): The bounding polygon vertices. """ diff --git a/google/cloud/vision_v1p1beta1/types/image_annotator.py b/google/cloud/vision_v1p1beta1/types/image_annotator.py index be04b15f..93f03cb8 100644 --- a/google/cloud/vision_v1p1beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p1beta1/types/image_annotator.py @@ -76,7 +76,7 @@ class Feature(proto.Message): return. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p1beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. @@ -145,7 +145,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: as with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p1beta1.types.ImageSource): Google Cloud Storage image location. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to perform the image annotation @@ -162,7 +162,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -171,7 +171,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -179,7 +179,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -198,19 +198,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Headwear likelihood. """ @@ -218,9 +218,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p1beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p1beta1.types.Position): Face landmark position. """ @@ -307,7 +307,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -361,17 +361,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p1beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p1beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -402,21 +402,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p1beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p1beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p1beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p1beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p1beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -440,9 +440,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -456,7 +456,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -476,7 +476,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p1beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -488,7 +488,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p1beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -503,7 +503,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -526,7 +526,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p1beta1.types.CropHint]): Crop hint results. """ @@ -581,7 +581,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p1beta1.types.LatLongRect): lat/long rectangle that specifies the location of the image. language_hints (Sequence[str]): @@ -595,11 +595,11 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p1beta1.types.CropHintsParams): Parameters for crop hints annotation request. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p1beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p1beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -624,11 +624,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p1beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p1beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p1beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -644,39 +644,39 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p1beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p1beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p1beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p1beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p1beta1.types.WebDetection): If present, web detection has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. @@ -730,7 +730,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -744,7 +744,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ diff --git a/google/cloud/vision_v1p1beta1/types/text_annotation.py b/google/cloud/vision_v1p1beta1/types/text_annotation.py index 8e231b4b..23b249fe 100644 --- a/google/cloud/vision_v1p1beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p1beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p1beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,13 +113,13 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width in pixels. height (int): Page height in pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p1beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -143,10 +143,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -158,10 +158,10 @@ class Block(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p1beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p1beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -195,10 +195,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -210,7 +210,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p1beta1.types.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -232,9 +232,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -246,7 +246,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p1beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -269,10 +269,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p1beta1/types/web_detection.py b/google/cloud/vision_v1p1beta1/types/web_detection.py index 6bd91777..1e9586d6 100644 --- a/google/cloud/vision_v1p1beta1/types/web_detection.py +++ b/google/cloud/vision_v1p1beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py index e28c5f19..c2efa184 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py @@ -78,6 +78,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -155,12 +156,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -172,7 +174,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -235,12 +237,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -252,11 +255,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py index c86c318b..07dcec8e 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -219,10 +235,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -333,12 +349,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -350,7 +367,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -409,12 +426,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -426,11 +444,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p2beta1/types/geometry.py b/google/cloud/vision_v1p2beta1/types/geometry.py index 482f5ec2..42fb6ec0 100644 --- a/google/cloud/vision_v1p2beta1/types/geometry.py +++ b/google/cloud/vision_v1p2beta1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p2beta1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1p2beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1p2beta1/types/image_annotator.py b/google/cloud/vision_v1p2beta1/types/image_annotator.py index 0f3bee9c..5480edb6 100644 --- a/google/cloud/vision_v1p2beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p2beta1/types/image_annotator.py @@ -86,7 +86,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p2beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -167,7 +167,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p2beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -184,7 +184,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -193,7 +193,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -201,7 +201,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -220,19 +220,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Headwear likelihood. """ @@ -240,9 +240,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p2beta1.types.Position): Face landmark position. """ @@ -329,7 +329,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -384,17 +384,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p2beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p2beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -425,21 +425,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p2beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p2beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p2beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p2beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p2beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -463,9 +463,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -479,7 +479,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -499,7 +499,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p2beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -511,7 +511,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p2beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -526,7 +526,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -549,7 +549,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p2beta1.types.CropHint]): Crop hint results. """ @@ -604,7 +604,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p2beta1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -617,11 +617,11 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p2beta1.types.CropHintsParams): Parameters for crop hints annotation request. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p2beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p2beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -646,11 +646,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p2beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p2beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p2beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -685,43 +685,43 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p2beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p2beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p2beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p2beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p2beta1.types.WebDetection): If present, web detection has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1p2beta1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -777,10 +777,10 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p2beta1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]): Individual responses to images found within the file. """ @@ -797,7 +797,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -811,7 +811,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -825,14 +825,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p2beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p2beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p2beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p2beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -850,7 +850,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p2beta1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -863,7 +863,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -877,7 +877,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -892,7 +892,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1p2beta1.types.GcsSource): The Google Cloud Storage location to read the input from. mime_type (str): @@ -910,7 +910,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1p2beta1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -978,11 +978,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1p2beta1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p2beta1/types/text_annotation.py b/google/cloud/vision_v1p2beta1/types/text_annotation.py index c7c6de3d..e2366e17 100644 --- a/google/cloud/vision_v1p2beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p2beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p2beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p2beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p2beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p2beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p2beta1.types.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p2beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p2beta1/types/web_detection.py b/google/cloud/vision_v1p2beta1/types/web_detection.py index 1a4f954d..d3a7ffee 100644 --- a/google/cloud/vision_v1p2beta1/types/web_detection.py +++ b/google/cloud/vision_v1p2beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index b38431b4..c00754cf 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,6 +143,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -172,7 +173,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py index c9e14583..1ca98853 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py @@ -83,6 +83,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -160,12 +161,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]`): Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -177,7 +179,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -240,12 +242,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -257,11 +260,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py index 6792a030..abbf8ce0 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -365,12 +381,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]): Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -382,7 +399,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -441,12 +458,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -458,11 +476,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py index 60c3a3cd..6a7c3022 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py @@ -108,6 +108,7 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) + from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -191,7 +192,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -199,10 +200,11 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p3beta1.types.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -213,6 +215,7 @@ async def create_product_set( 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -224,7 +227,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -297,7 +300,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -305,6 +308,7 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -316,8 +320,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsAsyncPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsAsyncPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -391,7 +395,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -399,6 +403,7 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -410,7 +415,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -485,20 +490,22 @@ async def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p3beta1.types.ProductSet`): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -510,7 +517,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -586,7 +593,7 @@ async def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -594,6 +601,7 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -672,7 +680,7 @@ async def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -680,10 +688,11 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p3beta1.types.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -694,6 +703,7 @@ async def create_product( 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -705,7 +715,7 @@ async def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -773,7 +783,7 @@ async def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -781,6 +791,7 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -792,8 +803,8 @@ async def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsAsyncPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsAsyncPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -867,7 +878,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -875,6 +886,7 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -886,7 +898,7 @@ async def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -963,22 +975,24 @@ async def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p3beta1.types.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -990,7 +1004,7 @@ async def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1061,7 +1075,7 @@ async def delete_product( - Returns NOT_FOUND if the product does not exist. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1069,6 +1083,7 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1159,7 +1174,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1168,13 +1183,15 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (:class:`google.cloud.vision_v1p3beta1.types.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1184,6 +1201,7 @@ async def create_reference_image( 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1195,9 +1213,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1271,7 +1289,7 @@ async def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1281,6 +1299,7 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1354,7 +1373,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1363,6 +1382,7 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1374,8 +1394,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesAsyncPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1449,7 +1469,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1459,6 +1479,7 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1470,9 +1491,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1542,7 +1563,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1551,6 +1572,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1560,6 +1582,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1633,7 +1656,7 @@ async def remove_product_from_product_set( ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1642,6 +1665,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1651,6 +1675,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1725,7 +1750,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1734,6 +1759,7 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1745,8 +1771,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetAsyncPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1829,7 +1855,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1837,12 +1863,14 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (:class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig`): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1854,18 +1882,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. + + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/client.py b/google/cloud/vision_v1p3beta1/services/product_search/client.py index 804985ed..c6427ba1 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/client.py @@ -134,6 +134,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProductSearchClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -146,7 +162,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProductSearchClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -291,10 +307,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ProductSearchTransport]): The + transport (Union[str, ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -411,28 +427,30 @@ def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.CreateProductSetRequest): The request object. Request message for the `CreateProductSet` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (:class:`str`): + product_set_id (str): 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -444,7 +462,7 @@ def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -512,14 +530,15 @@ def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): The request object. Request message for the `ListProductSets` method. - parent (:class:`str`): + parent (str): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -531,8 +550,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -599,14 +618,15 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.GetProductSetRequest): The request object. Request message for the `GetProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -618,7 +638,7 @@ def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -686,20 +706,22 @@ def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -711,7 +733,7 @@ def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -782,14 +804,15 @@ def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest): The request object. Request message for the `DeleteProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -861,28 +884,30 @@ def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (google.cloud.vision_v1p3beta1.types.CreateProductRequest): The request object. Request message for the `CreateProduct` method. - parent (:class:`str`): + parent (str): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (:class:`str`): + product_id (str): 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -894,7 +919,7 @@ def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -957,14 +982,15 @@ def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): The request object. Request message for the `ListProducts` method. - parent (:class:`str`): + parent (str): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -976,8 +1002,8 @@ def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1044,14 +1070,15 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (google.cloud.vision_v1p3beta1.types.GetProductRequest): The request object. Request message for the `GetProduct` method. - name (:class:`str`): + name (str): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1063,7 +1090,7 @@ def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1133,22 +1160,24 @@ def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (google.cloud.vision_v1p3beta1.types.UpdateProductRequest): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1160,7 +1189,7 @@ def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1226,14 +1255,15 @@ def delete_product( - Returns NOT_FOUND if the product does not exist. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (google.cloud.vision_v1p3beta1.types.DeleteProductRequest): The request object. Request message for the `DeleteProduct` method. - name (:class:`str`): + name (str): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1317,31 +1347,34 @@ def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest): The request object. Request message for the `CreateReferenceImage` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (google.cloud.vision_v1p3beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (:class:`str`): + reference_image_id (str): 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1353,9 +1386,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1424,16 +1457,17 @@ def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest): The request object. Request message for the `DeleteReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1500,15 +1534,16 @@ def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): The request object. Request message for the `ListReferenceImages` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1520,8 +1555,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1588,16 +1623,17 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest): The request object. Request message for the `GetReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1609,9 +1645,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1674,24 +1710,26 @@ def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest): The request object. Request message for the `AddProductToProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1764,24 +1802,26 @@ def remove_product_from_product_set( ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest): The request object. Request message for the `RemoveProductFromProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1855,15 +1895,16 @@ def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): The request object. Request message for the `ListProductsInProductSet` method. - name (:class:`str`): + name (str): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1875,8 +1916,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1956,20 +1997,22 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest): The request object. Request message for the `ImportProductSets` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1981,18 +2024,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. + + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py index 85829a6e..b145dd71 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1p3beta1/types/geometry.py b/google/cloud/vision_v1p3beta1/types/geometry.py index e6107175..c1b1fd91 100644 --- a/google/cloud/vision_v1p3beta1/types/geometry.py +++ b/google/cloud/vision_v1p3beta1/types/geometry.py @@ -68,9 +68,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p3beta1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1p3beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ @@ -85,7 +85,7 @@ class NormalizedBoundingPoly(proto.Message): r"""A normalized bounding polygon around a portion of an image. Attributes: - vertices (Sequence[~.geometry.NormalizedVertex]): + vertices (Sequence[google.cloud.vision_v1p3beta1.types.NormalizedVertex]): Normalized vertices of the bounding polygon. """ diff --git a/google/cloud/vision_v1p3beta1/types/image_annotator.py b/google/cloud/vision_v1p3beta1/types/image_annotator.py index 7c5f1d41..0af98b5a 100644 --- a/google/cloud/vision_v1p3beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p3beta1/types/image_annotator.py @@ -88,7 +88,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p3beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -171,7 +171,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p3beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -188,7 +188,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -197,7 +197,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -205,7 +205,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p3beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -224,19 +224,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Headwear likelihood. """ @@ -244,9 +244,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p3beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p3beta1.types.Position): Face landmark position. """ @@ -333,7 +333,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -388,17 +388,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p3beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p3beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -438,7 +438,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -460,21 +460,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p3beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p3beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p3beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p3beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p3beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -498,9 +498,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -514,7 +514,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -534,7 +534,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p3beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -546,7 +546,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p3beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -561,7 +561,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -584,7 +584,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p3beta1.types.CropHint]): Crop hint results. """ @@ -639,7 +639,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p3beta1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -652,13 +652,13 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p3beta1.types.CropHintsParams): Parameters for crop hints annotation request. - product_search_params (~.product_search.ProductSearchParams): + product_search_params (google.cloud.vision_v1p3beta1.types.ProductSearchParams): Parameters for product search. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p3beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p3beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -687,11 +687,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p3beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p3beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p3beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -726,50 +726,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p3beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[google.cloud.vision_v1p3beta1.types.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p3beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p3beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p3beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p3beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p3beta1.types.WebDetection): If present, web detection has completed successfully. - product_search_results (~.product_search.ProductSearchResults): + product_search_results (google.cloud.vision_v1p3beta1.types.ProductSearchResults): If present, product search has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1p3beta1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -833,10 +833,10 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p3beta1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageResponse]): Individual responses to images found within the file. """ @@ -853,7 +853,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]): Individual image annotation requests for this batch. """ @@ -867,7 +867,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -881,14 +881,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p3beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p3beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p3beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p3beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -906,7 +906,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p3beta1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -919,7 +919,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -933,7 +933,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -948,7 +948,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1p3beta1.types.GcsSource): The Google Cloud Storage location to read the input from. mime_type (str): @@ -966,7 +966,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1p3beta1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1034,11 +1034,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1p3beta1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p3beta1/types/product_search.py b/google/cloud/vision_v1p3beta1/types/product_search.py index 375bd701..43cb9f3a 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search.py +++ b/google/cloud/vision_v1p3beta1/types/product_search.py @@ -55,7 +55,7 @@ class ProductSearchParams(proto.Message): The resource name of the catalog to search. Format is: ``productSearch/catalogs/CATALOG_NAME``. - category (~.product_search.ProductSearchCategory): + category (google.cloud.vision_v1p3beta1.types.ProductSearchCategory): The category to search in. Optional. It is inferred by the system if it is not specified. [Deprecated] Use ``product_category``. @@ -64,15 +64,15 @@ class ProductSearchParams(proto.Message): by the system if it is not specified. Supported values are ``bag``, ``shoe``, ``sunglasses``, ``dress``, ``outerwear``, ``skirt``, ``top``, ``shorts``, and ``pants``. - normalized_bounding_poly (~.geometry.NormalizedBoundingPoly): + normalized_bounding_poly (google.cloud.vision_v1p3beta1.types.NormalizedBoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. [Deprecated] Use ``bounding_poly``. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. - view (~.product_search.ProductSearchResultsView): + view (google.cloud.vision_v1p3beta1.types.ProductSearchResultsView): Specifies the verbosity of the product search results. Optional. Defaults to ``BASIC``. product_set (str): @@ -123,19 +123,19 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - category (~.product_search.ProductSearchCategory): + category (google.cloud.vision_v1p3beta1.types.ProductSearchCategory): Product category. [Deprecated] Use ``product_category``. product_category (str): Product category. Supported values are ``bag`` and ``shoe``. [Deprecated] ``product_category`` is provided in each Product. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of the index which provided these results. Changes made after this time are not reflected in the current results. - products (Sequence[~.product_search.ProductSearchResults.ProductInfo]): + products (Sequence[google.cloud.vision_v1p3beta1.types.ProductSearchResults.ProductInfo]): List of detected products. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1p3beta1.types.ProductSearchResults.Result]): List of results, one for each product match. """ @@ -168,7 +168,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p3beta1.types.Product): The Product. score (float): A confidence level on the match, ranging from 0 (no diff --git a/google/cloud/vision_v1p3beta1/types/product_search_service.py b/google/cloud/vision_v1p3beta1/types/product_search_service.py index 1f13e1ba..aef592b7 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p3beta1/types/product_search_service.py @@ -85,7 +85,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[~.product_search_service.Product.KeyValue]): + product_labels (Sequence[google.cloud.vision_v1p3beta1.types.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -143,7 +143,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -152,7 +152,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (~.status.Status): + index_error (google.rpc.status_pb2.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -187,7 +187,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[~.geometry.BoundingPoly]): + bounding_polys (Sequence[google.cloud.vision_v1p3beta1.types.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -218,7 +218,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (~.product_search_service.Product): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -263,7 +263,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p3beta1.types.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -298,11 +298,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -337,7 +337,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -382,7 +382,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[~.product_search_service.ProductSet]): + product_sets (Sequence[google.cloud.vision_v1p3beta1.types.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -417,10 +417,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -456,7 +456,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (~.product_search_service.ReferenceImage): + reference_image (google.cloud.vision_v1p3beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -506,7 +506,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p3beta1.types.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -633,7 +633,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p3beta1.types.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -725,7 +725,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (~.product_search_service.ImportProductSetsGcsSource): + gcs_source (google.cloud.vision_v1p3beta1.types.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -745,7 +745,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (~.product_search_service.ImportProductSetsInputConfig): + input_config (google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -767,9 +767,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p3beta1.types.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[~.status.Status]): + statuses (Sequence[google.rpc.status_pb2.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -794,12 +794,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (~.product_search_service.BatchOperationMetadata.State): + state (google.cloud.vision_v1p3beta1.types.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (~.timestamp.Timestamp): + submit_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was submitted to the server. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. diff --git a/google/cloud/vision_v1p3beta1/types/text_annotation.py b/google/cloud/vision_v1p3beta1/types/text_annotation.py index e1252879..47423028 100644 --- a/google/cloud/vision_v1p3beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p3beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p3beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p3beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p3beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p3beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p3beta1.types.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p3beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p3beta1/types/web_detection.py b/google/cloud/vision_v1p3beta1/types/web_detection.py index 6a24d5c2..66587d99 100644 --- a/google/cloud/vision_v1p3beta1/types/web_detection.py +++ b/google/cloud/vision_v1p3beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py index 581f63bd..1a9f75e6 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py @@ -83,6 +83,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -160,12 +161,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -177,7 +179,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -239,14 +241,15 @@ async def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -258,7 +261,7 @@ async def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -323,18 +326,20 @@ async def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (:class:`google.cloud.vision_v1p4beta1.types.OutputConfig`): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -346,11 +351,11 @@ async def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -421,12 +426,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -438,11 +444,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py index 160e68ef..e8c0a293 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -365,12 +381,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -382,7 +399,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -442,14 +459,15 @@ def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -461,7 +479,7 @@ def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -524,18 +542,20 @@ def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -547,11 +567,11 @@ def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -622,12 +642,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -639,11 +660,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py index 1c50dd67..41e45889 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py @@ -109,6 +109,7 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) + from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -192,7 +193,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -200,10 +201,11 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p4beta1.types.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -214,6 +216,7 @@ async def create_product_set( 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -225,7 +228,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -298,7 +301,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -306,6 +309,7 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -317,8 +321,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsAsyncPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsAsyncPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -392,7 +396,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -400,6 +404,7 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -411,7 +416,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -486,20 +491,22 @@ async def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p4beta1.types.ProductSet`): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -511,7 +518,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -582,7 +589,7 @@ async def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -590,6 +597,7 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -668,7 +676,7 @@ async def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -676,10 +684,11 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p4beta1.types.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -690,6 +699,7 @@ async def create_product( 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -701,7 +711,7 @@ async def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -769,7 +779,7 @@ async def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -777,6 +787,7 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -788,8 +799,8 @@ async def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsAsyncPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsAsyncPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -863,7 +874,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -871,6 +882,7 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -882,7 +894,7 @@ async def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -959,22 +971,24 @@ async def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p4beta1.types.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -986,7 +1000,7 @@ async def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1054,7 +1068,7 @@ async def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1062,6 +1076,7 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1152,7 +1167,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1161,13 +1176,15 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (:class:`google.cloud.vision_v1p4beta1.types.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1177,6 +1194,7 @@ async def create_reference_image( 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1188,9 +1206,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1259,7 +1277,7 @@ async def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1269,6 +1287,7 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1342,7 +1361,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1351,6 +1370,7 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1362,8 +1382,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesAsyncPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1437,7 +1457,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1447,6 +1467,7 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1458,9 +1479,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1530,7 +1551,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1539,6 +1560,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1548,6 +1570,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1616,7 +1639,7 @@ async def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1625,6 +1648,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1634,6 +1658,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1708,7 +1733,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1717,6 +1742,7 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1728,8 +1754,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetAsyncPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1812,7 +1838,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1820,12 +1846,14 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (:class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig`): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1837,18 +1865,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -1943,7 +1971,7 @@ async def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. parent (:class:`str`): @@ -1951,6 +1979,7 @@ async def purge_products( should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1962,24 +1991,22 @@ async def purge_products( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/client.py b/google/cloud/vision_v1p4beta1/services/product_search/client.py index dc704e28..a61c9ab0 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/client.py @@ -135,6 +135,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProductSearchClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -147,7 +163,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProductSearchClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -292,10 +308,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ProductSearchTransport]): The + transport (Union[str, ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -412,28 +428,30 @@ def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.CreateProductSetRequest): The request object. Request message for the `CreateProductSet` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (:class:`str`): + product_set_id (str): 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -445,7 +463,7 @@ def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -513,14 +531,15 @@ def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): The request object. Request message for the `ListProductSets` method. - parent (:class:`str`): + parent (str): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -532,8 +551,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -600,14 +619,15 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.GetProductSetRequest): The request object. Request message for the `GetProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -619,7 +639,7 @@ def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -687,20 +707,22 @@ def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -712,7 +734,7 @@ def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -778,14 +800,15 @@ def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest): The request object. Request message for the `DeleteProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -857,28 +880,30 @@ def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (google.cloud.vision_v1p4beta1.types.CreateProductRequest): The request object. Request message for the `CreateProduct` method. - parent (:class:`str`): + parent (str): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (:class:`str`): + product_id (str): 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -890,7 +915,7 @@ def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -953,14 +978,15 @@ def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): The request object. Request message for the `ListProducts` method. - parent (:class:`str`): + parent (str): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -972,8 +998,8 @@ def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1040,14 +1066,15 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (google.cloud.vision_v1p4beta1.types.GetProductRequest): The request object. Request message for the `GetProduct` method. - name (:class:`str`): + name (str): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1059,7 +1086,7 @@ def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1129,22 +1156,24 @@ def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (google.cloud.vision_v1p4beta1.types.UpdateProductRequest): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1156,7 +1185,7 @@ def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1219,14 +1248,15 @@ def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (google.cloud.vision_v1p4beta1.types.DeleteProductRequest): The request object. Request message for the `DeleteProduct` method. - name (:class:`str`): + name (str): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1310,31 +1340,34 @@ def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest): The request object. Request message for the `CreateReferenceImage` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (google.cloud.vision_v1p4beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (:class:`str`): + reference_image_id (str): 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1346,9 +1379,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1412,16 +1445,17 @@ def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest): The request object. Request message for the `DeleteReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1488,15 +1522,16 @@ def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): The request object. Request message for the `ListReferenceImages` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1508,8 +1543,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1576,16 +1611,17 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest): The request object. Request message for the `GetReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1597,9 +1633,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1662,24 +1698,26 @@ def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest): The request object. Request message for the `AddProductToProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1747,24 +1785,26 @@ def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest): The request object. Request message for the `RemoveProductFromProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1838,15 +1878,16 @@ def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): The request object. Request message for the `ListProductsInProductSet` method. - name (:class:`str`): + name (str): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1858,8 +1899,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1939,20 +1980,22 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest): The request object. Request message for the `ImportProductSets` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1964,18 +2007,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -2065,14 +2108,15 @@ def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.PurgeProductsRequest): The request object. Request message for the `PurgeProducts` method. - parent (:class:`str`): + parent (str): Required. The project and location in which the Products should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2084,24 +2128,22 @@ def purge_products( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py index c3ac34cd..2c5d61b2 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1p4beta1/types/face.py b/google/cloud/vision_v1p4beta1/types/face.py index 34ca9aa9..89fbc30b 100644 --- a/google/cloud/vision_v1p4beta1/types/face.py +++ b/google/cloud/vision_v1p4beta1/types/face.py @@ -64,7 +64,7 @@ class FaceRecognitionResult(proto.Message): r"""Information about a face's identity. Attributes: - celebrity (~.face.Celebrity): + celebrity (google.cloud.vision_v1p4beta1.types.Celebrity): The [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] that this face was matched to. confidence (float): diff --git a/google/cloud/vision_v1p4beta1/types/geometry.py b/google/cloud/vision_v1p4beta1/types/geometry.py index 60c32e6e..b43c8d06 100644 --- a/google/cloud/vision_v1p4beta1/types/geometry.py +++ b/google/cloud/vision_v1p4beta1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p4beta1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1p4beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1p4beta1/types/image_annotator.py b/google/cloud/vision_v1p4beta1/types/image_annotator.py index 98788127..b4e3b321 100644 --- a/google/cloud/vision_v1p4beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p4beta1/types/image_annotator.py @@ -94,7 +94,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p4beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -177,7 +177,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p4beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -194,7 +194,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human @@ -202,7 +202,7 @@ class FaceAnnotation(proto.Message): that one or more x and/or y coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -210,7 +210,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p4beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -229,21 +229,21 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Headwear likelihood. - recognition_result (Sequence[~.face.FaceRecognitionResult]): + recognition_result (Sequence[google.cloud.vision_v1p4beta1.types.FaceRecognitionResult]): Additional recognition information. Only computed if image_context.face_recognition_params is provided, **and** a match is found to a @@ -258,9 +258,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p4beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p4beta1.types.Position): Face landmark position. """ @@ -351,7 +351,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -406,17 +406,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p4beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p4beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -456,7 +456,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -478,21 +478,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p4beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p4beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p4beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p4beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p4beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -516,9 +516,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -532,7 +532,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -552,7 +552,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p4beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -564,7 +564,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p4beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -579,7 +579,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale. @@ -602,7 +602,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p4beta1.types.CropHint]): Crop hint results. """ @@ -657,7 +657,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p4beta1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -670,15 +670,15 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p4beta1.types.CropHintsParams): Parameters for crop hints annotation request. - face_recognition_params (~.face.FaceRecognitionParams): + face_recognition_params (google.cloud.vision_v1p4beta1.types.FaceRecognitionParams): Parameters for face recognition. - product_search_params (~.product_search.ProductSearchParams): + product_search_params (google.cloud.vision_v1p4beta1.types.ProductSearchParams): Parameters for product search. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p4beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p4beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -712,11 +712,11 @@ class AnnotateImageRequest(proto.Message): context information. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p4beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p4beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -751,50 +751,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p4beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[google.cloud.vision_v1p4beta1.types.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p4beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p4beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p4beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p4beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p4beta1.types.WebDetection): If present, web detection has completed successfully. - product_search_results (~.product_search.ProductSearchResults): + product_search_results (google.cloud.vision_v1p4beta1.types.ProductSearchResults): If present, product search has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1p4beta1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -857,7 +857,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -871,7 +871,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -886,11 +886,11 @@ class AnnotateFileRequest(proto.Message): GIF file. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p4beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p4beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. pages (Sequence[int]): @@ -926,16 +926,16 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p4beta1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageResponse]): Individual responses to images found within the file. This field will be empty if the ``error`` field is set. total_pages (int): This field gives the total number of pages in the file. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the failed request. The ``responses`` field will not be set in this case. """ @@ -956,7 +956,7 @@ class BatchAnnotateFilesRequest(proto.Message): BatchAnnotateFiles API. Attributes: - requests (Sequence[~.image_annotator.AnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in @@ -972,7 +972,7 @@ class BatchAnnotateFilesResponse(proto.Message): r"""A list of file annotation responses. Attributes: - responses (Sequence[~.image_annotator.AnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileResponse]): The list of file annotation responses, each response corresponding to each AnnotateFileRequest in @@ -988,14 +988,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p4beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p4beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1013,7 +1013,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -1025,10 +1025,10 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): r"""Request for async image annotation for a list of images. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1044,7 +1044,7 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): r"""Response to an async batch image annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): The output location and metadata from AsyncBatchAnnotateImagesRequest. """ @@ -1057,7 +1057,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -1071,7 +1071,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -1086,7 +1086,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1p4beta1.types.GcsSource): The Google Cloud Storage location to read the input from. content (bytes): @@ -1114,7 +1114,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1p4beta1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1191,11 +1191,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1p4beta1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p4beta1/types/product_search.py b/google/cloud/vision_v1p4beta1/types/product_search.py index e16037c9..f0aa53b8 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search.py +++ b/google/cloud/vision_v1p4beta1/types/product_search.py @@ -33,7 +33,7 @@ class ProductSearchParams(proto.Message): r"""Parameters for a product search request. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon around the area of interest in the image. If it is not specified, system discretion will be applied. @@ -83,14 +83,14 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of the index which provided these results. Products added to the product set and products removed from the product set after this time are not reflected in the current results. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.Result]): List of results, one for each product match. - product_grouped_results (Sequence[~.product_search.ProductSearchResults.GroupedResult]): + product_grouped_results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.GroupedResult]): List of results grouped by products detected in the query image. Each entry corresponds to one bounding polygon in the query image, and @@ -103,7 +103,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p4beta1.types.Product): The Product. score (float): A confidence level on the match, ranging from @@ -151,12 +151,12 @@ class GroupedResult(proto.Message): a query image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon around the product detected in the query image. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.Result]): List of results, one for each product match. - object_annotations (Sequence[~.product_search.ProductSearchResults.ObjectAnnotation]): + object_annotations (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.ObjectAnnotation]): List of generic predictions for the object in the bounding box. """ diff --git a/google/cloud/vision_v1p4beta1/types/product_search_service.py b/google/cloud/vision_v1p4beta1/types/product_search_service.py index 598c868d..25df6719 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p4beta1/types/product_search_service.py @@ -87,7 +87,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[~.product_search_service.Product.KeyValue]): + product_labels (Sequence[google.cloud.vision_v1p4beta1.types.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -150,7 +150,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -160,7 +160,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (~.status.Status): + index_error (google.rpc.status_pb2.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -195,7 +195,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[~.geometry.BoundingPoly]): + bounding_polys (Sequence[google.cloud.vision_v1p4beta1.types.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -226,7 +226,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (~.product_search_service.Product): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -271,7 +271,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p4beta1.types.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -306,11 +306,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -345,7 +345,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -390,7 +390,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[~.product_search_service.ProductSet]): + product_sets (Sequence[google.cloud.vision_v1p4beta1.types.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -425,10 +425,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -464,7 +464,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (~.product_search_service.ReferenceImage): + reference_image (google.cloud.vision_v1p4beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -514,7 +514,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p4beta1.types.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -641,7 +641,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p4beta1.types.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -746,7 +746,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (~.product_search_service.ImportProductSetsGcsSource): + gcs_source (google.cloud.vision_v1p4beta1.types.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -766,7 +766,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (~.product_search_service.ImportProductSetsInputConfig): + input_config (google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -788,9 +788,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p4beta1.types.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[~.status.Status]): + statuses (Sequence[google.rpc.status_pb2.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -815,12 +815,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (~.product_search_service.BatchOperationMetadata.State): + state (google.cloud.vision_v1p4beta1.types.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (~.timestamp.Timestamp): + submit_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was submitted to the server. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. @@ -861,7 +861,7 @@ class PurgeProductsRequest(proto.Message): r"""Request message for the ``PurgeProducts`` method. Attributes: - product_set_purge_config (~.product_search_service.ProductSetPurgeConfig): + product_set_purge_config (google.cloud.vision_v1p4beta1.types.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. delete_orphan_products (bool): diff --git a/google/cloud/vision_v1p4beta1/types/text_annotation.py b/google/cloud/vision_v1p4beta1/types/text_annotation.py index 25c4f0c9..ee384d68 100644 --- a/google/cloud/vision_v1p4beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p4beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p4beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p4beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertex order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p4beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p4beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p4beta1.types.Word]): List of all words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p4beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p4beta1/types/web_detection.py b/google/cloud/vision_v1p4beta1/types/web_detection.py index 344fd0b0..c9efe25e 100644 --- a/google/cloud/vision_v1p4beta1/types/web_detection.py +++ b/google/cloud/vision_v1p4beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebLabel]): The service's best guess as to the topic of the request image. Inferred from similar images on the open web. @@ -98,10 +98,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/synth.metadata b/synth.metadata index 9cb7a306..252e855b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907", - "internalRef": "347055288" + "sha": "520682435235d9c503983a360a2090025aa47cd1", + "internalRef": "350246057" } }, { @@ -131,12 +131,19 @@ "docs/_templates/layout.html", "docs/conf.py", "docs/multiprocessing.rst", + "docs/vision_v1/image_annotator.rst", + "docs/vision_v1/product_search.rst", "docs/vision_v1/services.rst", "docs/vision_v1/types.rst", + "docs/vision_v1p2beta1/image_annotator.rst", "docs/vision_v1p2beta1/services.rst", "docs/vision_v1p2beta1/types.rst", + "docs/vision_v1p3beta1/image_annotator.rst", + "docs/vision_v1p3beta1/product_search.rst", "docs/vision_v1p3beta1/services.rst", "docs/vision_v1p3beta1/types.rst", + "docs/vision_v1p4beta1/image_annotator.rst", + "docs/vision_v1p4beta1/product_search.rst", "docs/vision_v1p4beta1/services.rst", "docs/vision_v1p4beta1/types.rst", "google/cloud/vision/__init__.py", diff --git a/tests/unit/gapic/vision_v1/test_image_annotator.py b/tests/unit/gapic/vision_v1/test_image_annotator.py index 7e39be07..58f82810 100644 --- a/tests/unit/gapic/vision_v1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1/test_image_annotator.py @@ -90,8 +90,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -110,7 +123,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -1383,7 +1399,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1395,7 +1411,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1420,7 +1436,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1476,7 +1492,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1/test_product_search.py b/tests/unit/gapic/vision_v1/test_product_search.py index 52c594c3..42a91e7a 100644 --- a/tests/unit/gapic/vision_v1/test_product_search.py +++ b/tests/unit/gapic/vision_v1/test_product_search.py @@ -93,8 +93,21 @@ def test__get_default_mtls_endpoint(): ) +def test_product_search_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProductSearchClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient] + "client_class", [ProductSearchClient, ProductSearchAsyncClient,] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -113,7 +126,10 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - assert transport == transports.ProductSearchGrpcTransport + available_transports = [ + transports.ProductSearchGrpcTransport, + ] + assert transport in available_transports transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -5365,7 +5381,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5377,7 +5393,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5400,7 +5416,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5456,7 +5472,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py index 4ee68cf4..8ac4ecea 100644 --- a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py @@ -86,8 +86,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -106,7 +119,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -801,7 +817,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -813,7 +829,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -838,7 +854,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -894,7 +910,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py index 3527d957..600529d0 100644 --- a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py @@ -90,8 +90,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -110,7 +123,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -999,7 +1015,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1011,7 +1027,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1036,7 +1052,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1092,7 +1108,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py index a2afe4ad..00d38c6c 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py @@ -92,8 +92,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -112,7 +125,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -1001,7 +1017,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1013,7 +1029,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1038,7 +1054,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1094,7 +1110,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py index af66ff8b..9a5e4c64 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py @@ -95,8 +95,21 @@ def test__get_default_mtls_endpoint(): ) +def test_product_search_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProductSearchClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient] + "client_class", [ProductSearchClient, ProductSearchAsyncClient,] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -115,7 +128,10 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - assert transport == transports.ProductSearchGrpcTransport + available_transports = [ + transports.ProductSearchGrpcTransport, + ] + assert transport in available_transports transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -5179,7 +5195,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5191,7 +5207,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5214,7 +5230,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5270,7 +5286,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py index 2a8d5072..1724862d 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py @@ -93,8 +93,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -113,7 +126,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -1386,7 +1402,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1398,7 +1414,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1423,7 +1439,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1479,7 +1495,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py index 0ad20e9a..c95e6fc0 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py @@ -95,8 +95,21 @@ def test__get_default_mtls_endpoint(): ) +def test_product_search_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProductSearchClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient] + "client_class", [ProductSearchClient, ProductSearchAsyncClient,] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -115,7 +128,10 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - assert transport == transports.ProductSearchGrpcTransport + available_transports = [ + transports.ProductSearchGrpcTransport, + ] + assert transport in available_transports transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -5367,7 +5383,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5379,7 +5395,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5402,7 +5418,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5458,7 +5474,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel From 3a6da18ddc514e4517849ddba6fb260419354f1e Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:51:47 -0800 Subject: [PATCH 04/11] feat: added V1 API Clients should now be able to use the v1 API in addition to the v1beta2 API. PiperOrigin-RevId: 351871554 Source-Author: Google APIs Source-Date: Thu Jan 14 13:58:57 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: add7e03ec4fff3491f6d3c007a36bcdf90408577 Source-Link: https://github.com/googleapis/googleapis/commit/add7e03ec4fff3491f6d3c007a36bcdf90408577 --- google/cloud/vision_v1/__init__.py | 4 ++-- google/cloud/vision_v1p3beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/vision_v1/__init__.py b/google/cloud/vision_v1/__init__.py index 8b1d075a..df7114a8 100644 --- a/google/cloud/vision_v1/__init__.py +++ b/google/cloud/vision_v1/__init__.py @@ -152,7 +152,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -180,6 +179,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -198,5 +198,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index c00754cf..b38431b4 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,7 +143,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -173,6 +172,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/synth.metadata b/synth.metadata index 252e855b..fc28c011 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "520682435235d9c503983a360a2090025aa47cd1", - "internalRef": "350246057" + "sha": "add7e03ec4fff3491f6d3c007a36bcdf90408577", + "internalRef": "351871554" } }, { From 9a4612f717f82828939ac5402c46051a3c4b2df1 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:54:03 -0800 Subject: [PATCH 05/11] chore: update Go generator, rules_go, and protobuf PiperOrigin-RevId: 352816749 Source-Author: Google APIs Source-Date: Wed Jan 20 10:06:23 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: ceaaf31b3d13badab7cf9d3b570f5639db5593d9 Source-Link: https://github.com/googleapis/googleapis/commit/ceaaf31b3d13badab7cf9d3b570f5639db5593d9 --- .kokoro/test-samples.sh | 8 +- .kokoro/trampoline_v2.sh | 2 +- docs/vision_v1/image_annotator.rst | 6 - docs/vision_v1/product_search.rst | 11 - docs/vision_v1/services.rst | 10 +- docs/vision_v1/types.rst | 1 - docs/vision_v1p2beta1/image_annotator.rst | 6 - docs/vision_v1p2beta1/services.rst | 6 +- docs/vision_v1p2beta1/types.rst | 1 - docs/vision_v1p3beta1/image_annotator.rst | 6 - docs/vision_v1p3beta1/product_search.rst | 11 - docs/vision_v1p3beta1/services.rst | 10 +- docs/vision_v1p3beta1/types.rst | 1 - docs/vision_v1p4beta1/image_annotator.rst | 6 - docs/vision_v1p4beta1/product_search.rst | 11 - docs/vision_v1p4beta1/services.rst | 10 +- docs/vision_v1p4beta1/types.rst | 1 - google/cloud/vision_v1/__init__.py | 4 +- .../services/image_annotator/async_client.py | 36 ++- .../services/image_annotator/client.py | 57 ++--- .../services/product_search/async_client.py | 163 ++++++------- .../services/product_search/client.py | 228 +++++++----------- .../services/product_search/pagers.py | 64 ++--- google/cloud/vision_v1/types/geometry.py | 4 +- .../cloud/vision_v1/types/image_annotator.py | 156 ++++++------ .../cloud/vision_v1/types/product_search.py | 16 +- .../vision_v1/types/product_search_service.py | 46 ++-- .../cloud/vision_v1/types/text_annotation.py | 36 +-- google/cloud/vision_v1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 8 +- .../services/image_annotator/client.py | 29 +-- .../cloud/vision_v1p1beta1/types/geometry.py | 2 +- .../vision_v1p1beta1/types/image_annotator.py | 100 ++++---- .../vision_v1p1beta1/types/text_annotation.py | 36 +-- .../vision_v1p1beta1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 17 +- .../services/image_annotator/client.py | 38 +-- .../cloud/vision_v1p2beta1/types/geometry.py | 4 +- .../vision_v1p2beta1/types/image_annotator.py | 130 +++++----- .../vision_v1p2beta1/types/text_annotation.py | 36 +-- .../vision_v1p2beta1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 17 +- .../services/image_annotator/client.py | 38 +-- .../services/product_search/async_client.py | 138 +++++------ .../services/product_search/client.py | 201 ++++++--------- .../services/product_search/pagers.py | 64 ++--- .../cloud/vision_v1p3beta1/types/geometry.py | 6 +- .../vision_v1p3beta1/types/image_annotator.py | 138 +++++------ .../vision_v1p3beta1/types/product_search.py | 18 +- .../types/product_search_service.py | 44 ++-- .../vision_v1p3beta1/types/text_annotation.py | 36 +-- .../vision_v1p3beta1/types/web_detection.py | 16 +- google/cloud/vision_v1p4beta1/__init__.py | 4 +- .../services/image_annotator/async_client.py | 36 ++- .../services/image_annotator/client.py | 57 ++--- .../services/product_search/async_client.py | 163 ++++++------- .../services/product_search/client.py | 228 +++++++----------- .../services/product_search/pagers.py | 64 ++--- google/cloud/vision_v1p4beta1/types/face.py | 2 +- .../cloud/vision_v1p4beta1/types/geometry.py | 4 +- .../vision_v1p4beta1/types/image_annotator.py | 160 ++++++------ .../vision_v1p4beta1/types/product_search.py | 16 +- .../types/product_search_service.py | 46 ++-- .../vision_v1p4beta1/types/text_annotation.py | 36 +-- .../vision_v1p4beta1/types/web_detection.py | 16 +- synth.metadata | 13 +- .../gapic/vision_v1/test_image_annotator.py | 28 +-- .../gapic/vision_v1/test_product_search.py | 28 +-- .../vision_v1p1beta1/test_image_annotator.py | 28 +-- .../vision_v1p2beta1/test_image_annotator.py | 28 +-- .../vision_v1p3beta1/test_image_annotator.py | 28 +-- .../vision_v1p3beta1/test_product_search.py | 28 +-- .../vision_v1p4beta1/test_image_annotator.py | 28 +-- .../vision_v1p4beta1/test_product_search.py | 28 +-- 74 files changed, 1318 insertions(+), 1832 deletions(-) delete mode 100644 docs/vision_v1/image_annotator.rst delete mode 100644 docs/vision_v1/product_search.rst delete mode 100644 docs/vision_v1p2beta1/image_annotator.rst delete mode 100644 docs/vision_v1p3beta1/image_annotator.rst delete mode 100644 docs/vision_v1p3beta1/product_search.rst delete mode 100644 docs/vision_v1p4beta1/image_annotator.rst delete mode 100644 docs/vision_v1p4beta1/product_search.rst diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index b6bc8297..ec890026 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do python3.6 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? - # If this is a periodic build, send the test log to the Build Cop Bot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. + # If this is a periodic build, send the test log to the FlakyBot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop - $KOKORO_GFILE_DIR/linux_amd64/buildcop + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot fi if [[ $EXIT -ne 0 ]]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 719bcd5b..4af6cdc2 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then "KOKORO_GITHUB_COMMIT" "KOKORO_GITHUB_PULL_REQUEST_NUMBER" "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For Build Cop Bot + # For FlakyBot "KOKORO_GITHUB_COMMIT_URL" "KOKORO_GITHUB_PULL_REQUEST_URL" ) diff --git a/docs/vision_v1/image_annotator.rst b/docs/vision_v1/image_annotator.rst deleted file mode 100644 index 83130a76..00000000 --- a/docs/vision_v1/image_annotator.rst +++ /dev/null @@ -1,6 +0,0 @@ -ImageAnnotator --------------------------------- - -.. automodule:: google.cloud.vision_v1.services.image_annotator - :members: - :inherited-members: diff --git a/docs/vision_v1/product_search.rst b/docs/vision_v1/product_search.rst deleted file mode 100644 index 64e5cd02..00000000 --- a/docs/vision_v1/product_search.rst +++ /dev/null @@ -1,11 +0,0 @@ -ProductSearch -------------------------------- - -.. automodule:: google.cloud.vision_v1.services.product_search - :members: - :inherited-members: - - -.. automodule:: google.cloud.vision_v1.services.product_search.pagers - :members: - :inherited-members: diff --git a/docs/vision_v1/services.rst b/docs/vision_v1/services.rst index 5fe11bc5..0331ec53 100644 --- a/docs/vision_v1/services.rst +++ b/docs/vision_v1/services.rst @@ -1,7 +1,9 @@ Services for Google Cloud Vision v1 API ======================================= -.. toctree:: - :maxdepth: 2 - image_annotator - product_search +.. automodule:: google.cloud.vision_v1.services.image_annotator + :members: + :inherited-members: +.. automodule:: google.cloud.vision_v1.services.product_search + :members: + :inherited-members: diff --git a/docs/vision_v1/types.rst b/docs/vision_v1/types.rst index 52d9869b..dbbb594c 100644 --- a/docs/vision_v1/types.rst +++ b/docs/vision_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Vision v1 API .. automodule:: google.cloud.vision_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p2beta1/image_annotator.rst b/docs/vision_v1p2beta1/image_annotator.rst deleted file mode 100644 index d05fd549..00000000 --- a/docs/vision_v1p2beta1/image_annotator.rst +++ /dev/null @@ -1,6 +0,0 @@ -ImageAnnotator --------------------------------- - -.. automodule:: google.cloud.vision_v1p2beta1.services.image_annotator - :members: - :inherited-members: diff --git a/docs/vision_v1p2beta1/services.rst b/docs/vision_v1p2beta1/services.rst index 2272ceb5..55dc030c 100644 --- a/docs/vision_v1p2beta1/services.rst +++ b/docs/vision_v1p2beta1/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Vision v1p2beta1 API ============================================== -.. toctree:: - :maxdepth: 2 - image_annotator +.. automodule:: google.cloud.vision_v1p2beta1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1p2beta1/types.rst b/docs/vision_v1p2beta1/types.rst index 33ab32e0..898a797f 100644 --- a/docs/vision_v1p2beta1/types.rst +++ b/docs/vision_v1p2beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Vision v1p2beta1 API .. automodule:: google.cloud.vision_v1p2beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p3beta1/image_annotator.rst b/docs/vision_v1p3beta1/image_annotator.rst deleted file mode 100644 index a5ed7542..00000000 --- a/docs/vision_v1p3beta1/image_annotator.rst +++ /dev/null @@ -1,6 +0,0 @@ -ImageAnnotator --------------------------------- - -.. automodule:: google.cloud.vision_v1p3beta1.services.image_annotator - :members: - :inherited-members: diff --git a/docs/vision_v1p3beta1/product_search.rst b/docs/vision_v1p3beta1/product_search.rst deleted file mode 100644 index fd321a60..00000000 --- a/docs/vision_v1p3beta1/product_search.rst +++ /dev/null @@ -1,11 +0,0 @@ -ProductSearch -------------------------------- - -.. automodule:: google.cloud.vision_v1p3beta1.services.product_search - :members: - :inherited-members: - - -.. automodule:: google.cloud.vision_v1p3beta1.services.product_search.pagers - :members: - :inherited-members: diff --git a/docs/vision_v1p3beta1/services.rst b/docs/vision_v1p3beta1/services.rst index 06da9b3d..591da113 100644 --- a/docs/vision_v1p3beta1/services.rst +++ b/docs/vision_v1p3beta1/services.rst @@ -1,7 +1,9 @@ Services for Google Cloud Vision v1p3beta1 API ============================================== -.. toctree:: - :maxdepth: 2 - image_annotator - product_search +.. automodule:: google.cloud.vision_v1p3beta1.services.image_annotator + :members: + :inherited-members: +.. automodule:: google.cloud.vision_v1p3beta1.services.product_search + :members: + :inherited-members: diff --git a/docs/vision_v1p3beta1/types.rst b/docs/vision_v1p3beta1/types.rst index 5fdbaea1..8f60a298 100644 --- a/docs/vision_v1p3beta1/types.rst +++ b/docs/vision_v1p3beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Vision v1p3beta1 API .. automodule:: google.cloud.vision_v1p3beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p4beta1/image_annotator.rst b/docs/vision_v1p4beta1/image_annotator.rst deleted file mode 100644 index 28717262..00000000 --- a/docs/vision_v1p4beta1/image_annotator.rst +++ /dev/null @@ -1,6 +0,0 @@ -ImageAnnotator --------------------------------- - -.. automodule:: google.cloud.vision_v1p4beta1.services.image_annotator - :members: - :inherited-members: diff --git a/docs/vision_v1p4beta1/product_search.rst b/docs/vision_v1p4beta1/product_search.rst deleted file mode 100644 index e46b54b0..00000000 --- a/docs/vision_v1p4beta1/product_search.rst +++ /dev/null @@ -1,11 +0,0 @@ -ProductSearch -------------------------------- - -.. automodule:: google.cloud.vision_v1p4beta1.services.product_search - :members: - :inherited-members: - - -.. automodule:: google.cloud.vision_v1p4beta1.services.product_search.pagers - :members: - :inherited-members: diff --git a/docs/vision_v1p4beta1/services.rst b/docs/vision_v1p4beta1/services.rst index 2ebd0bbc..e8da2e62 100644 --- a/docs/vision_v1p4beta1/services.rst +++ b/docs/vision_v1p4beta1/services.rst @@ -1,7 +1,9 @@ Services for Google Cloud Vision v1p4beta1 API ============================================== -.. toctree:: - :maxdepth: 2 - image_annotator - product_search +.. automodule:: google.cloud.vision_v1p4beta1.services.image_annotator + :members: + :inherited-members: +.. automodule:: google.cloud.vision_v1p4beta1.services.product_search + :members: + :inherited-members: diff --git a/docs/vision_v1p4beta1/types.rst b/docs/vision_v1p4beta1/types.rst index a90d1fa2..214f01b1 100644 --- a/docs/vision_v1p4beta1/types.rst +++ b/docs/vision_v1p4beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Vision v1p4beta1 API .. automodule:: google.cloud.vision_v1p4beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/google/cloud/vision_v1/__init__.py b/google/cloud/vision_v1/__init__.py index df7114a8..8b1d075a 100644 --- a/google/cloud/vision_v1/__init__.py +++ b/google/cloud/vision_v1/__init__.py @@ -152,6 +152,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -179,7 +180,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -198,5 +198,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/google/cloud/vision_v1/services/image_annotator/async_client.py b/google/cloud/vision_v1/services/image_annotator/async_client.py index 8dc41443..f441e263 100644 --- a/google/cloud/vision_v1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1/services/image_annotator/async_client.py @@ -83,7 +83,6 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) - from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -161,13 +160,12 @@ async def batch_annotate_images( images. Args: - request (:class:`google.cloud.vision_v1.types.BatchAnnotateImagesRequest`): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -179,7 +177,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -243,15 +241,14 @@ async def batch_annotate_files( extracted. Args: - request (:class:`google.cloud.vision_v1.types.BatchAnnotateFilesRequest`): + request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -263,7 +260,7 @@ async def batch_annotate_files( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.BatchAnnotateFilesResponse: + ~.image_annotator.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -330,20 +327,18 @@ async def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest`): + request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`google.cloud.vision_v1.types.OutputConfig`): + output_config (:class:`~.image_annotator.OutputConfig`): Required. The desired output location and metadata (e.g. format). - This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -355,11 +350,11 @@ async def async_batch_annotate_images( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: Response to an async batch image annotation request. """ @@ -432,13 +427,12 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest`): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -450,11 +444,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1/services/image_annotator/client.py b/google/cloud/vision_v1/services/image_annotator/client.py index 8ca6b81f..cd963a34 100644 --- a/google/cloud/vision_v1/services/image_annotator/client.py +++ b/google/cloud/vision_v1/services/image_annotator/client.py @@ -115,22 +115,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ImageAnnotatorClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -143,7 +127,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ImageAnnotatorClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -267,10 +251,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ImageAnnotatorTransport]): The + transport (Union[str, ~.ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -381,13 +365,12 @@ def batch_annotate_images( images. Args: - request (google.cloud.vision_v1.types.BatchAnnotateImagesRequest): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -399,7 +382,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -459,15 +442,14 @@ def batch_annotate_files( extracted. Args: - request (google.cloud.vision_v1.types.BatchAnnotateFilesRequest): + request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -479,7 +461,7 @@ def batch_annotate_files( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.BatchAnnotateFilesResponse: + ~.image_annotator.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -542,20 +524,18 @@ def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest): + request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (google.cloud.vision_v1.types.OutputConfig): + output_config (:class:`~.image_annotator.OutputConfig`): Required. The desired output location and metadata (e.g. format). - This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -567,11 +547,11 @@ def async_batch_annotate_images( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: Response to an async batch image annotation request. """ @@ -642,13 +622,12 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -660,11 +639,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1/services/product_search/async_client.py b/google/cloud/vision_v1/services/product_search/async_client.py index 4535cd22..11b5e016 100644 --- a/google/cloud/vision_v1/services/product_search/async_client.py +++ b/google/cloud/vision_v1/services/product_search/async_client.py @@ -107,7 +107,6 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) - from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -191,7 +190,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`google.cloud.vision_v1.types.CreateProductSetRequest`): + request (:class:`~.product_search_service.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -199,11 +198,10 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`google.cloud.vision_v1.types.ProductSet`): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -214,7 +212,6 @@ async def create_product_set( 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 ``/``. - This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -226,7 +223,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -299,7 +296,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`google.cloud.vision_v1.types.ListProductSetsRequest`): + request (:class:`~.product_search_service.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -307,7 +304,6 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -319,8 +315,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager: - Response message for the ListProductSets method. + ~.pagers.ListProductSetsAsyncPager: + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -394,7 +390,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`google.cloud.vision_v1.types.GetProductSetRequest`): + request (:class:`~.product_search_service.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -402,7 +398,6 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -414,7 +409,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -489,22 +484,20 @@ async def update_product_set( characters. Args: - request (:class:`google.cloud.vision_v1.types.UpdateProductSetRequest`): + request (:class:`~.product_search_service.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`google.cloud.vision_v1.types.ProductSet`): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet resource which replaces the one on the server. - This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -516,7 +509,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -589,7 +582,7 @@ async def delete_product_set( Storage. Args: - request (:class:`google.cloud.vision_v1.types.DeleteProductSetRequest`): + request (:class:`~.product_search_service.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -597,7 +590,6 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -676,7 +668,7 @@ async def create_product( invalid. Args: - request (:class:`google.cloud.vision_v1.types.CreateProductRequest`): + request (:class:`~.product_search_service.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -684,11 +676,10 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`google.cloud.vision_v1.types.Product`): + product (:class:`~.product_search_service.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -699,7 +690,6 @@ async def create_product( 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 ``/``. - This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -711,7 +701,7 @@ async def create_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -779,7 +769,7 @@ async def list_products( less than 1. Args: - request (:class:`google.cloud.vision_v1.types.ListProductsRequest`): + request (:class:`~.product_search_service.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -787,7 +777,6 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -799,8 +788,8 @@ async def list_products( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager: - Response message for the ListProducts method. + ~.pagers.ListProductsAsyncPager: + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -874,7 +863,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`google.cloud.vision_v1.types.GetProductRequest`): + request (:class:`~.product_search_service.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -882,7 +871,6 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -894,7 +882,7 @@ async def get_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -971,24 +959,22 @@ async def update_product( update_mask. Args: - request (:class:`google.cloud.vision_v1.types.UpdateProductRequest`): + request (:class:`~.product_search_service.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`google.cloud.vision_v1.types.Product`): + product (:class:`~.product_search_service.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1000,7 +986,7 @@ async def update_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1070,7 +1056,7 @@ async def delete_product( all related caches are refreshed. Args: - request (:class:`google.cloud.vision_v1.types.DeleteProductRequest`): + request (:class:`~.product_search_service.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1078,7 +1064,6 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1169,7 +1154,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`google.cloud.vision_v1.types.CreateReferenceImageRequest`): + request (:class:`~.product_search_service.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1178,15 +1163,13 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`google.cloud.vision_v1.types.ReferenceImage`): + reference_image (:class:`~.product_search_service.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. - This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1196,7 +1179,6 @@ async def create_reference_image( 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 ``/``. - This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1208,9 +1190,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1279,7 +1261,7 @@ async def delete_reference_image( Storage. Args: - request (:class:`google.cloud.vision_v1.types.DeleteReferenceImageRequest`): + request (:class:`~.product_search_service.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1289,7 +1271,6 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1363,7 +1344,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`google.cloud.vision_v1.types.ListReferenceImagesRequest`): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1372,7 +1353,6 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1384,8 +1364,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager: - Response message for the ListReferenceImages method. + ~.pagers.ListReferenceImagesAsyncPager: + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1459,7 +1439,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`google.cloud.vision_v1.types.GetReferenceImageRequest`): + request (:class:`~.product_search_service.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1469,7 +1449,6 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1481,9 +1460,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1553,7 +1532,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`google.cloud.vision_v1.types.AddProductToProductSetRequest`): + request (:class:`~.product_search_service.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1562,7 +1541,6 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1572,7 +1550,6 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1643,7 +1620,7 @@ async def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`google.cloud.vision_v1.types.RemoveProductFromProductSetRequest`): + request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1652,7 +1629,6 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1662,7 +1638,6 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1739,7 +1714,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`google.cloud.vision_v1.types.ListProductsInProductSetRequest`): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1748,7 +1723,6 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1760,8 +1734,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager: - Response message for the ListProductsInProductSet + ~.pagers.ListProductsInProductSetAsyncPager: + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and @@ -1844,7 +1818,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`google.cloud.vision_v1.types.ImportProductSetsRequest`): + request (:class:`~.product_search_service.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1852,14 +1826,12 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`google.cloud.vision_v1.types.ImportProductSetsInputConfig`): + input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): Required. The input content for the list of requests. - This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1871,18 +1843,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:``~.product_search_service.ImportProductSetsResponse``: + Response message for the ``ImportProductSets`` method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -1977,7 +1949,7 @@ async def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`google.cloud.vision_v1.types.PurgeProductsRequest`): + request (:class:`~.product_search_service.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. parent (:class:`str`): @@ -1985,7 +1957,6 @@ async def purge_products( should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1997,22 +1968,24 @@ async def purge_products( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); + :: - } + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } - The JSON representation for Empty is empty JSON - object {}. + The JSON representation for ``Empty`` is empty JSON + object ``{}``. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1/services/product_search/client.py b/google/cloud/vision_v1/services/product_search/client.py index 92d6b652..b79cb3da 100644 --- a/google/cloud/vision_v1/services/product_search/client.py +++ b/google/cloud/vision_v1/services/product_search/client.py @@ -133,22 +133,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProductSearchClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -161,7 +145,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ProductSearchClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -306,10 +290,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ProductSearchTransport]): The + transport (Union[str, ~.ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -426,30 +410,28 @@ def create_product_set( longer than 4096 characters. Args: - request (google.cloud.vision_v1.types.CreateProductSetRequest): + request (:class:`~.product_search_service.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. - parent (str): + parent (:class:`str`): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (google.cloud.vision_v1.types.ProductSet): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (str): + product_set_id (:class:`str`): 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 ``/``. - This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -461,7 +443,7 @@ def create_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -529,15 +511,14 @@ def list_product_sets( less than 1. Args: - request (google.cloud.vision_v1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. - parent (str): + parent (:class:`str`): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -549,8 +530,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager: - Response message for the ListProductSets method. + ~.pagers.ListProductSetsPager: + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -617,15 +598,14 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (google.cloud.vision_v1.types.GetProductSetRequest): + request (:class:`~.product_search_service.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. - name (str): + name (:class:`str`): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -637,7 +617,7 @@ def get_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -705,22 +685,20 @@ def update_product_set( characters. Args: - request (google.cloud.vision_v1.types.UpdateProductSetRequest): + request (:class:`~.product_search_service.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (google.cloud.vision_v1.types.ProductSet): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet resource which replaces the one on the server. - This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -732,7 +710,7 @@ def update_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -798,15 +776,14 @@ def delete_product_set( Storage. Args: - request (google.cloud.vision_v1.types.DeleteProductSetRequest): + request (:class:`~.product_search_service.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. - name (str): + name (:class:`str`): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -878,30 +855,28 @@ def create_product( invalid. Args: - request (google.cloud.vision_v1.types.CreateProductRequest): + request (:class:`~.product_search_service.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. - parent (str): + parent (:class:`str`): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (google.cloud.vision_v1.types.Product): + product (:class:`~.product_search_service.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (str): + product_id (:class:`str`): 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 ``/``. - This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -913,7 +888,7 @@ def create_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -976,15 +951,14 @@ def list_products( less than 1. Args: - request (google.cloud.vision_v1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The request object. Request message for the `ListProducts` method. - parent (str): + parent (:class:`str`): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -996,8 +970,8 @@ def list_products( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListProductsPager: - Response message for the ListProducts method. + ~.pagers.ListProductsPager: + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1064,15 +1038,14 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (google.cloud.vision_v1.types.GetProductRequest): + request (:class:`~.product_search_service.GetProductRequest`): The request object. Request message for the `GetProduct` method. - name (str): + name (:class:`str`): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1084,7 +1057,7 @@ def get_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1154,24 +1127,22 @@ def update_product( update_mask. Args: - request (google.cloud.vision_v1.types.UpdateProductRequest): + request (:class:`~.product_search_service.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (google.cloud.vision_v1.types.Product): + product (:class:`~.product_search_service.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1183,7 +1154,7 @@ def update_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1246,15 +1217,14 @@ def delete_product( all related caches are refreshed. Args: - request (google.cloud.vision_v1.types.DeleteProductRequest): + request (:class:`~.product_search_service.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. - name (str): + name (:class:`str`): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1338,34 +1308,31 @@ def create_reference_image( 10 polygons. Args: - request (google.cloud.vision_v1.types.CreateReferenceImageRequest): + request (:class:`~.product_search_service.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. - parent (str): + parent (:class:`str`): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (google.cloud.vision_v1.types.ReferenceImage): + reference_image (:class:`~.product_search_service.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. - This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (str): + reference_image_id (:class:`str`): 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 ``/``. - This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1377,9 +1344,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1443,17 +1410,16 @@ def delete_reference_image( Storage. Args: - request (google.cloud.vision_v1.types.DeleteReferenceImageRequest): + request (:class:`~.product_search_service.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. - name (str): + name (:class:`str`): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1520,16 +1486,15 @@ def list_reference_images( 100, or less than 1. Args: - request (google.cloud.vision_v1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. - parent (str): + parent (:class:`str`): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1541,8 +1506,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager: - Response message for the ListReferenceImages method. + ~.pagers.ListReferenceImagesPager: + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1609,17 +1574,16 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (google.cloud.vision_v1.types.GetReferenceImageRequest): + request (:class:`~.product_search_service.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. - name (str): + name (:class:`str`): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1631,9 +1595,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1696,26 +1660,24 @@ def add_product_to_product_set( exist. Args: - request (google.cloud.vision_v1.types.AddProductToProductSetRequest): + request (:class:`~.product_search_service.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. - name (str): + name (:class:`str`): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (str): + product (:class:`str`): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1783,26 +1745,24 @@ def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (google.cloud.vision_v1.types.RemoveProductFromProductSetRequest): + request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. - name (str): + name (:class:`str`): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (str): + product (:class:`str`): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1876,16 +1836,15 @@ def list_products_in_product_set( less than 1. Args: - request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. - name (str): + name (:class:`str`): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1897,8 +1856,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager: - Response message for the ListProductsInProductSet + ~.pagers.ListProductsInProductSetPager: + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and @@ -1978,22 +1937,20 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (google.cloud.vision_v1.types.ImportProductSetsRequest): + request (:class:`~.product_search_service.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. - parent (str): + parent (:class:`str`): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (google.cloud.vision_v1.types.ImportProductSetsInputConfig): + input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): Required. The input content for the list of requests. - This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2005,18 +1962,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:``~.product_search_service.ImportProductSetsResponse``: + Response message for the ``ImportProductSets`` method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -2106,15 +2063,14 @@ def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (google.cloud.vision_v1.types.PurgeProductsRequest): + request (:class:`~.product_search_service.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. - parent (str): + parent (:class:`str`): Required. The project and location in which the Products should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2126,22 +2082,24 @@ def purge_products( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); + :: - } + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } - The JSON representation for Empty is empty JSON - object {}. + The JSON representation for ``Empty`` is empty JSON + object ``{}``. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1/services/product_search/pagers.py b/google/cloud/vision_v1/services/product_search/pagers.py index cf8c6a00..69bc017f 100644 --- a/google/cloud/vision_v1/services/product_search/pagers.py +++ b/google/cloud/vision_v1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListProductSetsResponse` object, and + :class:`~.product_search_service.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListProductSetsResponse` + All the usual :class:`~.product_search_service.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListProductSetsResponse): + response (:class:`~.product_search_service.ListProductSetsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListProductSetsResponse` object, and + :class:`~.product_search_service.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListProductSetsResponse` + All the usual :class:`~.product_search_service.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListProductSetsResponse): + response (:class:`~.product_search_service.ListProductSetsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListProductsResponse` object, and + :class:`~.product_search_service.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListProductsResponse` + All the usual :class:`~.product_search_service.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListProductsResponse): + response (:class:`~.product_search_service.ListProductsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListProductsResponse` object, and + :class:`~.product_search_service.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListProductsResponse` + All the usual :class:`~.product_search_service.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListProductsResponse): + response (:class:`~.product_search_service.ListProductsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` object, and + :class:`~.product_search_service.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` + All the usual :class:`~.product_search_service.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListReferenceImagesResponse): + response (:class:`~.product_search_service.ListReferenceImagesResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` object, and + :class:`~.product_search_service.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` + All the usual :class:`~.product_search_service.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListReferenceImagesResponse): + response (:class:`~.product_search_service.ListReferenceImagesResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` object, and + :class:`~.product_search_service.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` + All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListProductsInProductSetResponse): + response (:class:`~.product_search_service.ListProductsInProductSetResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` object, and + :class:`~.product_search_service.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` + All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The initial request object. - response (google.cloud.vision_v1.types.ListProductsInProductSetResponse): + response (:class:`~.product_search_service.ListProductsInProductSetResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1/types/geometry.py b/google/cloud/vision_v1/types/geometry.py index 05db4f69..be6f5602 100644 --- a/google/cloud/vision_v1/types/geometry.py +++ b/google/cloud/vision_v1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.vision_v1.types.Vertex]): + vertices (Sequence[~.geometry.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[google.cloud.vision_v1.types.NormalizedVertex]): + normalized_vertices (Sequence[~.geometry.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1/types/image_annotator.py b/google/cloud/vision_v1/types/image_annotator.py index 4f901266..462baf72 100644 --- a/google/cloud/vision_v1/types/image_annotator.py +++ b/google/cloud/vision_v1/types/image_annotator.py @@ -93,7 +93,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (google.cloud.vision_v1.types.Feature.Type): + type_ (~.image_annotator.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -176,7 +176,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (google.cloud.vision_v1.types.ImageSource): + source (~.image_annotator.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -193,7 +193,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (google.cloud.vision_v1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human @@ -201,7 +201,7 @@ class FaceAnnotation(proto.Message): that one or more x and/or y coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (google.cloud.vision_v1.types.BoundingPoly): + fd_bounding_poly (~.geometry.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -209,7 +209,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[google.cloud.vision_v1.types.FaceAnnotation.Landmark]): + landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -228,19 +228,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (google.cloud.vision_v1.types.Likelihood): + joy_likelihood (~.image_annotator.Likelihood): Joy likelihood. - sorrow_likelihood (google.cloud.vision_v1.types.Likelihood): + sorrow_likelihood (~.image_annotator.Likelihood): Sorrow likelihood. - anger_likelihood (google.cloud.vision_v1.types.Likelihood): + anger_likelihood (~.image_annotator.Likelihood): Anger likelihood. - surprise_likelihood (google.cloud.vision_v1.types.Likelihood): + surprise_likelihood (~.image_annotator.Likelihood): Surprise likelihood. - under_exposed_likelihood (google.cloud.vision_v1.types.Likelihood): + under_exposed_likelihood (~.image_annotator.Likelihood): Under-exposed likelihood. - blurred_likelihood (google.cloud.vision_v1.types.Likelihood): + blurred_likelihood (~.image_annotator.Likelihood): Blurred likelihood. - headwear_likelihood (google.cloud.vision_v1.types.Likelihood): + headwear_likelihood (~.image_annotator.Likelihood): Headwear likelihood. """ @@ -248,9 +248,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (google.cloud.vision_v1.types.FaceAnnotation.Landmark.Type): + type_ (~.image_annotator.FaceAnnotation.Landmark.Type): Face landmark type. - position (google.cloud.vision_v1.types.Position): + position (~.geometry.Position): Face landmark position. """ @@ -337,7 +337,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): lat/long location coordinates. """ @@ -392,17 +392,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (google.cloud.vision_v1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[google.cloud.vision_v1.types.LocationInfo]): + locations (Sequence[~.image_annotator.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[google.cloud.vision_v1.types.Property]): + properties (Sequence[~.image_annotator.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -442,7 +442,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (google.cloud.vision_v1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -464,21 +464,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (google.cloud.vision_v1.types.Likelihood): + adult (~.image_annotator.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (google.cloud.vision_v1.types.Likelihood): + spoof (~.image_annotator.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (google.cloud.vision_v1.types.Likelihood): + medical (~.image_annotator.Likelihood): Likelihood that this is a medical image. - violence (google.cloud.vision_v1.types.Likelihood): + violence (~.image_annotator.Likelihood): Likelihood that this image contains violent content. - racy (google.cloud.vision_v1.types.Likelihood): + racy (~.image_annotator.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -532,9 +532,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (google.type.latlng_pb2.LatLng): + min_lat_lng (~.latlng.LatLng): Min lat/long pair. - max_lat_lng (google.type.latlng_pb2.LatLng): + max_lat_lng (~.latlng.LatLng): Max lat/long pair. """ @@ -548,7 +548,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (google.type.color_pb2.Color): + color (~.gt_color.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -568,7 +568,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[google.cloud.vision_v1.types.ColorInfo]): + colors (Sequence[~.image_annotator.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -580,7 +580,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (google.cloud.vision_v1.types.DominantColorsAnnotation): + dominant_colors (~.image_annotator.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -595,7 +595,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (google.cloud.vision_v1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale. @@ -618,7 +618,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[google.cloud.vision_v1.types.CropHint]): + crop_hints (Sequence[~.image_annotator.CropHint]): Crop hint results. """ @@ -673,7 +673,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (google.cloud.vision_v1.types.LatLongRect): + lat_long_rect (~.image_annotator.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -686,13 +686,13 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (google.cloud.vision_v1.types.CropHintsParams): + crop_hints_params (~.image_annotator.CropHintsParams): Parameters for crop hints annotation request. - product_search_params (google.cloud.vision_v1.types.ProductSearchParams): + product_search_params (~.product_search.ProductSearchParams): Parameters for product search. - web_detection_params (google.cloud.vision_v1.types.WebDetectionParams): + web_detection_params (~.image_annotator.WebDetectionParams): Parameters for web detection. - text_detection_params (google.cloud.vision_v1.types.TextDetectionParams): + text_detection_params (~.image_annotator.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -722,11 +722,11 @@ class AnnotateImageRequest(proto.Message): context information. Attributes: - image (google.cloud.vision_v1.types.Image): + image (~.image_annotator.Image): The image to be processed. - features (Sequence[google.cloud.vision_v1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Requested features. - image_context (google.cloud.vision_v1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image. """ @@ -761,50 +761,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[google.cloud.vision_v1.types.FaceAnnotation]): + face_annotations (Sequence[~.image_annotator.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): + landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): + logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): + label_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[google.cloud.vision_v1.types.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): + text_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (google.cloud.vision_v1.types.TextAnnotation): + full_text_annotation (~.text_annotation.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (google.cloud.vision_v1.types.SafeSearchAnnotation): + safe_search_annotation (~.image_annotator.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (google.cloud.vision_v1.types.ImageProperties): + image_properties_annotation (~.image_annotator.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (google.cloud.vision_v1.types.CropHintsAnnotation): + crop_hints_annotation (~.image_annotator.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (google.cloud.vision_v1.types.WebDetection): + web_detection (~.gcv_web_detection.WebDetection): If present, web detection has completed successfully. - product_search_results (google.cloud.vision_v1.types.ProductSearchResults): + product_search_results (~.product_search.ProductSearchResults): If present, product search has completed successfully. - error (google.rpc.status_pb2.Status): + error (~.status.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (google.cloud.vision_v1.types.ImageAnnotationContext): + context (~.image_annotator.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -867,7 +867,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): + requests (Sequence[~.image_annotator.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. parent (str): @@ -896,7 +896,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -911,11 +911,11 @@ class AnnotateFileRequest(proto.Message): GIF file. Attributes: - input_config (google.cloud.vision_v1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Required. Information about the input file. - features (Sequence[google.cloud.vision_v1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Required. Requested features. - image_context (google.cloud.vision_v1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image(s) in the file. pages (Sequence[int]): @@ -951,16 +951,16 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (google.cloud.vision_v1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Information about the file for which this response is generated. - responses (Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to images found within the file. This field will be empty if the ``error`` field is set. total_pages (int): This field gives the total number of pages in the file. - error (google.rpc.status_pb2.Status): + error (~.status.Status): If set, represents the error message for the failed request. The ``responses`` field will not be set in this case. """ @@ -981,7 +981,7 @@ class BatchAnnotateFilesRequest(proto.Message): BatchAnnotateFiles API. Attributes: - requests (Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]): + requests (Sequence[~.image_annotator.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in @@ -1012,7 +1012,7 @@ class BatchAnnotateFilesResponse(proto.Message): r"""A list of file annotation responses. Attributes: - responses (Sequence[google.cloud.vision_v1.types.AnnotateFileResponse]): + responses (Sequence[~.image_annotator.AnnotateFileResponse]): The list of file annotation responses, each response corresponding to each AnnotateFileRequest in @@ -1028,14 +1028,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (google.cloud.vision_v1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Required. Information about the input file. - features (Sequence[google.cloud.vision_v1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Required. Requested features. - image_context (google.cloud.vision_v1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (google.cloud.vision_v1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1053,7 +1053,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (google.cloud.vision_v1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -1065,10 +1065,10 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): r"""Request for async image annotation for a list of images. Attributes: - requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): + requests (Sequence[~.image_annotator.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. - output_config (google.cloud.vision_v1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): Required. The desired output location and metadata (e.g. format). parent (str): @@ -1099,7 +1099,7 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): r"""Response to an async batch image annotation request. Attributes: - output_config (google.cloud.vision_v1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): The output location and metadata from AsyncBatchAnnotateImagesRequest. """ @@ -1112,7 +1112,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]): + requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. parent (str): @@ -1141,7 +1141,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileResponse]): + responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -1156,7 +1156,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (google.cloud.vision_v1.types.GcsSource): + gcs_source (~.image_annotator.GcsSource): The Google Cloud Storage location to read the input from. content (bytes): @@ -1184,7 +1184,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (google.cloud.vision_v1.types.GcsDestination): + gcs_destination (~.image_annotator.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1261,11 +1261,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (google.cloud.vision_v1.types.OperationMetadata.State): + state (~.image_annotator.OperationMetadata.State): Current state of the batch operation. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): The time when the batch request was received. - update_time (google.protobuf.timestamp_pb2.Timestamp): + update_time (~.timestamp.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1/types/product_search.py b/google/cloud/vision_v1/types/product_search.py index 127bbb97..6ae8f236 100644 --- a/google/cloud/vision_v1/types/product_search.py +++ b/google/cloud/vision_v1/types/product_search.py @@ -33,7 +33,7 @@ class ProductSearchParams(proto.Message): r"""Parameters for a product search request. Attributes: - bounding_poly (google.cloud.vision_v1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. @@ -83,14 +83,14 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - index_time (google.protobuf.timestamp_pb2.Timestamp): + index_time (~.timestamp.Timestamp): Timestamp of the index which provided these results. Products added to the product set and products removed from the product set after this time are not reflected in the current results. - results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]): + results (Sequence[~.product_search.ProductSearchResults.Result]): List of results, one for each product match. - product_grouped_results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.GroupedResult]): + product_grouped_results (Sequence[~.product_search.ProductSearchResults.GroupedResult]): List of results grouped by products detected in the query image. Each entry corresponds to one bounding polygon in the query image, and @@ -103,7 +103,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (google.cloud.vision_v1.types.Product): + product (~.product_search_service.Product): The Product. score (float): A confidence level on the match, ranging from @@ -151,12 +151,12 @@ class GroupedResult(proto.Message): a query image. Attributes: - bounding_poly (google.cloud.vision_v1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the product detected in the query image. - results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]): + results (Sequence[~.product_search.ProductSearchResults.Result]): List of results, one for each product match. - object_annotations (Sequence[google.cloud.vision_v1.types.ProductSearchResults.ObjectAnnotation]): + object_annotations (Sequence[~.product_search.ProductSearchResults.ObjectAnnotation]): List of generic predictions for the object in the bounding box. """ diff --git a/google/cloud/vision_v1/types/product_search_service.py b/google/cloud/vision_v1/types/product_search_service.py index 158deb5a..f06e2eee 100644 --- a/google/cloud/vision_v1/types/product_search_service.py +++ b/google/cloud/vision_v1/types/product_search_service.py @@ -87,7 +87,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[google.cloud.vision_v1.types.Product.KeyValue]): + product_labels (Sequence[~.product_search_service.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -150,7 +150,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (google.protobuf.timestamp_pb2.Timestamp): + index_time (~.timestamp.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -160,7 +160,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (google.rpc.status_pb2.Status): + index_error (~.status.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -195,7 +195,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[google.cloud.vision_v1.types.BoundingPoly]): + bounding_polys (Sequence[~.geometry.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -226,7 +226,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (google.cloud.vision_v1.types.Product): + product (~.product_search_service.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -271,7 +271,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[google.cloud.vision_v1.types.Product]): + products (Sequence[~.product_search_service.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -306,11 +306,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (google.cloud.vision_v1.types.Product): + product (~.product_search_service.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -345,7 +345,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (google.cloud.vision_v1.types.ProductSet): + product_set (~.product_search_service.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -390,7 +390,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[google.cloud.vision_v1.types.ProductSet]): + product_sets (Sequence[~.product_search_service.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -425,10 +425,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (google.cloud.vision_v1.types.ProductSet): + product_set (~.product_search_service.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -464,7 +464,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (google.cloud.vision_v1.types.ReferenceImage): + reference_image (~.product_search_service.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -514,7 +514,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[google.cloud.vision_v1.types.ReferenceImage]): + reference_images (Sequence[~.product_search_service.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -641,7 +641,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[google.cloud.vision_v1.types.Product]): + products (Sequence[~.product_search_service.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -746,7 +746,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (google.cloud.vision_v1.types.ImportProductSetsGcsSource): + gcs_source (~.product_search_service.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -766,7 +766,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (google.cloud.vision_v1.types.ImportProductSetsInputConfig): + input_config (~.product_search_service.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -788,9 +788,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[google.cloud.vision_v1.types.ReferenceImage]): + reference_images (Sequence[~.product_search_service.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[google.rpc.status_pb2.Status]): + statuses (Sequence[~.status.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -815,12 +815,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (google.cloud.vision_v1.types.BatchOperationMetadata.State): + state (~.product_search_service.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (google.protobuf.timestamp_pb2.Timestamp): + submit_time (~.timestamp.Timestamp): The time when the batch request was submitted to the server. - end_time (google.protobuf.timestamp_pb2.Timestamp): + end_time (~.timestamp.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. @@ -861,7 +861,7 @@ class PurgeProductsRequest(proto.Message): r"""Request message for the ``PurgeProducts`` method. Attributes: - product_set_purge_config (google.cloud.vision_v1.types.ProductSetPurgeConfig): + product_set_purge_config (~.product_search_service.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. delete_orphan_products (bool): diff --git a/google/cloud/vision_v1/types/text_annotation.py b/google/cloud/vision_v1/types/text_annotation.py index 3f8e73a8..fa3b88ae 100644 --- a/google/cloud/vision_v1/types/text_annotation.py +++ b/google/cloud/vision_v1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[google.cloud.vision_v1.types.Page]): + pages (Sequence[~.text_annotation.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (google.cloud.vision_v1.types.TextAnnotation.DetectedBreak.BreakType): + type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[google.cloud.vision_v1.types.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (google.cloud.vision_v1.types.TextAnnotation.DetectedBreak): + detected_break (~.text_annotation.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[google.cloud.vision_v1.types.Block]): + blocks (Sequence[~.text_annotation.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (google.cloud.vision_v1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertex order will still be (0, 1, 2, 3). - paragraphs (Sequence[google.cloud.vision_v1.types.Paragraph]): + paragraphs (Sequence[~.text_annotation.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (google.cloud.vision_v1.types.Block.BlockType): + block_type (~.text_annotation.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (google.cloud.vision_v1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - words (Sequence[google.cloud.vision_v1.types.Word]): + words (Sequence[~.text_annotation.Word]): List of all words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (google.cloud.vision_v1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - symbols (Sequence[google.cloud.vision_v1.types.Symbol]): + symbols (Sequence[~.text_annotation.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (google.cloud.vision_v1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1/types/web_detection.py b/google/cloud/vision_v1/types/web_detection.py index 7aa82a25..9395af29 100644 --- a/google/cloud/vision_v1/types/web_detection.py +++ b/google/cloud/vision_v1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[google.cloud.vision_v1.types.WebDetection.WebEntity]): + web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebPage]): + pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): + visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[google.cloud.vision_v1.types.WebDetection.WebLabel]): + best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): The service's best guess as to the topic of the request image. Inferred from similar images on the open web. @@ -98,10 +98,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py index a5154e9d..9099dd92 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py @@ -76,7 +76,6 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) - from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -154,13 +153,12 @@ async def batch_annotate_images( images. Args: - request (:class:`google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest`): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -172,7 +170,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py index 8214e06e..9b133ea1 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py @@ -113,22 +113,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ImageAnnotatorClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -141,7 +125,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ImageAnnotatorClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -233,10 +217,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ImageAnnotatorTransport]): The + transport (Union[str, ~.ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -347,13 +331,12 @@ def batch_annotate_images( images. Args: - request (google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -365,7 +348,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. diff --git a/google/cloud/vision_v1p1beta1/types/geometry.py b/google/cloud/vision_v1p1beta1/types/geometry.py index f581bee0..de248804 100644 --- a/google/cloud/vision_v1p1beta1/types/geometry.py +++ b/google/cloud/vision_v1p1beta1/types/geometry.py @@ -45,7 +45,7 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.vision_v1p1beta1.types.Vertex]): + vertices (Sequence[~.geometry.Vertex]): The bounding polygon vertices. """ diff --git a/google/cloud/vision_v1p1beta1/types/image_annotator.py b/google/cloud/vision_v1p1beta1/types/image_annotator.py index 93f03cb8..be04b15f 100644 --- a/google/cloud/vision_v1p1beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p1beta1/types/image_annotator.py @@ -76,7 +76,7 @@ class Feature(proto.Message): return. Attributes: - type_ (google.cloud.vision_v1p1beta1.types.Feature.Type): + type_ (~.image_annotator.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. @@ -145,7 +145,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: as with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (google.cloud.vision_v1p1beta1.types.ImageSource): + source (~.image_annotator.ImageSource): Google Cloud Storage image location. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to perform the image annotation @@ -162,7 +162,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -171,7 +171,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): + fd_bounding_poly (~.geometry.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -179,7 +179,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation.Landmark]): + landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -198,19 +198,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): + joy_likelihood (~.image_annotator.Likelihood): Joy likelihood. - sorrow_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): + sorrow_likelihood (~.image_annotator.Likelihood): Sorrow likelihood. - anger_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): + anger_likelihood (~.image_annotator.Likelihood): Anger likelihood. - surprise_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): + surprise_likelihood (~.image_annotator.Likelihood): Surprise likelihood. - under_exposed_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): + under_exposed_likelihood (~.image_annotator.Likelihood): Under-exposed likelihood. - blurred_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): + blurred_likelihood (~.image_annotator.Likelihood): Blurred likelihood. - headwear_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): + headwear_likelihood (~.image_annotator.Likelihood): Headwear likelihood. """ @@ -218,9 +218,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (google.cloud.vision_v1p1beta1.types.FaceAnnotation.Landmark.Type): + type_ (~.image_annotator.FaceAnnotation.Landmark.Type): Face landmark type. - position (google.cloud.vision_v1p1beta1.types.Position): + position (~.geometry.Position): Face landmark position. """ @@ -307,7 +307,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): lat/long location coordinates. """ @@ -361,17 +361,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[google.cloud.vision_v1p1beta1.types.LocationInfo]): + locations (Sequence[~.image_annotator.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[google.cloud.vision_v1p1beta1.types.Property]): + properties (Sequence[~.image_annotator.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -402,21 +402,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (google.cloud.vision_v1p1beta1.types.Likelihood): + adult (~.image_annotator.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (google.cloud.vision_v1p1beta1.types.Likelihood): + spoof (~.image_annotator.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (google.cloud.vision_v1p1beta1.types.Likelihood): + medical (~.image_annotator.Likelihood): Likelihood that this is a medical image. - violence (google.cloud.vision_v1p1beta1.types.Likelihood): + violence (~.image_annotator.Likelihood): Likelihood that this image contains violent content. - racy (google.cloud.vision_v1p1beta1.types.Likelihood): + racy (~.image_annotator.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -440,9 +440,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (google.type.latlng_pb2.LatLng): + min_lat_lng (~.latlng.LatLng): Min lat/long pair. - max_lat_lng (google.type.latlng_pb2.LatLng): + max_lat_lng (~.latlng.LatLng): Max lat/long pair. """ @@ -456,7 +456,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (google.type.color_pb2.Color): + color (~.gt_color.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -476,7 +476,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[google.cloud.vision_v1p1beta1.types.ColorInfo]): + colors (Sequence[~.image_annotator.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -488,7 +488,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (google.cloud.vision_v1p1beta1.types.DominantColorsAnnotation): + dominant_colors (~.image_annotator.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -503,7 +503,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -526,7 +526,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[google.cloud.vision_v1p1beta1.types.CropHint]): + crop_hints (Sequence[~.image_annotator.CropHint]): Crop hint results. """ @@ -581,7 +581,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (google.cloud.vision_v1p1beta1.types.LatLongRect): + lat_long_rect (~.image_annotator.LatLongRect): lat/long rectangle that specifies the location of the image. language_hints (Sequence[str]): @@ -595,11 +595,11 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (google.cloud.vision_v1p1beta1.types.CropHintsParams): + crop_hints_params (~.image_annotator.CropHintsParams): Parameters for crop hints annotation request. - web_detection_params (google.cloud.vision_v1p1beta1.types.WebDetectionParams): + web_detection_params (~.image_annotator.WebDetectionParams): Parameters for web detection. - text_detection_params (google.cloud.vision_v1p1beta1.types.TextDetectionParams): + text_detection_params (~.image_annotator.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -624,11 +624,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (google.cloud.vision_v1p1beta1.types.Image): + image (~.image_annotator.Image): The image to be processed. - features (Sequence[google.cloud.vision_v1p1beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Requested features. - image_context (google.cloud.vision_v1p1beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image. """ @@ -644,39 +644,39 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation]): + face_annotations (Sequence[~.image_annotator.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): + landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): + logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): + label_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, label detection has completed successfully. - text_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): + text_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (google.cloud.vision_v1p1beta1.types.TextAnnotation): + full_text_annotation (~.text_annotation.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (google.cloud.vision_v1p1beta1.types.SafeSearchAnnotation): + safe_search_annotation (~.image_annotator.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (google.cloud.vision_v1p1beta1.types.ImageProperties): + image_properties_annotation (~.image_annotator.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (google.cloud.vision_v1p1beta1.types.CropHintsAnnotation): + crop_hints_annotation (~.image_annotator.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (google.cloud.vision_v1p1beta1.types.WebDetection): + web_detection (~.gcv_web_detection.WebDetection): If present, web detection has completed successfully. - error (google.rpc.status_pb2.Status): + error (~.status.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. @@ -730,7 +730,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]): + requests (Sequence[~.image_annotator.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -744,7 +744,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ diff --git a/google/cloud/vision_v1p1beta1/types/text_annotation.py b/google/cloud/vision_v1p1beta1/types/text_annotation.py index 23b249fe..8e231b4b 100644 --- a/google/cloud/vision_v1p1beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p1beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[google.cloud.vision_v1p1beta1.types.Page]): + pages (Sequence[~.text_annotation.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedBreak.BreakType): + type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedBreak): + detected_break (~.text_annotation.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,13 +113,13 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width in pixels. height (int): Page height in pixels. - blocks (Sequence[google.cloud.vision_v1p1beta1.types.Block]): + blocks (Sequence[~.text_annotation.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -143,10 +143,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -158,10 +158,10 @@ class Block(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[google.cloud.vision_v1p1beta1.types.Paragraph]): + paragraphs (Sequence[~.text_annotation.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (google.cloud.vision_v1p1beta1.types.Block.BlockType): + block_type (~.text_annotation.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -195,10 +195,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -210,7 +210,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[google.cloud.vision_v1p1beta1.types.Word]): + words (Sequence[~.text_annotation.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -232,9 +232,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -246,7 +246,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[google.cloud.vision_v1p1beta1.types.Symbol]): + symbols (Sequence[~.text_annotation.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -269,10 +269,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p1beta1/types/web_detection.py b/google/cloud/vision_v1p1beta1/types/web_detection.py index 1e9586d6..6bd91777 100644 --- a/google/cloud/vision_v1p1beta1/types/web_detection.py +++ b/google/cloud/vision_v1p1beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebEntity]): + web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebPage]): + pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): + visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebLabel]): + best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py index c2efa184..e28c5f19 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py @@ -78,7 +78,6 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) - from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -156,13 +155,12 @@ async def batch_annotate_images( images. Args: - request (:class:`google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest`): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -174,7 +172,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -237,13 +235,12 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest`): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -255,11 +252,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py index 07dcec8e..c86c318b 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py @@ -115,22 +115,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ImageAnnotatorClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -143,7 +127,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ImageAnnotatorClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -235,10 +219,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ImageAnnotatorTransport]): The + transport (Union[str, ~.ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -349,13 +333,12 @@ def batch_annotate_images( images. Args: - request (google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -367,7 +350,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -426,13 +409,12 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -444,11 +426,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p2beta1/types/geometry.py b/google/cloud/vision_v1p2beta1/types/geometry.py index 42fb6ec0..482f5ec2 100644 --- a/google/cloud/vision_v1p2beta1/types/geometry.py +++ b/google/cloud/vision_v1p2beta1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.vision_v1p2beta1.types.Vertex]): + vertices (Sequence[~.geometry.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[google.cloud.vision_v1p2beta1.types.NormalizedVertex]): + normalized_vertices (Sequence[~.geometry.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1p2beta1/types/image_annotator.py b/google/cloud/vision_v1p2beta1/types/image_annotator.py index 5480edb6..0f3bee9c 100644 --- a/google/cloud/vision_v1p2beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p2beta1/types/image_annotator.py @@ -86,7 +86,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (google.cloud.vision_v1p2beta1.types.Feature.Type): + type_ (~.image_annotator.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -167,7 +167,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (google.cloud.vision_v1p2beta1.types.ImageSource): + source (~.image_annotator.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -184,7 +184,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -193,7 +193,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): + fd_bounding_poly (~.geometry.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -201,7 +201,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark]): + landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -220,19 +220,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): + joy_likelihood (~.image_annotator.Likelihood): Joy likelihood. - sorrow_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): + sorrow_likelihood (~.image_annotator.Likelihood): Sorrow likelihood. - anger_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): + anger_likelihood (~.image_annotator.Likelihood): Anger likelihood. - surprise_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): + surprise_likelihood (~.image_annotator.Likelihood): Surprise likelihood. - under_exposed_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): + under_exposed_likelihood (~.image_annotator.Likelihood): Under-exposed likelihood. - blurred_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): + blurred_likelihood (~.image_annotator.Likelihood): Blurred likelihood. - headwear_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): + headwear_likelihood (~.image_annotator.Likelihood): Headwear likelihood. """ @@ -240,9 +240,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark.Type): + type_ (~.image_annotator.FaceAnnotation.Landmark.Type): Face landmark type. - position (google.cloud.vision_v1p2beta1.types.Position): + position (~.geometry.Position): Face landmark position. """ @@ -329,7 +329,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): lat/long location coordinates. """ @@ -384,17 +384,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[google.cloud.vision_v1p2beta1.types.LocationInfo]): + locations (Sequence[~.image_annotator.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[google.cloud.vision_v1p2beta1.types.Property]): + properties (Sequence[~.image_annotator.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -425,21 +425,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (google.cloud.vision_v1p2beta1.types.Likelihood): + adult (~.image_annotator.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (google.cloud.vision_v1p2beta1.types.Likelihood): + spoof (~.image_annotator.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (google.cloud.vision_v1p2beta1.types.Likelihood): + medical (~.image_annotator.Likelihood): Likelihood that this is a medical image. - violence (google.cloud.vision_v1p2beta1.types.Likelihood): + violence (~.image_annotator.Likelihood): Likelihood that this image contains violent content. - racy (google.cloud.vision_v1p2beta1.types.Likelihood): + racy (~.image_annotator.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -463,9 +463,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (google.type.latlng_pb2.LatLng): + min_lat_lng (~.latlng.LatLng): Min lat/long pair. - max_lat_lng (google.type.latlng_pb2.LatLng): + max_lat_lng (~.latlng.LatLng): Max lat/long pair. """ @@ -479,7 +479,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (google.type.color_pb2.Color): + color (~.gt_color.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -499,7 +499,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[google.cloud.vision_v1p2beta1.types.ColorInfo]): + colors (Sequence[~.image_annotator.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -511,7 +511,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (google.cloud.vision_v1p2beta1.types.DominantColorsAnnotation): + dominant_colors (~.image_annotator.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -526,7 +526,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -549,7 +549,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[google.cloud.vision_v1p2beta1.types.CropHint]): + crop_hints (Sequence[~.image_annotator.CropHint]): Crop hint results. """ @@ -604,7 +604,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (google.cloud.vision_v1p2beta1.types.LatLongRect): + lat_long_rect (~.image_annotator.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -617,11 +617,11 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (google.cloud.vision_v1p2beta1.types.CropHintsParams): + crop_hints_params (~.image_annotator.CropHintsParams): Parameters for crop hints annotation request. - web_detection_params (google.cloud.vision_v1p2beta1.types.WebDetectionParams): + web_detection_params (~.image_annotator.WebDetectionParams): Parameters for web detection. - text_detection_params (google.cloud.vision_v1p2beta1.types.TextDetectionParams): + text_detection_params (~.image_annotator.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -646,11 +646,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (google.cloud.vision_v1p2beta1.types.Image): + image (~.image_annotator.Image): The image to be processed. - features (Sequence[google.cloud.vision_v1p2beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Requested features. - image_context (google.cloud.vision_v1p2beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image. """ @@ -685,43 +685,43 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation]): + face_annotations (Sequence[~.image_annotator.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): + landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): + logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): + label_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, label detection has completed successfully. - text_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): + text_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (google.cloud.vision_v1p2beta1.types.TextAnnotation): + full_text_annotation (~.text_annotation.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (google.cloud.vision_v1p2beta1.types.SafeSearchAnnotation): + safe_search_annotation (~.image_annotator.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (google.cloud.vision_v1p2beta1.types.ImageProperties): + image_properties_annotation (~.image_annotator.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (google.cloud.vision_v1p2beta1.types.CropHintsAnnotation): + crop_hints_annotation (~.image_annotator.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (google.cloud.vision_v1p2beta1.types.WebDetection): + web_detection (~.gcv_web_detection.WebDetection): If present, web detection has completed successfully. - error (google.rpc.status_pb2.Status): + error (~.status.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (google.cloud.vision_v1p2beta1.types.ImageAnnotationContext): + context (~.image_annotator.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -777,10 +777,10 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (google.cloud.vision_v1p2beta1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Information about the file for which this response is generated. - responses (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to images found within the file. """ @@ -797,7 +797,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]): + requests (Sequence[~.image_annotator.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -811,7 +811,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -825,14 +825,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (google.cloud.vision_v1p2beta1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Required. Information about the input file. - features (Sequence[google.cloud.vision_v1p2beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Required. Requested features. - image_context (google.cloud.vision_v1p2beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (google.cloud.vision_v1p2beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -850,7 +850,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (google.cloud.vision_v1p2beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -863,7 +863,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]): + requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -877,7 +877,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileResponse]): + responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -892,7 +892,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (google.cloud.vision_v1p2beta1.types.GcsSource): + gcs_source (~.image_annotator.GcsSource): The Google Cloud Storage location to read the input from. mime_type (str): @@ -910,7 +910,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (google.cloud.vision_v1p2beta1.types.GcsDestination): + gcs_destination (~.image_annotator.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -978,11 +978,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (google.cloud.vision_v1p2beta1.types.OperationMetadata.State): + state (~.image_annotator.OperationMetadata.State): Current state of the batch operation. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): The time when the batch request was received. - update_time (google.protobuf.timestamp_pb2.Timestamp): + update_time (~.timestamp.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p2beta1/types/text_annotation.py b/google/cloud/vision_v1p2beta1/types/text_annotation.py index e2366e17..c7c6de3d 100644 --- a/google/cloud/vision_v1p2beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p2beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[google.cloud.vision_v1p2beta1.types.Page]): + pages (Sequence[~.text_annotation.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak.BreakType): + type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak): + detected_break (~.text_annotation.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[google.cloud.vision_v1p2beta1.types.Block]): + blocks (Sequence[~.text_annotation.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[google.cloud.vision_v1p2beta1.types.Paragraph]): + paragraphs (Sequence[~.text_annotation.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (google.cloud.vision_v1p2beta1.types.Block.BlockType): + block_type (~.text_annotation.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[google.cloud.vision_v1p2beta1.types.Word]): + words (Sequence[~.text_annotation.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[google.cloud.vision_v1p2beta1.types.Symbol]): + symbols (Sequence[~.text_annotation.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p2beta1/types/web_detection.py b/google/cloud/vision_v1p2beta1/types/web_detection.py index d3a7ffee..1a4f954d 100644 --- a/google/cloud/vision_v1p2beta1/types/web_detection.py +++ b/google/cloud/vision_v1p2beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebEntity]): + web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebPage]): + pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): + visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebLabel]): + best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py index 1ca98853..c9e14583 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py @@ -83,7 +83,6 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) - from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -161,13 +160,12 @@ async def batch_annotate_images( images. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest`): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -179,7 +177,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -242,13 +240,12 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest`): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -260,11 +257,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py index abbf8ce0..6792a030 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py @@ -115,22 +115,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ImageAnnotatorClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -143,7 +127,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ImageAnnotatorClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -267,10 +251,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ImageAnnotatorTransport]): The + transport (Union[str, ~.ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -381,13 +365,12 @@ def batch_annotate_images( images. Args: - request (google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -399,7 +382,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -458,13 +441,12 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -476,11 +458,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py index 6a7c3022..60c3a3cd 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py @@ -108,7 +108,6 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) - from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -192,7 +191,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.CreateProductSetRequest`): + request (:class:`~.product_search_service.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -200,11 +199,10 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`google.cloud.vision_v1p3beta1.types.ProductSet`): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -215,7 +213,6 @@ async def create_product_set( 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 ``/``. - This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -227,7 +224,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -300,7 +297,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.ListProductSetsRequest`): + request (:class:`~.product_search_service.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -308,7 +305,6 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -320,8 +316,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsAsyncPager: - Response message for the ListProductSets method. + ~.pagers.ListProductSetsAsyncPager: + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -395,7 +391,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.GetProductSetRequest`): + request (:class:`~.product_search_service.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -403,7 +399,6 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -415,7 +410,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -490,22 +485,20 @@ async def update_product_set( characters. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest`): + request (:class:`~.product_search_service.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`google.cloud.vision_v1p3beta1.types.ProductSet`): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet resource which replaces the one on the server. - This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -517,7 +510,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -593,7 +586,7 @@ async def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest`): + request (:class:`~.product_search_service.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -601,7 +594,6 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -680,7 +672,7 @@ async def create_product( invalid. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.CreateProductRequest`): + request (:class:`~.product_search_service.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -688,11 +680,10 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`google.cloud.vision_v1p3beta1.types.Product`): + product (:class:`~.product_search_service.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -703,7 +694,6 @@ async def create_product( 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 ``/``. - This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -715,7 +705,7 @@ async def create_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -783,7 +773,7 @@ async def list_products( less than 1. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.ListProductsRequest`): + request (:class:`~.product_search_service.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -791,7 +781,6 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -803,8 +792,8 @@ async def list_products( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsAsyncPager: - Response message for the ListProducts method. + ~.pagers.ListProductsAsyncPager: + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -878,7 +867,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.GetProductRequest`): + request (:class:`~.product_search_service.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -886,7 +875,6 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -898,7 +886,7 @@ async def get_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -975,24 +963,22 @@ async def update_product( update_mask. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.UpdateProductRequest`): + request (:class:`~.product_search_service.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`google.cloud.vision_v1p3beta1.types.Product`): + product (:class:`~.product_search_service.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1004,7 +990,7 @@ async def update_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1075,7 +1061,7 @@ async def delete_product( - Returns NOT_FOUND if the product does not exist. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.DeleteProductRequest`): + request (:class:`~.product_search_service.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1083,7 +1069,6 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1174,7 +1159,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest`): + request (:class:`~.product_search_service.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1183,15 +1168,13 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`google.cloud.vision_v1p3beta1.types.ReferenceImage`): + reference_image (:class:`~.product_search_service.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. - This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1201,7 +1184,6 @@ async def create_reference_image( 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 ``/``. - This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1213,9 +1195,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1289,7 +1271,7 @@ async def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest`): + request (:class:`~.product_search_service.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1299,7 +1281,6 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1373,7 +1354,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest`): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1382,7 +1363,6 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1394,8 +1374,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: - Response message for the ListReferenceImages method. + ~.pagers.ListReferenceImagesAsyncPager: + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1469,7 +1449,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest`): + request (:class:`~.product_search_service.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1479,7 +1459,6 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1491,9 +1470,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1563,7 +1542,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest`): + request (:class:`~.product_search_service.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1572,7 +1551,6 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1582,7 +1560,6 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1656,7 +1633,7 @@ async def remove_product_from_product_set( ProductSet. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest`): + request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1665,7 +1642,6 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1675,7 +1651,6 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1750,7 +1725,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest`): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1759,7 +1734,6 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1771,8 +1745,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: - Response message for the ListProductsInProductSet + ~.pagers.ListProductsInProductSetAsyncPager: + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and @@ -1855,7 +1829,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest`): + request (:class:`~.product_search_service.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1863,14 +1837,12 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig`): + input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): Required. The input content for the list of requests. - This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1882,18 +1854,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:``~.product_search_service.ImportProductSetsResponse``: + Response message for the ``ImportProductSets`` method. + + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/client.py b/google/cloud/vision_v1p3beta1/services/product_search/client.py index c6427ba1..804985ed 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/client.py @@ -134,22 +134,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProductSearchClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -162,7 +146,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ProductSearchClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -307,10 +291,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ProductSearchTransport]): The + transport (Union[str, ~.ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -427,30 +411,28 @@ def create_product_set( longer than 4096 characters. Args: - request (google.cloud.vision_v1p3beta1.types.CreateProductSetRequest): + request (:class:`~.product_search_service.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. - parent (str): + parent (:class:`str`): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (google.cloud.vision_v1p3beta1.types.ProductSet): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (str): + product_set_id (:class:`str`): 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 ``/``. - This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -462,7 +444,7 @@ def create_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -530,15 +512,14 @@ def list_product_sets( less than 1. Args: - request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. - parent (str): + parent (:class:`str`): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -550,8 +531,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsPager: - Response message for the ListProductSets method. + ~.pagers.ListProductSetsPager: + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -618,15 +599,14 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (google.cloud.vision_v1p3beta1.types.GetProductSetRequest): + request (:class:`~.product_search_service.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. - name (str): + name (:class:`str`): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -638,7 +618,7 @@ def get_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -706,22 +686,20 @@ def update_product_set( characters. Args: - request (google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest): + request (:class:`~.product_search_service.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (google.cloud.vision_v1p3beta1.types.ProductSet): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet resource which replaces the one on the server. - This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -733,7 +711,7 @@ def update_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -804,15 +782,14 @@ def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest): + request (:class:`~.product_search_service.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. - name (str): + name (:class:`str`): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -884,30 +861,28 @@ def create_product( invalid. Args: - request (google.cloud.vision_v1p3beta1.types.CreateProductRequest): + request (:class:`~.product_search_service.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. - parent (str): + parent (:class:`str`): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (google.cloud.vision_v1p3beta1.types.Product): + product (:class:`~.product_search_service.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (str): + product_id (:class:`str`): 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 ``/``. - This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -919,7 +894,7 @@ def create_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -982,15 +957,14 @@ def list_products( less than 1. Args: - request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The request object. Request message for the `ListProducts` method. - parent (str): + parent (:class:`str`): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1002,8 +976,8 @@ def list_products( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsPager: - Response message for the ListProducts method. + ~.pagers.ListProductsPager: + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1070,15 +1044,14 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (google.cloud.vision_v1p3beta1.types.GetProductRequest): + request (:class:`~.product_search_service.GetProductRequest`): The request object. Request message for the `GetProduct` method. - name (str): + name (:class:`str`): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1090,7 +1063,7 @@ def get_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1160,24 +1133,22 @@ def update_product( update_mask. Args: - request (google.cloud.vision_v1p3beta1.types.UpdateProductRequest): + request (:class:`~.product_search_service.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (google.cloud.vision_v1p3beta1.types.Product): + product (:class:`~.product_search_service.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1189,7 +1160,7 @@ def update_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1255,15 +1226,14 @@ def delete_product( - Returns NOT_FOUND if the product does not exist. Args: - request (google.cloud.vision_v1p3beta1.types.DeleteProductRequest): + request (:class:`~.product_search_service.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. - name (str): + name (:class:`str`): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1347,34 +1317,31 @@ def create_reference_image( 10 polygons. Args: - request (google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest): + request (:class:`~.product_search_service.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. - parent (str): + parent (:class:`str`): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (google.cloud.vision_v1p3beta1.types.ReferenceImage): + reference_image (:class:`~.product_search_service.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. - This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (str): + reference_image_id (:class:`str`): 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 ``/``. - This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1386,9 +1353,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1457,17 +1424,16 @@ def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. Args: - request (google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest): + request (:class:`~.product_search_service.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. - name (str): + name (:class:`str`): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1534,16 +1500,15 @@ def list_reference_images( 100, or less than 1. Args: - request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. - parent (str): + parent (:class:`str`): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1555,8 +1520,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesPager: - Response message for the ListReferenceImages method. + ~.pagers.ListReferenceImagesPager: + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1623,17 +1588,16 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest): + request (:class:`~.product_search_service.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. - name (str): + name (:class:`str`): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1645,9 +1609,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1710,26 +1674,24 @@ def add_product_to_product_set( exist. Args: - request (google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest): + request (:class:`~.product_search_service.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. - name (str): + name (:class:`str`): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (str): + product (:class:`str`): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1802,26 +1764,24 @@ def remove_product_from_product_set( ProductSet. Args: - request (google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest): + request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. - name (str): + name (:class:`str`): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (str): + product (:class:`str`): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1895,16 +1855,15 @@ def list_products_in_product_set( less than 1. Args: - request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. - name (str): + name (:class:`str`): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1916,8 +1875,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetPager: - Response message for the ListProductsInProductSet + ~.pagers.ListProductsInProductSetPager: + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and @@ -1997,22 +1956,20 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest): + request (:class:`~.product_search_service.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. - parent (str): + parent (:class:`str`): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig): + input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): Required. The input content for the list of requests. - This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2024,18 +1981,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:``~.product_search_service.ImportProductSetsResponse``: + Response message for the ``ImportProductSets`` method. + + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py index b145dd71..85829a6e 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` object, and + :class:`~.product_search_service.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` + All the usual :class:`~.product_search_service.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListProductSetsResponse): + response (:class:`~.product_search_service.ListProductSetsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` object, and + :class:`~.product_search_service.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` + All the usual :class:`~.product_search_service.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListProductSetsResponse): + response (:class:`~.product_search_service.ListProductSetsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` object, and + :class:`~.product_search_service.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` + All the usual :class:`~.product_search_service.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListProductsResponse): + response (:class:`~.product_search_service.ListProductsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` object, and + :class:`~.product_search_service.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` + All the usual :class:`~.product_search_service.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListProductsResponse): + response (:class:`~.product_search_service.ListProductsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` object, and + :class:`~.product_search_service.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` + All the usual :class:`~.product_search_service.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse): + response (:class:`~.product_search_service.ListReferenceImagesResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` object, and + :class:`~.product_search_service.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` + All the usual :class:`~.product_search_service.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse): + response (:class:`~.product_search_service.ListReferenceImagesResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` object, and + :class:`~.product_search_service.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` + All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse): + response (:class:`~.product_search_service.ListProductsInProductSetResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` object, and + :class:`~.product_search_service.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` + All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The initial request object. - response (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse): + response (:class:`~.product_search_service.ListProductsInProductSetResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1p3beta1/types/geometry.py b/google/cloud/vision_v1p3beta1/types/geometry.py index c1b1fd91..e6107175 100644 --- a/google/cloud/vision_v1p3beta1/types/geometry.py +++ b/google/cloud/vision_v1p3beta1/types/geometry.py @@ -68,9 +68,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.vision_v1p3beta1.types.Vertex]): + vertices (Sequence[~.geometry.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[google.cloud.vision_v1p3beta1.types.NormalizedVertex]): + normalized_vertices (Sequence[~.geometry.NormalizedVertex]): The bounding polygon normalized vertices. """ @@ -85,7 +85,7 @@ class NormalizedBoundingPoly(proto.Message): r"""A normalized bounding polygon around a portion of an image. Attributes: - vertices (Sequence[google.cloud.vision_v1p3beta1.types.NormalizedVertex]): + vertices (Sequence[~.geometry.NormalizedVertex]): Normalized vertices of the bounding polygon. """ diff --git a/google/cloud/vision_v1p3beta1/types/image_annotator.py b/google/cloud/vision_v1p3beta1/types/image_annotator.py index 0af98b5a..7c5f1d41 100644 --- a/google/cloud/vision_v1p3beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p3beta1/types/image_annotator.py @@ -88,7 +88,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (google.cloud.vision_v1p3beta1.types.Feature.Type): + type_ (~.image_annotator.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -171,7 +171,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (google.cloud.vision_v1p3beta1.types.ImageSource): + source (~.image_annotator.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -188,7 +188,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -197,7 +197,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): + fd_bounding_poly (~.geometry.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -205,7 +205,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[google.cloud.vision_v1p3beta1.types.FaceAnnotation.Landmark]): + landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -224,19 +224,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): + joy_likelihood (~.image_annotator.Likelihood): Joy likelihood. - sorrow_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): + sorrow_likelihood (~.image_annotator.Likelihood): Sorrow likelihood. - anger_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): + anger_likelihood (~.image_annotator.Likelihood): Anger likelihood. - surprise_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): + surprise_likelihood (~.image_annotator.Likelihood): Surprise likelihood. - under_exposed_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): + under_exposed_likelihood (~.image_annotator.Likelihood): Under-exposed likelihood. - blurred_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): + blurred_likelihood (~.image_annotator.Likelihood): Blurred likelihood. - headwear_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): + headwear_likelihood (~.image_annotator.Likelihood): Headwear likelihood. """ @@ -244,9 +244,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (google.cloud.vision_v1p3beta1.types.FaceAnnotation.Landmark.Type): + type_ (~.image_annotator.FaceAnnotation.Landmark.Type): Face landmark type. - position (google.cloud.vision_v1p3beta1.types.Position): + position (~.geometry.Position): Face landmark position. """ @@ -333,7 +333,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): lat/long location coordinates. """ @@ -388,17 +388,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[google.cloud.vision_v1p3beta1.types.LocationInfo]): + locations (Sequence[~.image_annotator.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[google.cloud.vision_v1p3beta1.types.Property]): + properties (Sequence[~.image_annotator.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -438,7 +438,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -460,21 +460,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (google.cloud.vision_v1p3beta1.types.Likelihood): + adult (~.image_annotator.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (google.cloud.vision_v1p3beta1.types.Likelihood): + spoof (~.image_annotator.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (google.cloud.vision_v1p3beta1.types.Likelihood): + medical (~.image_annotator.Likelihood): Likelihood that this is a medical image. - violence (google.cloud.vision_v1p3beta1.types.Likelihood): + violence (~.image_annotator.Likelihood): Likelihood that this image contains violent content. - racy (google.cloud.vision_v1p3beta1.types.Likelihood): + racy (~.image_annotator.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -498,9 +498,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (google.type.latlng_pb2.LatLng): + min_lat_lng (~.latlng.LatLng): Min lat/long pair. - max_lat_lng (google.type.latlng_pb2.LatLng): + max_lat_lng (~.latlng.LatLng): Max lat/long pair. """ @@ -514,7 +514,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (google.type.color_pb2.Color): + color (~.gt_color.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -534,7 +534,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[google.cloud.vision_v1p3beta1.types.ColorInfo]): + colors (Sequence[~.image_annotator.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -546,7 +546,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (google.cloud.vision_v1p3beta1.types.DominantColorsAnnotation): + dominant_colors (~.image_annotator.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -561,7 +561,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -584,7 +584,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[google.cloud.vision_v1p3beta1.types.CropHint]): + crop_hints (Sequence[~.image_annotator.CropHint]): Crop hint results. """ @@ -639,7 +639,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (google.cloud.vision_v1p3beta1.types.LatLongRect): + lat_long_rect (~.image_annotator.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -652,13 +652,13 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (google.cloud.vision_v1p3beta1.types.CropHintsParams): + crop_hints_params (~.image_annotator.CropHintsParams): Parameters for crop hints annotation request. - product_search_params (google.cloud.vision_v1p3beta1.types.ProductSearchParams): + product_search_params (~.product_search.ProductSearchParams): Parameters for product search. - web_detection_params (google.cloud.vision_v1p3beta1.types.WebDetectionParams): + web_detection_params (~.image_annotator.WebDetectionParams): Parameters for web detection. - text_detection_params (google.cloud.vision_v1p3beta1.types.TextDetectionParams): + text_detection_params (~.image_annotator.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -687,11 +687,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (google.cloud.vision_v1p3beta1.types.Image): + image (~.image_annotator.Image): The image to be processed. - features (Sequence[google.cloud.vision_v1p3beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Requested features. - image_context (google.cloud.vision_v1p3beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image. """ @@ -726,50 +726,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[google.cloud.vision_v1p3beta1.types.FaceAnnotation]): + face_annotations (Sequence[~.image_annotator.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): + landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): + logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): + label_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[google.cloud.vision_v1p3beta1.types.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): + text_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (google.cloud.vision_v1p3beta1.types.TextAnnotation): + full_text_annotation (~.text_annotation.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (google.cloud.vision_v1p3beta1.types.SafeSearchAnnotation): + safe_search_annotation (~.image_annotator.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (google.cloud.vision_v1p3beta1.types.ImageProperties): + image_properties_annotation (~.image_annotator.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (google.cloud.vision_v1p3beta1.types.CropHintsAnnotation): + crop_hints_annotation (~.image_annotator.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (google.cloud.vision_v1p3beta1.types.WebDetection): + web_detection (~.gcv_web_detection.WebDetection): If present, web detection has completed successfully. - product_search_results (google.cloud.vision_v1p3beta1.types.ProductSearchResults): + product_search_results (~.product_search.ProductSearchResults): If present, product search has completed successfully. - error (google.rpc.status_pb2.Status): + error (~.status.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (google.cloud.vision_v1p3beta1.types.ImageAnnotationContext): + context (~.image_annotator.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -833,10 +833,10 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (google.cloud.vision_v1p3beta1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Information about the file for which this response is generated. - responses (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to images found within the file. """ @@ -853,7 +853,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]): + requests (Sequence[~.image_annotator.AnnotateImageRequest]): Individual image annotation requests for this batch. """ @@ -867,7 +867,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -881,14 +881,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (google.cloud.vision_v1p3beta1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Required. Information about the input file. - features (Sequence[google.cloud.vision_v1p3beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Required. Requested features. - image_context (google.cloud.vision_v1p3beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (google.cloud.vision_v1p3beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -906,7 +906,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (google.cloud.vision_v1p3beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -919,7 +919,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]): + requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -933,7 +933,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileResponse]): + responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -948,7 +948,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (google.cloud.vision_v1p3beta1.types.GcsSource): + gcs_source (~.image_annotator.GcsSource): The Google Cloud Storage location to read the input from. mime_type (str): @@ -966,7 +966,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (google.cloud.vision_v1p3beta1.types.GcsDestination): + gcs_destination (~.image_annotator.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1034,11 +1034,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (google.cloud.vision_v1p3beta1.types.OperationMetadata.State): + state (~.image_annotator.OperationMetadata.State): Current state of the batch operation. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): The time when the batch request was received. - update_time (google.protobuf.timestamp_pb2.Timestamp): + update_time (~.timestamp.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p3beta1/types/product_search.py b/google/cloud/vision_v1p3beta1/types/product_search.py index 43cb9f3a..375bd701 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search.py +++ b/google/cloud/vision_v1p3beta1/types/product_search.py @@ -55,7 +55,7 @@ class ProductSearchParams(proto.Message): The resource name of the catalog to search. Format is: ``productSearch/catalogs/CATALOG_NAME``. - category (google.cloud.vision_v1p3beta1.types.ProductSearchCategory): + category (~.product_search.ProductSearchCategory): The category to search in. Optional. It is inferred by the system if it is not specified. [Deprecated] Use ``product_category``. @@ -64,15 +64,15 @@ class ProductSearchParams(proto.Message): by the system if it is not specified. Supported values are ``bag``, ``shoe``, ``sunglasses``, ``dress``, ``outerwear``, ``skirt``, ``top``, ``shorts``, and ``pants``. - normalized_bounding_poly (google.cloud.vision_v1p3beta1.types.NormalizedBoundingPoly): + normalized_bounding_poly (~.geometry.NormalizedBoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. [Deprecated] Use ``bounding_poly``. - bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. - view (google.cloud.vision_v1p3beta1.types.ProductSearchResultsView): + view (~.product_search.ProductSearchResultsView): Specifies the verbosity of the product search results. Optional. Defaults to ``BASIC``. product_set (str): @@ -123,19 +123,19 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - category (google.cloud.vision_v1p3beta1.types.ProductSearchCategory): + category (~.product_search.ProductSearchCategory): Product category. [Deprecated] Use ``product_category``. product_category (str): Product category. Supported values are ``bag`` and ``shoe``. [Deprecated] ``product_category`` is provided in each Product. - index_time (google.protobuf.timestamp_pb2.Timestamp): + index_time (~.timestamp.Timestamp): Timestamp of the index which provided these results. Changes made after this time are not reflected in the current results. - products (Sequence[google.cloud.vision_v1p3beta1.types.ProductSearchResults.ProductInfo]): + products (Sequence[~.product_search.ProductSearchResults.ProductInfo]): List of detected products. - results (Sequence[google.cloud.vision_v1p3beta1.types.ProductSearchResults.Result]): + results (Sequence[~.product_search.ProductSearchResults.Result]): List of results, one for each product match. """ @@ -168,7 +168,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (google.cloud.vision_v1p3beta1.types.Product): + product (~.product_search_service.Product): The Product. score (float): A confidence level on the match, ranging from 0 (no diff --git a/google/cloud/vision_v1p3beta1/types/product_search_service.py b/google/cloud/vision_v1p3beta1/types/product_search_service.py index aef592b7..1f13e1ba 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p3beta1/types/product_search_service.py @@ -85,7 +85,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[google.cloud.vision_v1p3beta1.types.Product.KeyValue]): + product_labels (Sequence[~.product_search_service.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -143,7 +143,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (google.protobuf.timestamp_pb2.Timestamp): + index_time (~.timestamp.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -152,7 +152,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (google.rpc.status_pb2.Status): + index_error (~.status.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -187,7 +187,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[google.cloud.vision_v1p3beta1.types.BoundingPoly]): + bounding_polys (Sequence[~.geometry.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -218,7 +218,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (google.cloud.vision_v1p3beta1.types.Product): + product (~.product_search_service.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -263,7 +263,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[google.cloud.vision_v1p3beta1.types.Product]): + products (Sequence[~.product_search_service.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -298,11 +298,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (google.cloud.vision_v1p3beta1.types.Product): + product (~.product_search_service.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -337,7 +337,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (google.cloud.vision_v1p3beta1.types.ProductSet): + product_set (~.product_search_service.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -382,7 +382,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[google.cloud.vision_v1p3beta1.types.ProductSet]): + product_sets (Sequence[~.product_search_service.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -417,10 +417,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (google.cloud.vision_v1p3beta1.types.ProductSet): + product_set (~.product_search_service.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -456,7 +456,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (google.cloud.vision_v1p3beta1.types.ReferenceImage): + reference_image (~.product_search_service.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -506,7 +506,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[google.cloud.vision_v1p3beta1.types.ReferenceImage]): + reference_images (Sequence[~.product_search_service.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -633,7 +633,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[google.cloud.vision_v1p3beta1.types.Product]): + products (Sequence[~.product_search_service.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -725,7 +725,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (google.cloud.vision_v1p3beta1.types.ImportProductSetsGcsSource): + gcs_source (~.product_search_service.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -745,7 +745,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig): + input_config (~.product_search_service.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -767,9 +767,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[google.cloud.vision_v1p3beta1.types.ReferenceImage]): + reference_images (Sequence[~.product_search_service.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[google.rpc.status_pb2.Status]): + statuses (Sequence[~.status.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -794,12 +794,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (google.cloud.vision_v1p3beta1.types.BatchOperationMetadata.State): + state (~.product_search_service.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (google.protobuf.timestamp_pb2.Timestamp): + submit_time (~.timestamp.Timestamp): The time when the batch request was submitted to the server. - end_time (google.protobuf.timestamp_pb2.Timestamp): + end_time (~.timestamp.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. diff --git a/google/cloud/vision_v1p3beta1/types/text_annotation.py b/google/cloud/vision_v1p3beta1/types/text_annotation.py index 47423028..e1252879 100644 --- a/google/cloud/vision_v1p3beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p3beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[google.cloud.vision_v1p3beta1.types.Page]): + pages (Sequence[~.text_annotation.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedBreak.BreakType): + type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedBreak): + detected_break (~.text_annotation.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[google.cloud.vision_v1p3beta1.types.Block]): + blocks (Sequence[~.text_annotation.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[google.cloud.vision_v1p3beta1.types.Paragraph]): + paragraphs (Sequence[~.text_annotation.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (google.cloud.vision_v1p3beta1.types.Block.BlockType): + block_type (~.text_annotation.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[google.cloud.vision_v1p3beta1.types.Word]): + words (Sequence[~.text_annotation.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[google.cloud.vision_v1p3beta1.types.Symbol]): + symbols (Sequence[~.text_annotation.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p3beta1/types/web_detection.py b/google/cloud/vision_v1p3beta1/types/web_detection.py index 66587d99..6a24d5c2 100644 --- a/google/cloud/vision_v1p3beta1/types/web_detection.py +++ b/google/cloud/vision_v1p3beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebEntity]): + web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebPage]): + pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): + visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebLabel]): + best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p4beta1/__init__.py b/google/cloud/vision_v1p4beta1/__init__.py index c2b932ed..890dd009 100644 --- a/google/cloud/vision_v1p4beta1/__init__.py +++ b/google/cloud/vision_v1p4beta1/__init__.py @@ -158,6 +158,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -185,7 +186,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -204,5 +204,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py index 1a9f75e6..581f63bd 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py @@ -83,7 +83,6 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) - from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -161,13 +160,12 @@ async def batch_annotate_images( images. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest`): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -179,7 +177,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -241,15 +239,14 @@ async def batch_annotate_files( extracted. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest`): + request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -261,7 +258,7 @@ async def batch_annotate_files( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse: + ~.image_annotator.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -326,20 +323,18 @@ async def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest`): + request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]`): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`google.cloud.vision_v1p4beta1.types.OutputConfig`): + output_config (:class:`~.image_annotator.OutputConfig`): Required. The desired output location and metadata (e.g. format). - This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -351,11 +346,11 @@ async def async_batch_annotate_images( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: Response to an async batch image annotation request. """ @@ -426,13 +421,12 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest`): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -444,11 +438,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py index e8c0a293..160e68ef 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py @@ -115,22 +115,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ImageAnnotatorClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -143,7 +127,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ImageAnnotatorClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -267,10 +251,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ImageAnnotatorTransport]): The + transport (Union[str, ~.ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -381,13 +365,12 @@ def batch_annotate_images( images. Args: - request (google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest): + request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -399,7 +382,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse: + ~.image_annotator.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -459,15 +442,14 @@ def batch_annotate_files( extracted. Args: - request (google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest): + request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -479,7 +461,7 @@ def batch_annotate_files( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse: + ~.image_annotator.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -542,20 +524,18 @@ def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest): + request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): + requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): + output_config (:class:`~.image_annotator.OutputConfig`): Required. The desired output location and metadata (e.g. format). - This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -567,11 +547,11 @@ def async_batch_annotate_images( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: Response to an async batch image annotation request. """ @@ -642,13 +622,12 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest): + request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]): + requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. - This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -660,11 +639,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesResponse` + :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py index 41e45889..1c50dd67 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py @@ -109,7 +109,6 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) - from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -193,7 +192,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.CreateProductSetRequest`): + request (:class:`~.product_search_service.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -201,11 +200,10 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`google.cloud.vision_v1p4beta1.types.ProductSet`): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -216,7 +214,6 @@ async def create_product_set( 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 ``/``. - This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -228,7 +225,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -301,7 +298,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.ListProductSetsRequest`): + request (:class:`~.product_search_service.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -309,7 +306,6 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -321,8 +317,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsAsyncPager: - Response message for the ListProductSets method. + ~.pagers.ListProductSetsAsyncPager: + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -396,7 +392,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.GetProductSetRequest`): + request (:class:`~.product_search_service.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -404,7 +400,6 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -416,7 +411,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -491,22 +486,20 @@ async def update_product_set( characters. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest`): + request (:class:`~.product_search_service.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`google.cloud.vision_v1p4beta1.types.ProductSet`): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet resource which replaces the one on the server. - This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -518,7 +511,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -589,7 +582,7 @@ async def delete_product_set( Storage. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest`): + request (:class:`~.product_search_service.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -597,7 +590,6 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -676,7 +668,7 @@ async def create_product( invalid. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.CreateProductRequest`): + request (:class:`~.product_search_service.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -684,11 +676,10 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`google.cloud.vision_v1p4beta1.types.Product`): + product (:class:`~.product_search_service.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -699,7 +690,6 @@ async def create_product( 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 ``/``. - This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -711,7 +701,7 @@ async def create_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -779,7 +769,7 @@ async def list_products( less than 1. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.ListProductsRequest`): + request (:class:`~.product_search_service.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -787,7 +777,6 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -799,8 +788,8 @@ async def list_products( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsAsyncPager: - Response message for the ListProducts method. + ~.pagers.ListProductsAsyncPager: + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -874,7 +863,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.GetProductRequest`): + request (:class:`~.product_search_service.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -882,7 +871,6 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -894,7 +882,7 @@ async def get_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -971,24 +959,22 @@ async def update_product( update_mask. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.UpdateProductRequest`): + request (:class:`~.product_search_service.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`google.cloud.vision_v1p4beta1.types.Product`): + product (:class:`~.product_search_service.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1000,7 +986,7 @@ async def update_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1068,7 +1054,7 @@ async def delete_product( all related caches are refreshed. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.DeleteProductRequest`): + request (:class:`~.product_search_service.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1076,7 +1062,6 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1167,7 +1152,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest`): + request (:class:`~.product_search_service.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1176,15 +1161,13 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`google.cloud.vision_v1p4beta1.types.ReferenceImage`): + reference_image (:class:`~.product_search_service.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. - This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1194,7 +1177,6 @@ async def create_reference_image( 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 ``/``. - This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1206,9 +1188,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1277,7 +1259,7 @@ async def delete_reference_image( Storage. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest`): + request (:class:`~.product_search_service.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1287,7 +1269,6 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1361,7 +1342,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest`): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1370,7 +1351,6 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1382,8 +1362,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: - Response message for the ListReferenceImages method. + ~.pagers.ListReferenceImagesAsyncPager: + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1457,7 +1437,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest`): + request (:class:`~.product_search_service.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1467,7 +1447,6 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1479,9 +1458,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1551,7 +1530,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest`): + request (:class:`~.product_search_service.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1560,7 +1539,6 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1570,7 +1548,6 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1639,7 +1616,7 @@ async def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest`): + request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1648,7 +1625,6 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1658,7 +1634,6 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1733,7 +1708,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest`): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1742,7 +1717,6 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1754,8 +1728,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: - Response message for the ListProductsInProductSet + ~.pagers.ListProductsInProductSetAsyncPager: + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and @@ -1838,7 +1812,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest`): + request (:class:`~.product_search_service.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1846,14 +1820,12 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig`): + input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): Required. The input content for the list of requests. - This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1865,18 +1837,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:``~.product_search_service.ImportProductSetsResponse``: + Response message for the ``ImportProductSets`` method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -1971,7 +1943,7 @@ async def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`google.cloud.vision_v1p4beta1.types.PurgeProductsRequest`): + request (:class:`~.product_search_service.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. parent (:class:`str`): @@ -1979,7 +1951,6 @@ async def purge_products( should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1991,22 +1962,24 @@ async def purge_products( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); + :: - } + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } - The JSON representation for Empty is empty JSON - object {}. + The JSON representation for ``Empty`` is empty JSON + object ``{}``. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/client.py b/google/cloud/vision_v1p4beta1/services/product_search/client.py index a61c9ab0..dc704e28 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/client.py @@ -135,22 +135,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProductSearchClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -163,7 +147,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ProductSearchClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -308,10 +292,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ProductSearchTransport]): The + transport (Union[str, ~.ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -428,30 +412,28 @@ def create_product_set( longer than 4096 characters. Args: - request (google.cloud.vision_v1p4beta1.types.CreateProductSetRequest): + request (:class:`~.product_search_service.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. - parent (str): + parent (:class:`str`): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (google.cloud.vision_v1p4beta1.types.ProductSet): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (str): + product_set_id (:class:`str`): 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 ``/``. - This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -463,7 +445,7 @@ def create_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -531,15 +513,14 @@ def list_product_sets( less than 1. Args: - request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. - parent (str): + parent (:class:`str`): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -551,8 +532,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsPager: - Response message for the ListProductSets method. + ~.pagers.ListProductSetsPager: + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -619,15 +600,14 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (google.cloud.vision_v1p4beta1.types.GetProductSetRequest): + request (:class:`~.product_search_service.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. - name (str): + name (:class:`str`): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -639,7 +619,7 @@ def get_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -707,22 +687,20 @@ def update_product_set( characters. Args: - request (google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest): + request (:class:`~.product_search_service.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (google.cloud.vision_v1p4beta1.types.ProductSet): + product_set (:class:`~.product_search_service.ProductSet`): Required. The ProductSet resource which replaces the one on the server. - This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -734,7 +712,7 @@ def update_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ProductSet: + ~.product_search_service.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -800,15 +778,14 @@ def delete_product_set( Storage. Args: - request (google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest): + request (:class:`~.product_search_service.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. - name (str): + name (:class:`str`): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -880,30 +857,28 @@ def create_product( invalid. Args: - request (google.cloud.vision_v1p4beta1.types.CreateProductRequest): + request (:class:`~.product_search_service.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. - parent (str): + parent (:class:`str`): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (google.cloud.vision_v1p4beta1.types.Product): + product (:class:`~.product_search_service.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (str): + product_id (:class:`str`): 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 ``/``. - This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -915,7 +890,7 @@ def create_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -978,15 +953,14 @@ def list_products( less than 1. Args: - request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The request object. Request message for the `ListProducts` method. - parent (str): + parent (:class:`str`): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -998,8 +972,8 @@ def list_products( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsPager: - Response message for the ListProducts method. + ~.pagers.ListProductsPager: + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1066,15 +1040,14 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (google.cloud.vision_v1p4beta1.types.GetProductRequest): + request (:class:`~.product_search_service.GetProductRequest`): The request object. Request message for the `GetProduct` method. - name (str): + name (:class:`str`): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1086,7 +1059,7 @@ def get_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1156,24 +1129,22 @@ def update_product( update_mask. Args: - request (google.cloud.vision_v1p4beta1.types.UpdateProductRequest): + request (:class:`~.product_search_service.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (google.cloud.vision_v1p4beta1.types.Product): + product (:class:`~.product_search_service.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): The [FieldMask][google.protobuf.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``. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1185,7 +1156,7 @@ def update_product( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.Product: + ~.product_search_service.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1248,15 +1219,14 @@ def delete_product( all related caches are refreshed. Args: - request (google.cloud.vision_v1p4beta1.types.DeleteProductRequest): + request (:class:`~.product_search_service.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. - name (str): + name (:class:`str`): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1340,34 +1310,31 @@ def create_reference_image( 10 polygons. Args: - request (google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest): + request (:class:`~.product_search_service.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. - parent (str): + parent (:class:`str`): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (google.cloud.vision_v1p4beta1.types.ReferenceImage): + reference_image (:class:`~.product_search_service.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. - This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (str): + reference_image_id (:class:`str`): 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 ``/``. - This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1379,9 +1346,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1445,17 +1412,16 @@ def delete_reference_image( Storage. Args: - request (google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest): + request (:class:`~.product_search_service.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. - name (str): + name (:class:`str`): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1522,16 +1488,15 @@ def list_reference_images( 100, or less than 1. Args: - request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. - parent (str): + parent (:class:`str`): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1543,8 +1508,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesPager: - Response message for the ListReferenceImages method. + ~.pagers.ListReferenceImagesPager: + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1611,17 +1576,16 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest): + request (:class:`~.product_search_service.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. - name (str): + name (:class:`str`): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1633,9 +1597,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + ~.product_search_service.ReferenceImage: + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1698,26 +1662,24 @@ def add_product_to_product_set( exist. Args: - request (google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest): + request (:class:`~.product_search_service.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. - name (str): + name (:class:`str`): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (str): + product (:class:`str`): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1785,26 +1747,24 @@ def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest): + request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. - name (str): + name (:class:`str`): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (str): + product (:class:`str`): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` - This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1878,16 +1838,15 @@ def list_products_in_product_set( less than 1. Args: - request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. - name (str): + name (:class:`str`): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1899,8 +1858,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetPager: - Response message for the ListProductsInProductSet + ~.pagers.ListProductsInProductSetPager: + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and @@ -1980,22 +1939,20 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest): + request (:class:`~.product_search_service.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. - parent (str): + parent (:class:`str`): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig): + input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): Required. The input content for the list of requests. - This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2007,18 +1964,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:``~.product_search_service.ImportProductSetsResponse``: + Response message for the ``ImportProductSets`` method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -2108,15 +2065,14 @@ def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (google.cloud.vision_v1p4beta1.types.PurgeProductsRequest): + request (:class:`~.product_search_service.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. - parent (str): + parent (:class:`str`): Required. The project and location in which the Products should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2128,22 +2084,24 @@ def purge_products( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: + The result type for the operation will be + :class:``~.empty.Empty``: A generic empty message that + you can re-use to avoid defining duplicated empty + messages in your APIs. A typical example is to use it as + the request or the response type of an API method. For + instance: - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); + :: - } + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } - The JSON representation for Empty is empty JSON - object {}. + The JSON representation for ``Empty`` is empty JSON + object ``{}``. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py index 2c5d61b2..c3ac34cd 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` object, and + :class:`~.product_search_service.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` + All the usual :class:`~.product_search_service.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListProductSetsResponse): + response (:class:`~.product_search_service.ListProductSetsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` object, and + :class:`~.product_search_service.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` + All the usual :class:`~.product_search_service.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): + request (:class:`~.product_search_service.ListProductSetsRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListProductSetsResponse): + response (:class:`~.product_search_service.ListProductSetsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` object, and + :class:`~.product_search_service.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` + All the usual :class:`~.product_search_service.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListProductsResponse): + response (:class:`~.product_search_service.ListProductsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` object, and + :class:`~.product_search_service.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` + All the usual :class:`~.product_search_service.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): + request (:class:`~.product_search_service.ListProductsRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListProductsResponse): + response (:class:`~.product_search_service.ListProductsResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` object, and + :class:`~.product_search_service.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` + All the usual :class:`~.product_search_service.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse): + response (:class:`~.product_search_service.ListReferenceImagesResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` object, and + :class:`~.product_search_service.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` + All the usual :class:`~.product_search_service.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): + request (:class:`~.product_search_service.ListReferenceImagesRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse): + response (:class:`~.product_search_service.ListReferenceImagesResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` object, and + :class:`~.product_search_service.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` + All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse): + response (:class:`~.product_search_service.ListProductsInProductSetResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` object, and + :class:`~.product_search_service.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` + All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): + request (:class:`~.product_search_service.ListProductsInProductSetRequest`): The initial request object. - response (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse): + response (:class:`~.product_search_service.ListProductsInProductSetResponse`): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1p4beta1/types/face.py b/google/cloud/vision_v1p4beta1/types/face.py index 89fbc30b..34ca9aa9 100644 --- a/google/cloud/vision_v1p4beta1/types/face.py +++ b/google/cloud/vision_v1p4beta1/types/face.py @@ -64,7 +64,7 @@ class FaceRecognitionResult(proto.Message): r"""Information about a face's identity. Attributes: - celebrity (google.cloud.vision_v1p4beta1.types.Celebrity): + celebrity (~.face.Celebrity): The [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] that this face was matched to. confidence (float): diff --git a/google/cloud/vision_v1p4beta1/types/geometry.py b/google/cloud/vision_v1p4beta1/types/geometry.py index b43c8d06..60c32e6e 100644 --- a/google/cloud/vision_v1p4beta1/types/geometry.py +++ b/google/cloud/vision_v1p4beta1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.vision_v1p4beta1.types.Vertex]): + vertices (Sequence[~.geometry.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[google.cloud.vision_v1p4beta1.types.NormalizedVertex]): + normalized_vertices (Sequence[~.geometry.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1p4beta1/types/image_annotator.py b/google/cloud/vision_v1p4beta1/types/image_annotator.py index b4e3b321..98788127 100644 --- a/google/cloud/vision_v1p4beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p4beta1/types/image_annotator.py @@ -94,7 +94,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (google.cloud.vision_v1p4beta1.types.Feature.Type): + type_ (~.image_annotator.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -177,7 +177,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (google.cloud.vision_v1p4beta1.types.ImageSource): + source (~.image_annotator.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -194,7 +194,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human @@ -202,7 +202,7 @@ class FaceAnnotation(proto.Message): that one or more x and/or y coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): + fd_bounding_poly (~.geometry.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -210,7 +210,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[google.cloud.vision_v1p4beta1.types.FaceAnnotation.Landmark]): + landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -229,21 +229,21 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): + joy_likelihood (~.image_annotator.Likelihood): Joy likelihood. - sorrow_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): + sorrow_likelihood (~.image_annotator.Likelihood): Sorrow likelihood. - anger_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): + anger_likelihood (~.image_annotator.Likelihood): Anger likelihood. - surprise_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): + surprise_likelihood (~.image_annotator.Likelihood): Surprise likelihood. - under_exposed_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): + under_exposed_likelihood (~.image_annotator.Likelihood): Under-exposed likelihood. - blurred_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): + blurred_likelihood (~.image_annotator.Likelihood): Blurred likelihood. - headwear_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): + headwear_likelihood (~.image_annotator.Likelihood): Headwear likelihood. - recognition_result (Sequence[google.cloud.vision_v1p4beta1.types.FaceRecognitionResult]): + recognition_result (Sequence[~.face.FaceRecognitionResult]): Additional recognition information. Only computed if image_context.face_recognition_params is provided, **and** a match is found to a @@ -258,9 +258,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (google.cloud.vision_v1p4beta1.types.FaceAnnotation.Landmark.Type): + type_ (~.image_annotator.FaceAnnotation.Landmark.Type): Face landmark type. - position (google.cloud.vision_v1p4beta1.types.Position): + position (~.geometry.Position): Face landmark position. """ @@ -351,7 +351,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): lat/long location coordinates. """ @@ -406,17 +406,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[google.cloud.vision_v1p4beta1.types.LocationInfo]): + locations (Sequence[~.image_annotator.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[google.cloud.vision_v1p4beta1.types.Property]): + properties (Sequence[~.image_annotator.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -456,7 +456,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -478,21 +478,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (google.cloud.vision_v1p4beta1.types.Likelihood): + adult (~.image_annotator.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (google.cloud.vision_v1p4beta1.types.Likelihood): + spoof (~.image_annotator.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (google.cloud.vision_v1p4beta1.types.Likelihood): + medical (~.image_annotator.Likelihood): Likelihood that this is a medical image. - violence (google.cloud.vision_v1p4beta1.types.Likelihood): + violence (~.image_annotator.Likelihood): Likelihood that this image contains violent content. - racy (google.cloud.vision_v1p4beta1.types.Likelihood): + racy (~.image_annotator.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -516,9 +516,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (google.type.latlng_pb2.LatLng): + min_lat_lng (~.latlng.LatLng): Min lat/long pair. - max_lat_lng (google.type.latlng_pb2.LatLng): + max_lat_lng (~.latlng.LatLng): Max lat/long pair. """ @@ -532,7 +532,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (google.type.color_pb2.Color): + color (~.gt_color.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -552,7 +552,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[google.cloud.vision_v1p4beta1.types.ColorInfo]): + colors (Sequence[~.image_annotator.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -564,7 +564,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (google.cloud.vision_v1p4beta1.types.DominantColorsAnnotation): + dominant_colors (~.image_annotator.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -579,7 +579,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale. @@ -602,7 +602,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[google.cloud.vision_v1p4beta1.types.CropHint]): + crop_hints (Sequence[~.image_annotator.CropHint]): Crop hint results. """ @@ -657,7 +657,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (google.cloud.vision_v1p4beta1.types.LatLongRect): + lat_long_rect (~.image_annotator.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -670,15 +670,15 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (google.cloud.vision_v1p4beta1.types.CropHintsParams): + crop_hints_params (~.image_annotator.CropHintsParams): Parameters for crop hints annotation request. - face_recognition_params (google.cloud.vision_v1p4beta1.types.FaceRecognitionParams): + face_recognition_params (~.face.FaceRecognitionParams): Parameters for face recognition. - product_search_params (google.cloud.vision_v1p4beta1.types.ProductSearchParams): + product_search_params (~.product_search.ProductSearchParams): Parameters for product search. - web_detection_params (google.cloud.vision_v1p4beta1.types.WebDetectionParams): + web_detection_params (~.image_annotator.WebDetectionParams): Parameters for web detection. - text_detection_params (google.cloud.vision_v1p4beta1.types.TextDetectionParams): + text_detection_params (~.image_annotator.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -712,11 +712,11 @@ class AnnotateImageRequest(proto.Message): context information. Attributes: - image (google.cloud.vision_v1p4beta1.types.Image): + image (~.image_annotator.Image): The image to be processed. - features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Requested features. - image_context (google.cloud.vision_v1p4beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image. """ @@ -751,50 +751,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[google.cloud.vision_v1p4beta1.types.FaceAnnotation]): + face_annotations (Sequence[~.image_annotator.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): + landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): + logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): + label_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[google.cloud.vision_v1p4beta1.types.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): + text_annotations (Sequence[~.image_annotator.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (google.cloud.vision_v1p4beta1.types.TextAnnotation): + full_text_annotation (~.text_annotation.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (google.cloud.vision_v1p4beta1.types.SafeSearchAnnotation): + safe_search_annotation (~.image_annotator.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (google.cloud.vision_v1p4beta1.types.ImageProperties): + image_properties_annotation (~.image_annotator.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (google.cloud.vision_v1p4beta1.types.CropHintsAnnotation): + crop_hints_annotation (~.image_annotator.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (google.cloud.vision_v1p4beta1.types.WebDetection): + web_detection (~.gcv_web_detection.WebDetection): If present, web detection has completed successfully. - product_search_results (google.cloud.vision_v1p4beta1.types.ProductSearchResults): + product_search_results (~.product_search.ProductSearchResults): If present, product search has completed successfully. - error (google.rpc.status_pb2.Status): + error (~.status.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (google.cloud.vision_v1p4beta1.types.ImageAnnotationContext): + context (~.image_annotator.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -857,7 +857,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): + requests (Sequence[~.image_annotator.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -871,7 +871,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -886,11 +886,11 @@ class AnnotateFileRequest(proto.Message): GIF file. Attributes: - input_config (google.cloud.vision_v1p4beta1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Required. Information about the input file. - features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Required. Requested features. - image_context (google.cloud.vision_v1p4beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image(s) in the file. pages (Sequence[int]): @@ -926,16 +926,16 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (google.cloud.vision_v1p4beta1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Information about the file for which this response is generated. - responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageResponse]): + responses (Sequence[~.image_annotator.AnnotateImageResponse]): Individual responses to images found within the file. This field will be empty if the ``error`` field is set. total_pages (int): This field gives the total number of pages in the file. - error (google.rpc.status_pb2.Status): + error (~.status.Status): If set, represents the error message for the failed request. The ``responses`` field will not be set in this case. """ @@ -956,7 +956,7 @@ class BatchAnnotateFilesRequest(proto.Message): BatchAnnotateFiles API. Attributes: - requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]): + requests (Sequence[~.image_annotator.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in @@ -972,7 +972,7 @@ class BatchAnnotateFilesResponse(proto.Message): r"""A list of file annotation responses. Attributes: - responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileResponse]): + responses (Sequence[~.image_annotator.AnnotateFileResponse]): The list of file annotation responses, each response corresponding to each AnnotateFileRequest in @@ -988,14 +988,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (google.cloud.vision_v1p4beta1.types.InputConfig): + input_config (~.image_annotator.InputConfig): Required. Information about the input file. - features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): + features (Sequence[~.image_annotator.Feature]): Required. Requested features. - image_context (google.cloud.vision_v1p4beta1.types.ImageContext): + image_context (~.image_annotator.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1013,7 +1013,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -1025,10 +1025,10 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): r"""Request for async image annotation for a list of images. Attributes: - requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): + requests (Sequence[~.image_annotator.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. - output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1044,7 +1044,7 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): r"""Response to an async batch image annotation request. Attributes: - output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): + output_config (~.image_annotator.OutputConfig): The output location and metadata from AsyncBatchAnnotateImagesRequest. """ @@ -1057,7 +1057,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]): + requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -1071,7 +1071,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileResponse]): + responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -1086,7 +1086,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (google.cloud.vision_v1p4beta1.types.GcsSource): + gcs_source (~.image_annotator.GcsSource): The Google Cloud Storage location to read the input from. content (bytes): @@ -1114,7 +1114,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (google.cloud.vision_v1p4beta1.types.GcsDestination): + gcs_destination (~.image_annotator.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1191,11 +1191,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (google.cloud.vision_v1p4beta1.types.OperationMetadata.State): + state (~.image_annotator.OperationMetadata.State): Current state of the batch operation. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): The time when the batch request was received. - update_time (google.protobuf.timestamp_pb2.Timestamp): + update_time (~.timestamp.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p4beta1/types/product_search.py b/google/cloud/vision_v1p4beta1/types/product_search.py index f0aa53b8..e16037c9 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search.py +++ b/google/cloud/vision_v1p4beta1/types/product_search.py @@ -33,7 +33,7 @@ class ProductSearchParams(proto.Message): r"""Parameters for a product search request. Attributes: - bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the area of interest in the image. If it is not specified, system discretion will be applied. @@ -83,14 +83,14 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - index_time (google.protobuf.timestamp_pb2.Timestamp): + index_time (~.timestamp.Timestamp): Timestamp of the index which provided these results. Products added to the product set and products removed from the product set after this time are not reflected in the current results. - results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.Result]): + results (Sequence[~.product_search.ProductSearchResults.Result]): List of results, one for each product match. - product_grouped_results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.GroupedResult]): + product_grouped_results (Sequence[~.product_search.ProductSearchResults.GroupedResult]): List of results grouped by products detected in the query image. Each entry corresponds to one bounding polygon in the query image, and @@ -103,7 +103,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (google.cloud.vision_v1p4beta1.types.Product): + product (~.product_search_service.Product): The Product. score (float): A confidence level on the match, ranging from @@ -151,12 +151,12 @@ class GroupedResult(proto.Message): a query image. Attributes: - bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_poly (~.geometry.BoundingPoly): The bounding polygon around the product detected in the query image. - results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.Result]): + results (Sequence[~.product_search.ProductSearchResults.Result]): List of results, one for each product match. - object_annotations (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.ObjectAnnotation]): + object_annotations (Sequence[~.product_search.ProductSearchResults.ObjectAnnotation]): List of generic predictions for the object in the bounding box. """ diff --git a/google/cloud/vision_v1p4beta1/types/product_search_service.py b/google/cloud/vision_v1p4beta1/types/product_search_service.py index 25df6719..598c868d 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p4beta1/types/product_search_service.py @@ -87,7 +87,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[google.cloud.vision_v1p4beta1.types.Product.KeyValue]): + product_labels (Sequence[~.product_search_service.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -150,7 +150,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (google.protobuf.timestamp_pb2.Timestamp): + index_time (~.timestamp.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -160,7 +160,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (google.rpc.status_pb2.Status): + index_error (~.status.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -195,7 +195,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[google.cloud.vision_v1p4beta1.types.BoundingPoly]): + bounding_polys (Sequence[~.geometry.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -226,7 +226,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (google.cloud.vision_v1p4beta1.types.Product): + product (~.product_search_service.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -271,7 +271,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[google.cloud.vision_v1p4beta1.types.Product]): + products (Sequence[~.product_search_service.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -306,11 +306,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (google.cloud.vision_v1p4beta1.types.Product): + product (~.product_search_service.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -345,7 +345,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (google.cloud.vision_v1p4beta1.types.ProductSet): + product_set (~.product_search_service.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -390,7 +390,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[google.cloud.vision_v1p4beta1.types.ProductSet]): + product_sets (Sequence[~.product_search_service.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -425,10 +425,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (google.cloud.vision_v1p4beta1.types.ProductSet): + product_set (~.product_search_service.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -464,7 +464,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (google.cloud.vision_v1p4beta1.types.ReferenceImage): + reference_image (~.product_search_service.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -514,7 +514,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[google.cloud.vision_v1p4beta1.types.ReferenceImage]): + reference_images (Sequence[~.product_search_service.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -641,7 +641,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[google.cloud.vision_v1p4beta1.types.Product]): + products (Sequence[~.product_search_service.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -746,7 +746,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (google.cloud.vision_v1p4beta1.types.ImportProductSetsGcsSource): + gcs_source (~.product_search_service.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -766,7 +766,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig): + input_config (~.product_search_service.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -788,9 +788,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[google.cloud.vision_v1p4beta1.types.ReferenceImage]): + reference_images (Sequence[~.product_search_service.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[google.rpc.status_pb2.Status]): + statuses (Sequence[~.status.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -815,12 +815,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (google.cloud.vision_v1p4beta1.types.BatchOperationMetadata.State): + state (~.product_search_service.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (google.protobuf.timestamp_pb2.Timestamp): + submit_time (~.timestamp.Timestamp): The time when the batch request was submitted to the server. - end_time (google.protobuf.timestamp_pb2.Timestamp): + end_time (~.timestamp.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. @@ -861,7 +861,7 @@ class PurgeProductsRequest(proto.Message): r"""Request message for the ``PurgeProducts`` method. Attributes: - product_set_purge_config (google.cloud.vision_v1p4beta1.types.ProductSetPurgeConfig): + product_set_purge_config (~.product_search_service.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. delete_orphan_products (bool): diff --git a/google/cloud/vision_v1p4beta1/types/text_annotation.py b/google/cloud/vision_v1p4beta1/types/text_annotation.py index ee384d68..25c4f0c9 100644 --- a/google/cloud/vision_v1p4beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p4beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[google.cloud.vision_v1p4beta1.types.Page]): + pages (Sequence[~.text_annotation.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedBreak.BreakType): + type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedBreak): + detected_break (~.text_annotation.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[google.cloud.vision_v1p4beta1.types.Block]): + blocks (Sequence[~.text_annotation.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertex order will still be (0, 1, 2, 3). - paragraphs (Sequence[google.cloud.vision_v1p4beta1.types.Paragraph]): + paragraphs (Sequence[~.text_annotation.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (google.cloud.vision_v1p4beta1.types.Block.BlockType): + block_type (~.text_annotation.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - words (Sequence[google.cloud.vision_v1p4beta1.types.Word]): + words (Sequence[~.text_annotation.Word]): List of all words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - symbols (Sequence[google.cloud.vision_v1p4beta1.types.Symbol]): + symbols (Sequence[~.text_annotation.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): + property (~.text_annotation.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): + bounding_box (~.geometry.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p4beta1/types/web_detection.py b/google/cloud/vision_v1p4beta1/types/web_detection.py index c9efe25e..344fd0b0 100644 --- a/google/cloud/vision_v1p4beta1/types/web_detection.py +++ b/google/cloud/vision_v1p4beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebEntity]): + web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebPage]): + pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): + visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebLabel]): + best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): The service's best guess as to the topic of the request image. Inferred from similar images on the open web. @@ -98,10 +98,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): + full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): + partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/synth.metadata b/synth.metadata index fc28c011..a706fe1a 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-vision.git", - "sha": "2fa6dcd06b59debf1dba80e7061c83e3e3f972a9" + "sha": "62f5df93426f6d7fd796a470c2fa049f90dd56ed" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "add7e03ec4fff3491f6d3c007a36bcdf90408577", - "internalRef": "351871554" + "sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907", + "internalRef": "347055288" } }, { @@ -131,19 +131,12 @@ "docs/_templates/layout.html", "docs/conf.py", "docs/multiprocessing.rst", - "docs/vision_v1/image_annotator.rst", - "docs/vision_v1/product_search.rst", "docs/vision_v1/services.rst", "docs/vision_v1/types.rst", - "docs/vision_v1p2beta1/image_annotator.rst", "docs/vision_v1p2beta1/services.rst", "docs/vision_v1p2beta1/types.rst", - "docs/vision_v1p3beta1/image_annotator.rst", - "docs/vision_v1p3beta1/product_search.rst", "docs/vision_v1p3beta1/services.rst", "docs/vision_v1p3beta1/types.rst", - "docs/vision_v1p4beta1/image_annotator.rst", - "docs/vision_v1p4beta1/product_search.rst", "docs/vision_v1p4beta1/services.rst", "docs/vision_v1p4beta1/types.rst", "google/cloud/vision/__init__.py", diff --git a/tests/unit/gapic/vision_v1/test_image_annotator.py b/tests/unit/gapic/vision_v1/test_image_annotator.py index 58f82810..7e39be07 100644 --- a/tests/unit/gapic/vision_v1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1/test_image_annotator.py @@ -90,21 +90,8 @@ def test__get_default_mtls_endpoint(): ) -def test_image_annotator_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ImageAnnotatorClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -123,10 +110,7 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - available_transports = [ - transports.ImageAnnotatorGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ImageAnnotatorGrpcTransport transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -1399,7 +1383,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1411,7 +1395,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1436,7 +1420,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1492,7 +1476,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1/test_product_search.py b/tests/unit/gapic/vision_v1/test_product_search.py index 42a91e7a..52c594c3 100644 --- a/tests/unit/gapic/vision_v1/test_product_search.py +++ b/tests/unit/gapic/vision_v1/test_product_search.py @@ -93,21 +93,8 @@ def test__get_default_mtls_endpoint(): ) -def test_product_search_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ProductSearchClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class", [ProductSearchClient, ProductSearchAsyncClient] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -126,10 +113,7 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - available_transports = [ - transports.ProductSearchGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ProductSearchGrpcTransport transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -5381,7 +5365,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5393,7 +5377,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5416,7 +5400,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5472,7 +5456,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py index 8ac4ecea..4ee68cf4 100644 --- a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py @@ -86,21 +86,8 @@ def test__get_default_mtls_endpoint(): ) -def test_image_annotator_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ImageAnnotatorClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -119,10 +106,7 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - available_transports = [ - transports.ImageAnnotatorGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ImageAnnotatorGrpcTransport transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -817,7 +801,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -829,7 +813,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -854,7 +838,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -910,7 +894,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py index 600529d0..3527d957 100644 --- a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py @@ -90,21 +90,8 @@ def test__get_default_mtls_endpoint(): ) -def test_image_annotator_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ImageAnnotatorClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -123,10 +110,7 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - available_transports = [ - transports.ImageAnnotatorGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ImageAnnotatorGrpcTransport transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -1015,7 +999,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1027,7 +1011,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1052,7 +1036,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1108,7 +1092,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py index 00d38c6c..a2afe4ad 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py @@ -92,21 +92,8 @@ def test__get_default_mtls_endpoint(): ) -def test_image_annotator_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ImageAnnotatorClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -125,10 +112,7 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - available_transports = [ - transports.ImageAnnotatorGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ImageAnnotatorGrpcTransport transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -1017,7 +1001,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1029,7 +1013,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1054,7 +1038,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1110,7 +1094,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py index 9a5e4c64..af66ff8b 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py @@ -95,21 +95,8 @@ def test__get_default_mtls_endpoint(): ) -def test_product_search_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ProductSearchClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class", [ProductSearchClient, ProductSearchAsyncClient] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -128,10 +115,7 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - available_transports = [ - transports.ProductSearchGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ProductSearchGrpcTransport transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -5195,7 +5179,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5207,7 +5191,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5230,7 +5214,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5286,7 +5270,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py index 1724862d..2a8d5072 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py @@ -93,21 +93,8 @@ def test__get_default_mtls_endpoint(): ) -def test_image_annotator_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ImageAnnotatorClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -126,10 +113,7 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - available_transports = [ - transports.ImageAnnotatorGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ImageAnnotatorGrpcTransport transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -1402,7 +1386,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1414,7 +1398,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1439,7 +1423,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1495,7 +1479,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py index c95e6fc0..0ad20e9a 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py @@ -95,21 +95,8 @@ def test__get_default_mtls_endpoint(): ) -def test_product_search_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ProductSearchClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "vision.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class", [ProductSearchClient, ProductSearchAsyncClient] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -128,10 +115,7 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - available_transports = [ - transports.ProductSearchGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ProductSearchGrpcTransport transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -5383,7 +5367,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5395,7 +5379,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5418,7 +5402,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5474,7 +5458,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel From 48df6369a1b150dd04f4e5dc41cde712e59259bf Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:55:19 -0800 Subject: [PATCH 06/11] chore: upgrade gapic-generator-python to 0.40.5 PiperOrigin-RevId: 354996675 Source-Author: Google APIs Source-Date: Mon Feb 1 12:11:49 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 20712b8fe95001b312f62c6c5f33e3e3ec92cfaf Source-Link: https://github.com/googleapis/googleapis/commit/20712b8fe95001b312f62c6c5f33e3e3ec92cfaf --- .kokoro/test-samples.sh | 8 +- .kokoro/trampoline_v2.sh | 2 +- docs/vision_v1/image_annotator.rst | 6 + docs/vision_v1/product_search.rst | 11 + docs/vision_v1/services.rst | 10 +- docs/vision_v1/types.rst | 1 + docs/vision_v1p2beta1/image_annotator.rst | 6 + docs/vision_v1p2beta1/services.rst | 6 +- docs/vision_v1p2beta1/types.rst | 1 + docs/vision_v1p3beta1/image_annotator.rst | 6 + docs/vision_v1p3beta1/product_search.rst | 11 + docs/vision_v1p3beta1/services.rst | 10 +- docs/vision_v1p3beta1/types.rst | 1 + docs/vision_v1p4beta1/image_annotator.rst | 6 + docs/vision_v1p4beta1/product_search.rst | 11 + docs/vision_v1p4beta1/services.rst | 10 +- docs/vision_v1p4beta1/types.rst | 1 + .../services/image_annotator/async_client.py | 36 +-- .../services/image_annotator/client.py | 75 +++--- .../image_annotator/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../services/product_search/async_client.py | 163 +++++++----- .../services/product_search/client.py | 246 ++++++++++-------- .../services/product_search/pagers.py | 64 ++--- .../product_search/transports/grpc.py | 23 +- .../product_search/transports/grpc_asyncio.py | 23 +- google/cloud/vision_v1/types/geometry.py | 4 +- .../cloud/vision_v1/types/image_annotator.py | 156 +++++------ .../cloud/vision_v1/types/product_search.py | 16 +- .../vision_v1/types/product_search_service.py | 46 ++-- .../cloud/vision_v1/types/text_annotation.py | 36 +-- google/cloud/vision_v1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 8 +- .../services/image_annotator/client.py | 47 ++-- .../image_annotator/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../cloud/vision_v1p1beta1/types/geometry.py | 2 +- .../vision_v1p1beta1/types/image_annotator.py | 100 +++---- .../vision_v1p1beta1/types/text_annotation.py | 36 +-- .../vision_v1p1beta1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 17 +- .../services/image_annotator/client.py | 56 ++-- .../image_annotator/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../cloud/vision_v1p2beta1/types/geometry.py | 4 +- .../vision_v1p2beta1/types/image_annotator.py | 130 ++++----- .../vision_v1p2beta1/types/text_annotation.py | 36 +-- .../vision_v1p2beta1/types/web_detection.py | 16 +- google/cloud/vision_v1p3beta1/__init__.py | 4 +- .../services/image_annotator/async_client.py | 17 +- .../services/image_annotator/client.py | 56 ++-- .../image_annotator/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../services/product_search/async_client.py | 138 ++++++---- .../services/product_search/client.py | 219 +++++++++------- .../services/product_search/pagers.py | 64 ++--- .../product_search/transports/grpc.py | 23 +- .../product_search/transports/grpc_asyncio.py | 23 +- .../cloud/vision_v1p3beta1/types/geometry.py | 6 +- .../vision_v1p3beta1/types/image_annotator.py | 138 +++++----- .../vision_v1p3beta1/types/product_search.py | 18 +- .../types/product_search_service.py | 44 ++-- .../vision_v1p3beta1/types/text_annotation.py | 36 +-- .../vision_v1p3beta1/types/web_detection.py | 16 +- .../services/image_annotator/async_client.py | 36 +-- .../services/image_annotator/client.py | 75 +++--- .../image_annotator/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../services/product_search/async_client.py | 163 +++++++----- .../services/product_search/client.py | 246 ++++++++++-------- .../services/product_search/pagers.py | 64 ++--- .../product_search/transports/grpc.py | 23 +- .../product_search/transports/grpc_asyncio.py | 23 +- google/cloud/vision_v1p4beta1/types/face.py | 2 +- .../cloud/vision_v1p4beta1/types/geometry.py | 4 +- .../vision_v1p4beta1/types/image_annotator.py | 160 ++++++------ .../vision_v1p4beta1/types/product_search.py | 16 +- .../types/product_search_service.py | 46 ++-- .../vision_v1p4beta1/types/text_annotation.py | 36 +-- .../vision_v1p4beta1/types/web_detection.py | 16 +- synth.metadata | 13 +- .../gapic/vision_v1/test_image_annotator.py | 213 +++++++++------ .../gapic/vision_v1/test_product_search.py | 213 +++++++++------ .../vision_v1p1beta1/test_image_annotator.py | 213 +++++++++------ .../vision_v1p2beta1/test_image_annotator.py | 213 +++++++++------ .../vision_v1p3beta1/test_image_annotator.py | 213 +++++++++------ .../vision_v1p3beta1/test_product_search.py | 213 +++++++++------ .../vision_v1p4beta1/test_image_annotator.py | 213 +++++++++------ .../vision_v1p4beta1/test_product_search.py | 213 +++++++++------ 89 files changed, 3038 insertions(+), 2100 deletions(-) create mode 100644 docs/vision_v1/image_annotator.rst create mode 100644 docs/vision_v1/product_search.rst create mode 100644 docs/vision_v1p2beta1/image_annotator.rst create mode 100644 docs/vision_v1p3beta1/image_annotator.rst create mode 100644 docs/vision_v1p3beta1/product_search.rst create mode 100644 docs/vision_v1p4beta1/image_annotator.rst create mode 100644 docs/vision_v1p4beta1/product_search.rst diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index ec890026..b6bc8297 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do python3.6 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? - # If this is a periodic build, send the test log to the FlakyBot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. + # If this is a periodic build, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot + chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop + $KOKORO_GFILE_DIR/linux_amd64/buildcop fi if [[ $EXIT -ne 0 ]]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4af6cdc2..719bcd5b 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then "KOKORO_GITHUB_COMMIT" "KOKORO_GITHUB_PULL_REQUEST_NUMBER" "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For FlakyBot + # For Build Cop Bot "KOKORO_GITHUB_COMMIT_URL" "KOKORO_GITHUB_PULL_REQUEST_URL" ) diff --git a/docs/vision_v1/image_annotator.rst b/docs/vision_v1/image_annotator.rst new file mode 100644 index 00000000..83130a76 --- /dev/null +++ b/docs/vision_v1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1/product_search.rst b/docs/vision_v1/product_search.rst new file mode 100644 index 00000000..64e5cd02 --- /dev/null +++ b/docs/vision_v1/product_search.rst @@ -0,0 +1,11 @@ +ProductSearch +------------------------------- + +.. automodule:: google.cloud.vision_v1.services.product_search + :members: + :inherited-members: + + +.. automodule:: google.cloud.vision_v1.services.product_search.pagers + :members: + :inherited-members: diff --git a/docs/vision_v1/services.rst b/docs/vision_v1/services.rst index 0331ec53..5fe11bc5 100644 --- a/docs/vision_v1/services.rst +++ b/docs/vision_v1/services.rst @@ -1,9 +1,7 @@ Services for Google Cloud Vision v1 API ======================================= +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1.services.image_annotator - :members: - :inherited-members: -.. automodule:: google.cloud.vision_v1.services.product_search - :members: - :inherited-members: + image_annotator + product_search diff --git a/docs/vision_v1/types.rst b/docs/vision_v1/types.rst index dbbb594c..52d9869b 100644 --- a/docs/vision_v1/types.rst +++ b/docs/vision_v1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1 API .. automodule:: google.cloud.vision_v1.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p2beta1/image_annotator.rst b/docs/vision_v1p2beta1/image_annotator.rst new file mode 100644 index 00000000..d05fd549 --- /dev/null +++ b/docs/vision_v1p2beta1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1p2beta1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1p2beta1/services.rst b/docs/vision_v1p2beta1/services.rst index 55dc030c..2272ceb5 100644 --- a/docs/vision_v1p2beta1/services.rst +++ b/docs/vision_v1p2beta1/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Vision v1p2beta1 API ============================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1p2beta1.services.image_annotator - :members: - :inherited-members: + image_annotator diff --git a/docs/vision_v1p2beta1/types.rst b/docs/vision_v1p2beta1/types.rst index 898a797f..33ab32e0 100644 --- a/docs/vision_v1p2beta1/types.rst +++ b/docs/vision_v1p2beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1p2beta1 API .. automodule:: google.cloud.vision_v1p2beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p3beta1/image_annotator.rst b/docs/vision_v1p3beta1/image_annotator.rst new file mode 100644 index 00000000..a5ed7542 --- /dev/null +++ b/docs/vision_v1p3beta1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1p3beta1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1p3beta1/product_search.rst b/docs/vision_v1p3beta1/product_search.rst new file mode 100644 index 00000000..fd321a60 --- /dev/null +++ b/docs/vision_v1p3beta1/product_search.rst @@ -0,0 +1,11 @@ +ProductSearch +------------------------------- + +.. automodule:: google.cloud.vision_v1p3beta1.services.product_search + :members: + :inherited-members: + + +.. automodule:: google.cloud.vision_v1p3beta1.services.product_search.pagers + :members: + :inherited-members: diff --git a/docs/vision_v1p3beta1/services.rst b/docs/vision_v1p3beta1/services.rst index 591da113..06da9b3d 100644 --- a/docs/vision_v1p3beta1/services.rst +++ b/docs/vision_v1p3beta1/services.rst @@ -1,9 +1,7 @@ Services for Google Cloud Vision v1p3beta1 API ============================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1p3beta1.services.image_annotator - :members: - :inherited-members: -.. automodule:: google.cloud.vision_v1p3beta1.services.product_search - :members: - :inherited-members: + image_annotator + product_search diff --git a/docs/vision_v1p3beta1/types.rst b/docs/vision_v1p3beta1/types.rst index 8f60a298..5fdbaea1 100644 --- a/docs/vision_v1p3beta1/types.rst +++ b/docs/vision_v1p3beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1p3beta1 API .. automodule:: google.cloud.vision_v1p3beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/vision_v1p4beta1/image_annotator.rst b/docs/vision_v1p4beta1/image_annotator.rst new file mode 100644 index 00000000..28717262 --- /dev/null +++ b/docs/vision_v1p4beta1/image_annotator.rst @@ -0,0 +1,6 @@ +ImageAnnotator +-------------------------------- + +.. automodule:: google.cloud.vision_v1p4beta1.services.image_annotator + :members: + :inherited-members: diff --git a/docs/vision_v1p4beta1/product_search.rst b/docs/vision_v1p4beta1/product_search.rst new file mode 100644 index 00000000..e46b54b0 --- /dev/null +++ b/docs/vision_v1p4beta1/product_search.rst @@ -0,0 +1,11 @@ +ProductSearch +------------------------------- + +.. automodule:: google.cloud.vision_v1p4beta1.services.product_search + :members: + :inherited-members: + + +.. automodule:: google.cloud.vision_v1p4beta1.services.product_search.pagers + :members: + :inherited-members: diff --git a/docs/vision_v1p4beta1/services.rst b/docs/vision_v1p4beta1/services.rst index e8da2e62..2ebd0bbc 100644 --- a/docs/vision_v1p4beta1/services.rst +++ b/docs/vision_v1p4beta1/services.rst @@ -1,9 +1,7 @@ Services for Google Cloud Vision v1p4beta1 API ============================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.vision_v1p4beta1.services.image_annotator - :members: - :inherited-members: -.. automodule:: google.cloud.vision_v1p4beta1.services.product_search - :members: - :inherited-members: + image_annotator + product_search diff --git a/docs/vision_v1p4beta1/types.rst b/docs/vision_v1p4beta1/types.rst index 214f01b1..a90d1fa2 100644 --- a/docs/vision_v1p4beta1/types.rst +++ b/docs/vision_v1p4beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Vision v1p4beta1 API .. automodule:: google.cloud.vision_v1p4beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/google/cloud/vision_v1/services/image_annotator/async_client.py b/google/cloud/vision_v1/services/image_annotator/async_client.py index f441e263..8dc41443 100644 --- a/google/cloud/vision_v1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1/services/image_annotator/async_client.py @@ -83,6 +83,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -160,12 +161,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -177,7 +179,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -241,14 +243,15 @@ async def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1.types.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -260,7 +263,7 @@ async def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -327,18 +330,20 @@ async def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (:class:`google.cloud.vision_v1.types.OutputConfig`): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -350,11 +355,11 @@ async def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -427,12 +432,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -444,11 +450,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1/services/image_annotator/client.py b/google/cloud/vision_v1/services/image_annotator/client.py index cd963a34..70f1a314 100644 --- a/google/cloud/vision_v1/services/image_annotator/client.py +++ b/google/cloud/vision_v1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -290,21 +306,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -347,7 +359,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -365,12 +377,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -382,7 +395,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -442,14 +455,15 @@ def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (google.cloud.vision_v1.types.BatchAnnotateFilesRequest): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -461,7 +475,7 @@ def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -524,18 +538,20 @@ def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (google.cloud.vision_v1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -547,11 +563,11 @@ def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -622,12 +638,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -639,11 +656,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1/services/image_annotator/transports/grpc.py index 36536880..2f4c0437 100644 --- a/google/cloud/vision_v1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1/services/image_annotator/transports/grpc.py @@ -62,6 +62,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -92,6 +93,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -108,6 +113,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -117,11 +127,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -165,12 +170,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py index d95951d9..f1c4dd2a 100644 --- a/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -137,6 +138,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -153,6 +158,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -162,11 +172,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -210,12 +215,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1/services/product_search/async_client.py b/google/cloud/vision_v1/services/product_search/async_client.py index 11b5e016..4535cd22 100644 --- a/google/cloud/vision_v1/services/product_search/async_client.py +++ b/google/cloud/vision_v1/services/product_search/async_client.py @@ -107,6 +107,7 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) + from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -190,7 +191,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -198,10 +199,11 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1.types.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -212,6 +214,7 @@ async def create_product_set( 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -223,7 +226,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -296,7 +299,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (:class:`google.cloud.vision_v1.types.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -304,6 +307,7 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -315,8 +319,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsAsyncPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -390,7 +394,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -398,6 +402,7 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -409,7 +414,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -484,20 +489,22 @@ async def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1.types.ProductSet`): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -509,7 +516,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -582,7 +589,7 @@ async def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -590,6 +597,7 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -668,7 +676,7 @@ async def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (:class:`google.cloud.vision_v1.types.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -676,10 +684,11 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1.types.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -690,6 +699,7 @@ async def create_product( 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -701,7 +711,7 @@ async def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -769,7 +779,7 @@ async def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (:class:`google.cloud.vision_v1.types.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -777,6 +787,7 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -788,8 +799,8 @@ async def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsAsyncPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -863,7 +874,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (:class:`google.cloud.vision_v1.types.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -871,6 +882,7 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -882,7 +894,7 @@ async def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -959,22 +971,24 @@ async def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (:class:`google.cloud.vision_v1.types.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1.types.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -986,7 +1000,7 @@ async def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1056,7 +1070,7 @@ async def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (:class:`google.cloud.vision_v1.types.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1064,6 +1078,7 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1154,7 +1169,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (:class:`google.cloud.vision_v1.types.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1163,13 +1178,15 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (:class:`google.cloud.vision_v1.types.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1179,6 +1196,7 @@ async def create_reference_image( 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1190,9 +1208,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1261,7 +1279,7 @@ async def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (:class:`google.cloud.vision_v1.types.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1271,6 +1289,7 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1344,7 +1363,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (:class:`google.cloud.vision_v1.types.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1353,6 +1372,7 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1364,8 +1384,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesAsyncPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1439,7 +1459,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (:class:`google.cloud.vision_v1.types.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1449,6 +1469,7 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1460,9 +1481,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1532,7 +1553,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1541,6 +1562,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1550,6 +1572,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1620,7 +1643,7 @@ async def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1629,6 +1652,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1638,6 +1662,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1714,7 +1739,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (:class:`google.cloud.vision_v1.types.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1723,6 +1748,7 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1734,8 +1760,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetAsyncPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1818,7 +1844,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (:class:`google.cloud.vision_v1.types.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1826,12 +1852,14 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (:class:`google.cloud.vision_v1.types.ImportProductSetsInputConfig`): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1843,18 +1871,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -1949,7 +1977,7 @@ async def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (:class:`google.cloud.vision_v1.types.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. parent (:class:`str`): @@ -1957,6 +1985,7 @@ async def purge_products( should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1968,24 +1997,22 @@ async def purge_products( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1/services/product_search/client.py b/google/cloud/vision_v1/services/product_search/client.py index b79cb3da..d1ff5e2c 100644 --- a/google/cloud/vision_v1/services/product_search/client.py +++ b/google/cloud/vision_v1/services/product_search/client.py @@ -133,6 +133,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProductSearchClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -145,7 +161,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProductSearchClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -290,10 +306,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ProductSearchTransport]): The + transport (Union[str, ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -329,21 +345,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -386,7 +398,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -410,28 +422,30 @@ def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (google.cloud.vision_v1.types.CreateProductSetRequest): The request object. Request message for the `CreateProductSet` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (:class:`str`): + product_set_id (str): 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -443,7 +457,7 @@ def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -511,14 +525,15 @@ def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1.types.ListProductSetsRequest): The request object. Request message for the `ListProductSets` method. - parent (:class:`str`): + parent (str): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -530,8 +545,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -598,14 +613,15 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (google.cloud.vision_v1.types.GetProductSetRequest): The request object. Request message for the `GetProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -617,7 +633,7 @@ def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -685,20 +701,22 @@ def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (google.cloud.vision_v1.types.UpdateProductSetRequest): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -710,7 +728,7 @@ def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -776,14 +794,15 @@ def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (google.cloud.vision_v1.types.DeleteProductSetRequest): The request object. Request message for the `DeleteProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -855,28 +874,30 @@ def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (google.cloud.vision_v1.types.CreateProductRequest): The request object. Request message for the `CreateProduct` method. - parent (:class:`str`): + parent (str): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1.types.Product): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (:class:`str`): + product_id (str): 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -888,7 +909,7 @@ def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -951,14 +972,15 @@ def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1.types.ListProductsRequest): The request object. Request message for the `ListProducts` method. - parent (:class:`str`): + parent (str): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -970,8 +992,8 @@ def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1.services.product_search.pagers.ListProductsPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1038,14 +1060,15 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (google.cloud.vision_v1.types.GetProductRequest): The request object. Request message for the `GetProduct` method. - name (:class:`str`): + name (str): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1057,7 +1080,7 @@ def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1127,22 +1150,24 @@ def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (google.cloud.vision_v1.types.UpdateProductRequest): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1154,7 +1179,7 @@ def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1217,14 +1242,15 @@ def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (google.cloud.vision_v1.types.DeleteProductRequest): The request object. Request message for the `DeleteProduct` method. - name (:class:`str`): + name (str): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1308,31 +1334,34 @@ def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (google.cloud.vision_v1.types.CreateReferenceImageRequest): The request object. Request message for the `CreateReferenceImage` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (google.cloud.vision_v1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (:class:`str`): + reference_image_id (str): 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1344,9 +1373,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1410,16 +1439,17 @@ def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (google.cloud.vision_v1.types.DeleteReferenceImageRequest): The request object. Request message for the `DeleteReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1486,15 +1516,16 @@ def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1.types.ListReferenceImagesRequest): The request object. Request message for the `ListReferenceImages` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1506,8 +1537,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1574,16 +1605,17 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (google.cloud.vision_v1.types.GetReferenceImageRequest): The request object. Request message for the `GetReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1595,9 +1627,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1660,24 +1692,26 @@ def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (google.cloud.vision_v1.types.AddProductToProductSetRequest): The request object. Request message for the `AddProductToProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1745,24 +1779,26 @@ def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (google.cloud.vision_v1.types.RemoveProductFromProductSetRequest): The request object. Request message for the `RemoveProductFromProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1836,15 +1872,16 @@ def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): The request object. Request message for the `ListProductsInProductSet` method. - name (:class:`str`): + name (str): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1856,8 +1893,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1937,20 +1974,22 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (google.cloud.vision_v1.types.ImportProductSetsRequest): The request object. Request message for the `ImportProductSets` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (google.cloud.vision_v1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1962,18 +2001,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -2063,14 +2102,15 @@ def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (google.cloud.vision_v1.types.PurgeProductsRequest): The request object. Request message for the `PurgeProducts` method. - parent (:class:`str`): + parent (str): Required. The project and location in which the Products should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2082,24 +2122,22 @@ def purge_products( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1/services/product_search/pagers.py b/google/cloud/vision_v1/services/product_search/pagers.py index 69bc017f..cf8c6a00 100644 --- a/google/cloud/vision_v1/services/product_search/pagers.py +++ b/google/cloud/vision_v1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1/services/product_search/transports/grpc.py b/google/cloud/vision_v1/services/product_search/transports/grpc.py index 76d646b7..fead6543 100644 --- a/google/cloud/vision_v1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1/services/product_search/transports/grpc.py @@ -77,6 +77,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -107,6 +108,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -123,6 +128,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -132,11 +142,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -180,12 +185,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py b/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py index 76a9a2cf..9387ce67 100644 --- a/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py @@ -121,6 +121,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -152,6 +153,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -168,6 +173,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -177,11 +187,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -225,12 +230,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1/types/geometry.py b/google/cloud/vision_v1/types/geometry.py index be6f5602..05db4f69 100644 --- a/google/cloud/vision_v1/types/geometry.py +++ b/google/cloud/vision_v1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1/types/image_annotator.py b/google/cloud/vision_v1/types/image_annotator.py index 462baf72..4f901266 100644 --- a/google/cloud/vision_v1/types/image_annotator.py +++ b/google/cloud/vision_v1/types/image_annotator.py @@ -93,7 +93,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -176,7 +176,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -193,7 +193,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human @@ -201,7 +201,7 @@ class FaceAnnotation(proto.Message): that one or more x and/or y coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -209,7 +209,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -228,19 +228,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1.types.Likelihood): Headwear likelihood. """ @@ -248,9 +248,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1.types.Position): Face landmark position. """ @@ -337,7 +337,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -392,17 +392,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -442,7 +442,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -464,21 +464,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -532,9 +532,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -548,7 +548,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -568,7 +568,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -580,7 +580,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -595,7 +595,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale. @@ -618,7 +618,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1.types.CropHint]): Crop hint results. """ @@ -673,7 +673,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -686,13 +686,13 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1.types.CropHintsParams): Parameters for crop hints annotation request. - product_search_params (~.product_search.ProductSearchParams): + product_search_params (google.cloud.vision_v1.types.ProductSearchParams): Parameters for product search. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -722,11 +722,11 @@ class AnnotateImageRequest(proto.Message): context information. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1.types.ImageContext): Additional context that may accompany the image. """ @@ -761,50 +761,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[google.cloud.vision_v1.types.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1.types.WebDetection): If present, web detection has completed successfully. - product_search_results (~.product_search.ProductSearchResults): + product_search_results (google.cloud.vision_v1.types.ProductSearchResults): If present, product search has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -867,7 +867,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. parent (str): @@ -896,7 +896,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -911,11 +911,11 @@ class AnnotateFileRequest(proto.Message): GIF file. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1.types.ImageContext): Additional context that may accompany the image(s) in the file. pages (Sequence[int]): @@ -951,16 +951,16 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]): Individual responses to images found within the file. This field will be empty if the ``error`` field is set. total_pages (int): This field gives the total number of pages in the file. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the failed request. The ``responses`` field will not be set in this case. """ @@ -981,7 +981,7 @@ class BatchAnnotateFilesRequest(proto.Message): BatchAnnotateFiles API. Attributes: - requests (Sequence[~.image_annotator.AnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in @@ -1012,7 +1012,7 @@ class BatchAnnotateFilesResponse(proto.Message): r"""A list of file annotation responses. Attributes: - responses (Sequence[~.image_annotator.AnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1.types.AnnotateFileResponse]): The list of file annotation responses, each response corresponding to each AnnotateFileRequest in @@ -1028,14 +1028,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1053,7 +1053,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -1065,10 +1065,10 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): r"""Request for async image annotation for a list of images. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). parent (str): @@ -1099,7 +1099,7 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): r"""Response to an async batch image annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1.types.OutputConfig): The output location and metadata from AsyncBatchAnnotateImagesRequest. """ @@ -1112,7 +1112,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. parent (str): @@ -1141,7 +1141,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -1156,7 +1156,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1.types.GcsSource): The Google Cloud Storage location to read the input from. content (bytes): @@ -1184,7 +1184,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1261,11 +1261,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1/types/product_search.py b/google/cloud/vision_v1/types/product_search.py index 6ae8f236..127bbb97 100644 --- a/google/cloud/vision_v1/types/product_search.py +++ b/google/cloud/vision_v1/types/product_search.py @@ -33,7 +33,7 @@ class ProductSearchParams(proto.Message): r"""Parameters for a product search request. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. @@ -83,14 +83,14 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of the index which provided these results. Products added to the product set and products removed from the product set after this time are not reflected in the current results. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]): List of results, one for each product match. - product_grouped_results (Sequence[~.product_search.ProductSearchResults.GroupedResult]): + product_grouped_results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.GroupedResult]): List of results grouped by products detected in the query image. Each entry corresponds to one bounding polygon in the query image, and @@ -103,7 +103,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1.types.Product): The Product. score (float): A confidence level on the match, ranging from @@ -151,12 +151,12 @@ class GroupedResult(proto.Message): a query image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon around the product detected in the query image. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]): List of results, one for each product match. - object_annotations (Sequence[~.product_search.ProductSearchResults.ObjectAnnotation]): + object_annotations (Sequence[google.cloud.vision_v1.types.ProductSearchResults.ObjectAnnotation]): List of generic predictions for the object in the bounding box. """ diff --git a/google/cloud/vision_v1/types/product_search_service.py b/google/cloud/vision_v1/types/product_search_service.py index f06e2eee..158deb5a 100644 --- a/google/cloud/vision_v1/types/product_search_service.py +++ b/google/cloud/vision_v1/types/product_search_service.py @@ -87,7 +87,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[~.product_search_service.Product.KeyValue]): + product_labels (Sequence[google.cloud.vision_v1.types.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -150,7 +150,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -160,7 +160,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (~.status.Status): + index_error (google.rpc.status_pb2.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -195,7 +195,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[~.geometry.BoundingPoly]): + bounding_polys (Sequence[google.cloud.vision_v1.types.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -226,7 +226,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (~.product_search_service.Product): + product (google.cloud.vision_v1.types.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -271,7 +271,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1.types.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -306,11 +306,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -345,7 +345,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -390,7 +390,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[~.product_search_service.ProductSet]): + product_sets (Sequence[google.cloud.vision_v1.types.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -425,10 +425,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -464,7 +464,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (~.product_search_service.ReferenceImage): + reference_image (google.cloud.vision_v1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -514,7 +514,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1.types.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -641,7 +641,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1.types.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -746,7 +746,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (~.product_search_service.ImportProductSetsGcsSource): + gcs_source (google.cloud.vision_v1.types.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -766,7 +766,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (~.product_search_service.ImportProductSetsInputConfig): + input_config (google.cloud.vision_v1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -788,9 +788,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1.types.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[~.status.Status]): + statuses (Sequence[google.rpc.status_pb2.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -815,12 +815,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (~.product_search_service.BatchOperationMetadata.State): + state (google.cloud.vision_v1.types.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (~.timestamp.Timestamp): + submit_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was submitted to the server. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. @@ -861,7 +861,7 @@ class PurgeProductsRequest(proto.Message): r"""Request message for the ``PurgeProducts`` method. Attributes: - product_set_purge_config (~.product_search_service.ProductSetPurgeConfig): + product_set_purge_config (google.cloud.vision_v1.types.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. delete_orphan_products (bool): diff --git a/google/cloud/vision_v1/types/text_annotation.py b/google/cloud/vision_v1/types/text_annotation.py index fa3b88ae..3f8e73a8 100644 --- a/google/cloud/vision_v1/types/text_annotation.py +++ b/google/cloud/vision_v1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertex order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1.types.Word]): List of all words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1/types/web_detection.py b/google/cloud/vision_v1/types/web_detection.py index 9395af29..7aa82a25 100644 --- a/google/cloud/vision_v1/types/web_detection.py +++ b/google/cloud/vision_v1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1.types.WebDetection.WebLabel]): The service's best guess as to the topic of the request image. Inferred from similar images on the open web. @@ -98,10 +98,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py index 9099dd92..a5154e9d 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py @@ -76,6 +76,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -153,12 +154,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -170,7 +172,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py index 9b133ea1..5fd7dee1 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py @@ -113,6 +113,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -125,7 +141,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -217,10 +233,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -256,21 +272,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -313,7 +325,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -331,12 +343,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -348,7 +361,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py index 8dce4d82..3ed52718 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py @@ -60,6 +60,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -90,6 +91,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -106,6 +111,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -115,11 +125,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -163,12 +168,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py index 385f11ed..66f68f26 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py @@ -104,6 +104,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -135,6 +136,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -151,6 +156,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -160,11 +170,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -208,12 +213,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p1beta1/types/geometry.py b/google/cloud/vision_v1p1beta1/types/geometry.py index de248804..f581bee0 100644 --- a/google/cloud/vision_v1p1beta1/types/geometry.py +++ b/google/cloud/vision_v1p1beta1/types/geometry.py @@ -45,7 +45,7 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p1beta1.types.Vertex]): The bounding polygon vertices. """ diff --git a/google/cloud/vision_v1p1beta1/types/image_annotator.py b/google/cloud/vision_v1p1beta1/types/image_annotator.py index be04b15f..93f03cb8 100644 --- a/google/cloud/vision_v1p1beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p1beta1/types/image_annotator.py @@ -76,7 +76,7 @@ class Feature(proto.Message): return. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p1beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. @@ -145,7 +145,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: as with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p1beta1.types.ImageSource): Google Cloud Storage image location. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to perform the image annotation @@ -162,7 +162,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -171,7 +171,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -179,7 +179,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -198,19 +198,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p1beta1.types.Likelihood): Headwear likelihood. """ @@ -218,9 +218,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p1beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p1beta1.types.Position): Face landmark position. """ @@ -307,7 +307,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -361,17 +361,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p1beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p1beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -402,21 +402,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p1beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p1beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p1beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p1beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p1beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -440,9 +440,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -456,7 +456,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -476,7 +476,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p1beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -488,7 +488,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p1beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -503,7 +503,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -526,7 +526,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p1beta1.types.CropHint]): Crop hint results. """ @@ -581,7 +581,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p1beta1.types.LatLongRect): lat/long rectangle that specifies the location of the image. language_hints (Sequence[str]): @@ -595,11 +595,11 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p1beta1.types.CropHintsParams): Parameters for crop hints annotation request. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p1beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p1beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -624,11 +624,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p1beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p1beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p1beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -644,39 +644,39 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p1beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p1beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p1beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p1beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p1beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p1beta1.types.WebDetection): If present, web detection has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. @@ -730,7 +730,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -744,7 +744,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ diff --git a/google/cloud/vision_v1p1beta1/types/text_annotation.py b/google/cloud/vision_v1p1beta1/types/text_annotation.py index 8e231b4b..23b249fe 100644 --- a/google/cloud/vision_v1p1beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p1beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p1beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p1beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,13 +113,13 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width in pixels. height (int): Page height in pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p1beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -143,10 +143,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -158,10 +158,10 @@ class Block(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p1beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p1beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -195,10 +195,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -210,7 +210,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p1beta1.types.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -232,9 +232,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -246,7 +246,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p1beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -269,10 +269,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p1beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p1beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p1beta1/types/web_detection.py b/google/cloud/vision_v1p1beta1/types/web_detection.py index 6bd91777..1e9586d6 100644 --- a/google/cloud/vision_v1p1beta1/types/web_detection.py +++ b/google/cloud/vision_v1p1beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p1beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py index e28c5f19..c2efa184 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py @@ -78,6 +78,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -155,12 +156,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -172,7 +174,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -235,12 +237,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -252,11 +255,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py index c86c318b..be73d3f1 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -219,10 +235,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -258,21 +274,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -315,7 +327,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -333,12 +345,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -350,7 +363,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -409,12 +422,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -426,11 +440,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py index 4795a3d6..fb17444c 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py @@ -62,6 +62,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -92,6 +93,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -108,6 +113,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -117,11 +127,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -165,12 +170,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py index aba72790..8b0c705f 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -137,6 +138,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -153,6 +158,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -162,11 +172,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -210,12 +215,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p2beta1/types/geometry.py b/google/cloud/vision_v1p2beta1/types/geometry.py index 482f5ec2..42fb6ec0 100644 --- a/google/cloud/vision_v1p2beta1/types/geometry.py +++ b/google/cloud/vision_v1p2beta1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p2beta1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1p2beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1p2beta1/types/image_annotator.py b/google/cloud/vision_v1p2beta1/types/image_annotator.py index 0f3bee9c..5480edb6 100644 --- a/google/cloud/vision_v1p2beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p2beta1/types/image_annotator.py @@ -86,7 +86,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p2beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -167,7 +167,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p2beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -184,7 +184,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -193,7 +193,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -201,7 +201,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -220,19 +220,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p2beta1.types.Likelihood): Headwear likelihood. """ @@ -240,9 +240,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p2beta1.types.Position): Face landmark position. """ @@ -329,7 +329,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -384,17 +384,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p2beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p2beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -425,21 +425,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p2beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p2beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p2beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p2beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p2beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -463,9 +463,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -479,7 +479,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -499,7 +499,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p2beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -511,7 +511,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p2beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -526,7 +526,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -549,7 +549,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p2beta1.types.CropHint]): Crop hint results. """ @@ -604,7 +604,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p2beta1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -617,11 +617,11 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p2beta1.types.CropHintsParams): Parameters for crop hints annotation request. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p2beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p2beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -646,11 +646,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p2beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p2beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p2beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -685,43 +685,43 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p2beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p2beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p2beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p2beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p2beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p2beta1.types.WebDetection): If present, web detection has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1p2beta1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -777,10 +777,10 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p2beta1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]): Individual responses to images found within the file. """ @@ -797,7 +797,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -811,7 +811,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -825,14 +825,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p2beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p2beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p2beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p2beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -850,7 +850,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p2beta1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -863,7 +863,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -877,7 +877,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -892,7 +892,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1p2beta1.types.GcsSource): The Google Cloud Storage location to read the input from. mime_type (str): @@ -910,7 +910,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1p2beta1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -978,11 +978,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1p2beta1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p2beta1/types/text_annotation.py b/google/cloud/vision_v1p2beta1/types/text_annotation.py index c7c6de3d..e2366e17 100644 --- a/google/cloud/vision_v1p2beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p2beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p2beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p2beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p2beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p2beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p2beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p2beta1.types.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p2beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p2beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p2beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p2beta1/types/web_detection.py b/google/cloud/vision_v1p2beta1/types/web_detection.py index 1a4f954d..d3a7ffee 100644 --- a/google/cloud/vision_v1p2beta1/types/web_detection.py +++ b/google/cloud/vision_v1p2beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p2beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index b38431b4..c00754cf 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,6 +143,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -172,7 +173,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py index c9e14583..1ca98853 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py @@ -83,6 +83,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -160,12 +161,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]`): Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -177,7 +179,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -240,12 +242,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -257,11 +260,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py index 6792a030..975509de 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -290,21 +306,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -347,7 +359,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -365,12 +377,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]): Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -382,7 +395,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -441,12 +454,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -458,11 +472,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py index 7edc9581..4c12c285 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py @@ -62,6 +62,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -92,6 +93,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -108,6 +113,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -117,11 +127,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -165,12 +170,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py index c496e829..d502a506 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -137,6 +138,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -153,6 +158,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -162,11 +172,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -210,12 +215,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py index 60c3a3cd..6a7c3022 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py @@ -108,6 +108,7 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) + from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -191,7 +192,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -199,10 +200,11 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p3beta1.types.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -213,6 +215,7 @@ async def create_product_set( 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -224,7 +227,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -297,7 +300,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -305,6 +308,7 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -316,8 +320,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsAsyncPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsAsyncPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -391,7 +395,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -399,6 +403,7 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -410,7 +415,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -485,20 +490,22 @@ async def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p3beta1.types.ProductSet`): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -510,7 +517,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -586,7 +593,7 @@ async def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -594,6 +601,7 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -672,7 +680,7 @@ async def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -680,10 +688,11 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p3beta1.types.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -694,6 +703,7 @@ async def create_product( 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -705,7 +715,7 @@ async def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -773,7 +783,7 @@ async def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -781,6 +791,7 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -792,8 +803,8 @@ async def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsAsyncPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsAsyncPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -867,7 +878,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -875,6 +886,7 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -886,7 +898,7 @@ async def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -963,22 +975,24 @@ async def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p3beta1.types.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -990,7 +1004,7 @@ async def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1061,7 +1075,7 @@ async def delete_product( - Returns NOT_FOUND if the product does not exist. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1069,6 +1083,7 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1159,7 +1174,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1168,13 +1183,15 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (:class:`google.cloud.vision_v1p3beta1.types.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1184,6 +1201,7 @@ async def create_reference_image( 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1195,9 +1213,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1271,7 +1289,7 @@ async def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1281,6 +1299,7 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1354,7 +1373,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1363,6 +1382,7 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1374,8 +1394,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesAsyncPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1449,7 +1469,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1459,6 +1479,7 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1470,9 +1491,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1542,7 +1563,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1551,6 +1572,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1560,6 +1582,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1633,7 +1656,7 @@ async def remove_product_from_product_set( ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1642,6 +1665,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1651,6 +1675,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1725,7 +1750,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1734,6 +1759,7 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1745,8 +1771,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetAsyncPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1829,7 +1855,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (:class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1837,12 +1863,14 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (:class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig`): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1854,18 +1882,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. + + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/client.py b/google/cloud/vision_v1p3beta1/services/product_search/client.py index 804985ed..729476be 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/client.py @@ -134,6 +134,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProductSearchClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -146,7 +162,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProductSearchClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -291,10 +307,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ProductSearchTransport]): The + transport (Union[str, ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -330,21 +346,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -387,7 +399,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -411,28 +423,30 @@ def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.CreateProductSetRequest): The request object. Request message for the `CreateProductSet` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (:class:`str`): + product_set_id (str): 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -444,7 +458,7 @@ def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -512,14 +526,15 @@ def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): The request object. Request message for the `ListProductSets` method. - parent (:class:`str`): + parent (str): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -531,8 +546,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -599,14 +614,15 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.GetProductSetRequest): The request object. Request message for the `GetProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -618,7 +634,7 @@ def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -686,20 +702,22 @@ def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -711,7 +729,7 @@ def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p3beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -782,14 +800,15 @@ def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest): The request object. Request message for the `DeleteProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -861,28 +880,30 @@ def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (google.cloud.vision_v1p3beta1.types.CreateProductRequest): The request object. Request message for the `CreateProduct` method. - parent (:class:`str`): + parent (str): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (:class:`str`): + product_id (str): 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -894,7 +915,7 @@ def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -957,14 +978,15 @@ def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): The request object. Request message for the `ListProducts` method. - parent (:class:`str`): + parent (str): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -976,8 +998,8 @@ def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1044,14 +1066,15 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (google.cloud.vision_v1p3beta1.types.GetProductRequest): The request object. Request message for the `GetProduct` method. - name (:class:`str`): + name (str): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1063,7 +1086,7 @@ def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1133,22 +1156,24 @@ def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (google.cloud.vision_v1p3beta1.types.UpdateProductRequest): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1160,7 +1185,7 @@ def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p3beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1226,14 +1251,15 @@ def delete_product( - Returns NOT_FOUND if the product does not exist. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (google.cloud.vision_v1p3beta1.types.DeleteProductRequest): The request object. Request message for the `DeleteProduct` method. - name (:class:`str`): + name (str): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1317,31 +1343,34 @@ def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest): The request object. Request message for the `CreateReferenceImage` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (google.cloud.vision_v1p3beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (:class:`str`): + reference_image_id (str): 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1353,9 +1382,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1424,16 +1453,17 @@ def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest): The request object. Request message for the `DeleteReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1500,15 +1530,16 @@ def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): The request object. Request message for the `ListReferenceImages` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1520,8 +1551,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1588,16 +1619,17 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest): The request object. Request message for the `GetReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1609,9 +1641,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p3beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1674,24 +1706,26 @@ def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest): The request object. Request message for the `AddProductToProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1764,24 +1798,26 @@ def remove_product_from_product_set( ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest): The request object. Request message for the `RemoveProductFromProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1855,15 +1891,16 @@ def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): The request object. Request message for the `ListProductsInProductSet` method. - name (:class:`str`): + name (str): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1875,8 +1912,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1956,20 +1993,22 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest): The request object. Request message for the `ImportProductSets` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1981,18 +2020,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. + + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py index 85829a6e..b145dd71 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p3beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p3beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py b/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py index d48af7d8..b2fc91ee 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py @@ -79,6 +79,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -109,6 +110,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -125,6 +130,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -134,11 +144,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -182,12 +187,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py b/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py index 68078018..082a5a4a 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py @@ -123,6 +123,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -154,6 +155,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -170,6 +175,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -179,11 +189,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -227,12 +232,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p3beta1/types/geometry.py b/google/cloud/vision_v1p3beta1/types/geometry.py index e6107175..c1b1fd91 100644 --- a/google/cloud/vision_v1p3beta1/types/geometry.py +++ b/google/cloud/vision_v1p3beta1/types/geometry.py @@ -68,9 +68,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p3beta1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1p3beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ @@ -85,7 +85,7 @@ class NormalizedBoundingPoly(proto.Message): r"""A normalized bounding polygon around a portion of an image. Attributes: - vertices (Sequence[~.geometry.NormalizedVertex]): + vertices (Sequence[google.cloud.vision_v1p3beta1.types.NormalizedVertex]): Normalized vertices of the bounding polygon. """ diff --git a/google/cloud/vision_v1p3beta1/types/image_annotator.py b/google/cloud/vision_v1p3beta1/types/image_annotator.py index 7c5f1d41..0af98b5a 100644 --- a/google/cloud/vision_v1p3beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p3beta1/types/image_annotator.py @@ -88,7 +88,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p3beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -171,7 +171,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p3beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -188,7 +188,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. The bounding box is computed to "frame" @@ -197,7 +197,7 @@ class FaceAnnotation(proto.Message): coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -205,7 +205,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p3beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -224,19 +224,19 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p3beta1.types.Likelihood): Headwear likelihood. """ @@ -244,9 +244,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p3beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p3beta1.types.Position): Face landmark position. """ @@ -333,7 +333,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -388,17 +388,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p3beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p3beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -438,7 +438,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -460,21 +460,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p3beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p3beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p3beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p3beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p3beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -498,9 +498,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -514,7 +514,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -534,7 +534,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p3beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -546,7 +546,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p3beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -561,7 +561,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale, as returned in ``ImageParams``. @@ -584,7 +584,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p3beta1.types.CropHint]): Crop hint results. """ @@ -639,7 +639,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p3beta1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -652,13 +652,13 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p3beta1.types.CropHintsParams): Parameters for crop hints annotation request. - product_search_params (~.product_search.ProductSearchParams): + product_search_params (google.cloud.vision_v1p3beta1.types.ProductSearchParams): Parameters for product search. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p3beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p3beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -687,11 +687,11 @@ class AnnotateImageRequest(proto.Message): user-provided image, with user-requested features. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p3beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p3beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p3beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -726,50 +726,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p3beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[google.cloud.vision_v1p3beta1.types.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p3beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p3beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p3beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p3beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p3beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p3beta1.types.WebDetection): If present, web detection has completed successfully. - product_search_results (~.product_search.ProductSearchResults): + product_search_results (google.cloud.vision_v1p3beta1.types.ProductSearchResults): If present, product search has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1p3beta1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -833,10 +833,10 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p3beta1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageResponse]): Individual responses to images found within the file. """ @@ -853,7 +853,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]): Individual image annotation requests for this batch. """ @@ -867,7 +867,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -881,14 +881,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p3beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p3beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p3beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p3beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -906,7 +906,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p3beta1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -919,7 +919,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -933,7 +933,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -948,7 +948,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1p3beta1.types.GcsSource): The Google Cloud Storage location to read the input from. mime_type (str): @@ -966,7 +966,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1p3beta1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1034,11 +1034,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1p3beta1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p3beta1/types/product_search.py b/google/cloud/vision_v1p3beta1/types/product_search.py index 375bd701..43cb9f3a 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search.py +++ b/google/cloud/vision_v1p3beta1/types/product_search.py @@ -55,7 +55,7 @@ class ProductSearchParams(proto.Message): The resource name of the catalog to search. Format is: ``productSearch/catalogs/CATALOG_NAME``. - category (~.product_search.ProductSearchCategory): + category (google.cloud.vision_v1p3beta1.types.ProductSearchCategory): The category to search in. Optional. It is inferred by the system if it is not specified. [Deprecated] Use ``product_category``. @@ -64,15 +64,15 @@ class ProductSearchParams(proto.Message): by the system if it is not specified. Supported values are ``bag``, ``shoe``, ``sunglasses``, ``dress``, ``outerwear``, ``skirt``, ``top``, ``shorts``, and ``pants``. - normalized_bounding_poly (~.geometry.NormalizedBoundingPoly): + normalized_bounding_poly (google.cloud.vision_v1p3beta1.types.NormalizedBoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. [Deprecated] Use ``bounding_poly``. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied. - view (~.product_search.ProductSearchResultsView): + view (google.cloud.vision_v1p3beta1.types.ProductSearchResultsView): Specifies the verbosity of the product search results. Optional. Defaults to ``BASIC``. product_set (str): @@ -123,19 +123,19 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - category (~.product_search.ProductSearchCategory): + category (google.cloud.vision_v1p3beta1.types.ProductSearchCategory): Product category. [Deprecated] Use ``product_category``. product_category (str): Product category. Supported values are ``bag`` and ``shoe``. [Deprecated] ``product_category`` is provided in each Product. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of the index which provided these results. Changes made after this time are not reflected in the current results. - products (Sequence[~.product_search.ProductSearchResults.ProductInfo]): + products (Sequence[google.cloud.vision_v1p3beta1.types.ProductSearchResults.ProductInfo]): List of detected products. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1p3beta1.types.ProductSearchResults.Result]): List of results, one for each product match. """ @@ -168,7 +168,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p3beta1.types.Product): The Product. score (float): A confidence level on the match, ranging from 0 (no diff --git a/google/cloud/vision_v1p3beta1/types/product_search_service.py b/google/cloud/vision_v1p3beta1/types/product_search_service.py index 1f13e1ba..aef592b7 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p3beta1/types/product_search_service.py @@ -85,7 +85,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[~.product_search_service.Product.KeyValue]): + product_labels (Sequence[google.cloud.vision_v1p3beta1.types.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -143,7 +143,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -152,7 +152,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (~.status.Status): + index_error (google.rpc.status_pb2.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -187,7 +187,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[~.geometry.BoundingPoly]): + bounding_polys (Sequence[google.cloud.vision_v1p3beta1.types.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -218,7 +218,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (~.product_search_service.Product): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -263,7 +263,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p3beta1.types.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -298,11 +298,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p3beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -337,7 +337,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -382,7 +382,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[~.product_search_service.ProductSet]): + product_sets (Sequence[google.cloud.vision_v1p3beta1.types.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -417,10 +417,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -456,7 +456,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (~.product_search_service.ReferenceImage): + reference_image (google.cloud.vision_v1p3beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -506,7 +506,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p3beta1.types.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -633,7 +633,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p3beta1.types.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -725,7 +725,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (~.product_search_service.ImportProductSetsGcsSource): + gcs_source (google.cloud.vision_v1p3beta1.types.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -745,7 +745,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (~.product_search_service.ImportProductSetsInputConfig): + input_config (google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -767,9 +767,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p3beta1.types.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[~.status.Status]): + statuses (Sequence[google.rpc.status_pb2.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -794,12 +794,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (~.product_search_service.BatchOperationMetadata.State): + state (google.cloud.vision_v1p3beta1.types.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (~.timestamp.Timestamp): + submit_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was submitted to the server. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. diff --git a/google/cloud/vision_v1p3beta1/types/text_annotation.py b/google/cloud/vision_v1p3beta1/types/text_annotation.py index e1252879..47423028 100644 --- a/google/cloud/vision_v1p3beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p3beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p3beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p3beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p3beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertice order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p3beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p3beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p3beta1.types.Word]): List of words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertice order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p3beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p3beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p3beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p3beta1/types/web_detection.py b/google/cloud/vision_v1p3beta1/types/web_detection.py index 6a24d5c2..66587d99 100644 --- a/google/cloud/vision_v1p3beta1/types/web_detection.py +++ b/google/cloud/vision_v1p3beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebLabel]): Best guess text labels for the request image. """ @@ -96,10 +96,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p3beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py index 581f63bd..1a9f75e6 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py @@ -83,6 +83,7 @@ class ImageAnnotatorAsyncClient: ImageAnnotatorClient.parse_common_location_path ) + from_service_account_info = ImageAnnotatorClient.from_service_account_info from_service_account_file = ImageAnnotatorClient.from_service_account_file from_service_account_json = from_service_account_file @@ -160,12 +161,13 @@ async def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest`): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -177,7 +179,7 @@ async def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -239,14 +241,15 @@ async def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest`): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]`): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -258,7 +261,7 @@ async def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -323,18 +326,20 @@ async def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest`): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]`): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (:class:`google.cloud.vision_v1p4beta1.types.OutputConfig`): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -346,11 +351,11 @@ async def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -421,12 +426,13 @@ async def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest`): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (:class:`Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -438,11 +444,11 @@ async def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py index 160e68ef..e8a00a76 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ImageAnnotatorClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ImageAnnotatorClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ImageAnnotatorTransport]): The + transport (Union[str, ImageAnnotatorTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -290,21 +306,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -347,7 +359,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -365,12 +377,13 @@ def batch_annotate_images( images. Args: - request (:class:`~.image_annotator.BatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest): The request object. Multiple image annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -382,7 +395,7 @@ def batch_annotate_images( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateImagesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse: Response to a batch image annotation request. @@ -442,14 +455,15 @@ def batch_annotate_files( extracted. Args: - request (:class:`~.image_annotator.BatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest): The request object. A list of requests to annotate files using the BatchAnnotateFiles API. - requests (:class:`Sequence[~.image_annotator.AnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -461,7 +475,7 @@ def batch_annotate_files( sent along with the request as metadata. Returns: - ~.image_annotator.BatchAnnotateFilesResponse: + google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse: A list of file annotation responses. """ # Create or coerce a protobuf request object. @@ -524,18 +538,20 @@ def async_batch_annotate_images( BatchAnnotateImagesResponse proto. Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest): The request object. Request for async image annotation for a list of images. - requests (:class:`Sequence[~.image_annotator.AnnotateImageRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.image_annotator.OutputConfig`): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -547,11 +563,11 @@ def async_batch_annotate_images( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateImagesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesResponse` Response to an async batch image annotation request. """ @@ -622,12 +638,13 @@ def async_batch_annotate_files( ``AsyncBatchAnnotateFilesResponse`` (results). Args: - request (:class:`~.image_annotator.AsyncBatchAnnotateFilesRequest`): + request (google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest): The request object. Multiple async file annotation requests are batched into a single service call. - requests (:class:`Sequence[~.image_annotator.AsyncAnnotateFileRequest]`): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. + This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -639,11 +656,11 @@ def async_batch_annotate_files( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.image_annotator.AsyncBatchAnnotateFilesResponse``: + :class:`google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py index 01609395..e4918610 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py @@ -62,6 +62,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -92,6 +93,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -108,6 +113,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -117,11 +127,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -165,12 +170,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py index 1386542d..3e26363e 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py @@ -106,6 +106,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -137,6 +138,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -153,6 +158,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -162,11 +172,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -210,12 +215,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py index 1c50dd67..41e45889 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py @@ -109,6 +109,7 @@ class ProductSearchAsyncClient: ProductSearchClient.parse_common_location_path ) + from_service_account_info = ProductSearchClient.from_service_account_info from_service_account_file = ProductSearchClient.from_service_account_file from_service_account_json = from_service_account_file @@ -192,7 +193,7 @@ async def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.CreateProductSetRequest`): The request object. Request message for the `CreateProductSet` method. parent (:class:`str`): @@ -200,10 +201,11 @@ async def create_product_set( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p4beta1.types.ProductSet`): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this @@ -214,6 +216,7 @@ async def create_product_set( 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -225,7 +228,7 @@ async def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -298,7 +301,7 @@ async def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListProductSetsRequest`): The request object. Request message for the `ListProductSets` method. parent (:class:`str`): @@ -306,6 +309,7 @@ async def list_product_sets( listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -317,8 +321,8 @@ async def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsAsyncPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsAsyncPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -392,7 +396,7 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.GetProductSetRequest`): The request object. Request message for the `GetProductSet` method. name (:class:`str`): @@ -400,6 +404,7 @@ async def get_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -411,7 +416,7 @@ async def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -486,20 +491,22 @@ async def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest`): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (:class:`google.cloud.vision_v1p4beta1.types.ProductSet`): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -511,7 +518,7 @@ async def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -582,7 +589,7 @@ async def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest`): The request object. Request message for the `DeleteProductSet` method. name (:class:`str`): @@ -590,6 +597,7 @@ async def delete_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -668,7 +676,7 @@ async def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.CreateProductRequest`): The request object. Request message for the `CreateProduct` method. parent (:class:`str`): @@ -676,10 +684,11 @@ async def create_product( created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p4beta1.types.Product`): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -690,6 +699,7 @@ async def create_product( 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -701,7 +711,7 @@ async def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -769,7 +779,7 @@ async def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListProductsRequest`): The request object. Request message for the `ListProducts` method. parent (:class:`str`): @@ -777,6 +787,7 @@ async def list_products( should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -788,8 +799,8 @@ async def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsAsyncPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsAsyncPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -863,7 +874,7 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.GetProductRequest`): The request object. Request message for the `GetProduct` method. name (:class:`str`): @@ -871,6 +882,7 @@ async def get_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -882,7 +894,7 @@ async def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -959,22 +971,24 @@ async def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.UpdateProductRequest`): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (:class:`google.cloud.vision_v1p4beta1.types.Product`): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -986,7 +1000,7 @@ async def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1054,7 +1068,7 @@ async def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.DeleteProductRequest`): The request object. Request message for the `DeleteProduct` method. name (:class:`str`): @@ -1062,6 +1076,7 @@ async def delete_product( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1152,7 +1167,7 @@ async def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest`): The request object. Request message for the `CreateReferenceImage` method. parent (:class:`str`): @@ -1161,13 +1176,15 @@ async def create_reference_image( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (:class:`google.cloud.vision_v1p4beta1.types.ReferenceImage`): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1177,6 +1194,7 @@ async def create_reference_image( 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1188,9 +1206,9 @@ async def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1259,7 +1277,7 @@ async def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest`): The request object. Request message for the `DeleteReferenceImage` method. name (:class:`str`): @@ -1269,6 +1287,7 @@ async def delete_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1342,7 +1361,7 @@ async def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest`): The request object. Request message for the `ListReferenceImages` method. parent (:class:`str`): @@ -1351,6 +1370,7 @@ async def list_reference_images( Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1362,8 +1382,8 @@ async def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesAsyncPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1437,7 +1457,7 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest`): The request object. Request message for the `GetReferenceImage` method. name (:class:`str`): @@ -1447,6 +1467,7 @@ async def get_reference_image( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1458,9 +1479,9 @@ async def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1530,7 +1551,7 @@ async def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest`): The request object. Request message for the `AddProductToProductSet` method. name (:class:`str`): @@ -1539,6 +1560,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1548,6 +1570,7 @@ async def add_product_to_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1616,7 +1639,7 @@ async def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest`): The request object. Request message for the `RemoveProductFromProductSet` method. name (:class:`str`): @@ -1625,6 +1648,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1634,6 +1658,7 @@ async def remove_product_from_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1708,7 +1733,7 @@ async def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest`): The request object. Request message for the `ListProductsInProductSet` method. name (:class:`str`): @@ -1717,6 +1742,7 @@ async def list_products_in_product_set( Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1728,8 +1754,8 @@ async def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetAsyncPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1812,7 +1838,7 @@ async def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest`): The request object. Request message for the `ImportProductSets` method. parent (:class:`str`): @@ -1820,12 +1846,14 @@ async def import_product_sets( imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (:class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig`): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1837,18 +1865,18 @@ async def import_product_sets( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -1943,7 +1971,7 @@ async def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (:class:`google.cloud.vision_v1p4beta1.types.PurgeProductsRequest`): The request object. Request message for the `PurgeProducts` method. parent (:class:`str`): @@ -1951,6 +1979,7 @@ async def purge_products( should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1962,24 +1991,22 @@ async def purge_products( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/client.py b/google/cloud/vision_v1p4beta1/services/product_search/client.py index dc704e28..485d3ebd 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/client.py @@ -135,6 +135,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProductSearchClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -147,7 +163,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProductSearchClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -292,10 +308,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ProductSearchTransport]): The + transport (Union[str, ProductSearchTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -331,21 +347,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -388,7 +400,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -412,28 +424,30 @@ def create_product_set( longer than 4096 characters. Args: - request (:class:`~.product_search_service.CreateProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.CreateProductSetRequest): The request object. Request message for the `CreateProductSet` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSet should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet to create. This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_set_id (:class:`str`): + product_set_id (str): 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 ``/``. + This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -445,7 +459,7 @@ def create_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -513,14 +527,15 @@ def list_product_sets( less than 1. Args: - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): The request object. Request message for the `ListProductSets` method. - parent (:class:`str`): + parent (str): Required. The project from which ProductSets should be listed. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -532,8 +547,8 @@ def list_product_sets( sent along with the request as metadata. Returns: - ~.pagers.ListProductSetsPager: - Response message for the ``ListProductSets`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsPager: + Response message for the ListProductSets method. Iterating over this object will yield results and resolve additional pages automatically. @@ -600,14 +615,15 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. Args: - request (:class:`~.product_search_service.GetProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.GetProductSetRequest): The request object. Request message for the `GetProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -619,7 +635,7 @@ def get_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -687,20 +703,22 @@ def update_product_set( characters. Args: - request (:class:`~.product_search_service.UpdateProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest): The request object. Request message for the `UpdateProductSet` method. - product_set (:class:`~.product_search_service.ProductSet`): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. + This corresponds to the ``product_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -712,7 +730,7 @@ def update_product_set( sent along with the request as metadata. Returns: - ~.product_search_service.ProductSet: + google.cloud.vision_v1p4beta1.types.ProductSet: A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit @@ -778,14 +796,15 @@ def delete_product_set( Storage. Args: - request (:class:`~.product_search_service.DeleteProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest): The request object. Request message for the `DeleteProductSet` method. - name (:class:`str`): + name (str): Required. Resource name of the ProductSet to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -857,28 +876,30 @@ def create_product( invalid. Args: - request (:class:`~.product_search_service.CreateProductRequest`): + request (google.cloud.vision_v1p4beta1.types.CreateProductRequest): The request object. Request message for the `CreateProduct` method. - parent (:class:`str`): + parent (str): Required. The project in which the Product should be created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The product to create. This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product_id (:class:`str`): + product_id (str): 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 ``/``. + This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -890,7 +911,7 @@ def create_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -953,14 +974,15 @@ def list_products( less than 1. Args: - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): The request object. Request message for the `ListProducts` method. - parent (:class:`str`): + parent (str): Required. The project OR ProductSet from which Products should be listed. Format: ``projects/PROJECT_ID/locations/LOC_ID`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -972,8 +994,8 @@ def list_products( sent along with the request as metadata. Returns: - ~.pagers.ListProductsPager: - Response message for the ``ListProducts`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsPager: + Response message for the ListProducts method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1040,14 +1062,15 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. Args: - request (:class:`~.product_search_service.GetProductRequest`): + request (google.cloud.vision_v1p4beta1.types.GetProductRequest): The request object. Request message for the `GetProduct` method. - name (:class:`str`): + name (str): Required. Resource name of the Product to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1059,7 +1082,7 @@ def get_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1129,22 +1152,24 @@ def update_product( update_mask. Args: - request (:class:`~.product_search_service.UpdateProductRequest`): + request (google.cloud.vision_v1p4beta1.types.UpdateProductRequest): The request object. Request message for the `UpdateProduct` method. - product (:class:`~.product_search_service.Product`): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.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``. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1156,7 +1181,7 @@ def update_product( sent along with the request as metadata. Returns: - ~.product_search_service.Product: + google.cloud.vision_v1p4beta1.types.Product: A Product contains ReferenceImages. """ # Create or coerce a protobuf request object. @@ -1219,14 +1244,15 @@ def delete_product( all related caches are refreshed. Args: - request (:class:`~.product_search_service.DeleteProductRequest`): + request (google.cloud.vision_v1p4beta1.types.DeleteProductRequest): The request object. Request message for the `DeleteProduct` method. - name (:class:`str`): + name (str): Required. Resource name of product to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1310,31 +1336,34 @@ def create_reference_image( 10 polygons. Args: - request (:class:`~.product_search_service.CreateReferenceImageRequest`): + request (google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest): The request object. Request message for the `CreateReferenceImage` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product in which to create the reference image. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image (:class:`~.product_search_service.ReferenceImage`): + reference_image (google.cloud.vision_v1p4beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. + This corresponds to the ``reference_image`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reference_image_id (:class:`str`): + reference_image_id (str): 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 ``/``. + This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1346,9 +1375,9 @@ def create_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1412,16 +1441,17 @@ def delete_reference_image( Storage. Args: - request (:class:`~.product_search_service.DeleteReferenceImageRequest`): + request (google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest): The request object. Request message for the `DeleteReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the reference image to delete. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1488,15 +1518,16 @@ def list_reference_images( 100, or less than 1. Args: - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): The request object. Request message for the `ListReferenceImages` method. - parent (:class:`str`): + parent (str): Required. Resource name of the product containing the reference images. Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1508,8 +1539,8 @@ def list_reference_images( sent along with the request as metadata. Returns: - ~.pagers.ListReferenceImagesPager: - Response message for the ``ListReferenceImages`` method. + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesPager: + Response message for the ListReferenceImages method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1576,16 +1607,17 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. Args: - request (:class:`~.product_search_service.GetReferenceImageRequest`): + request (google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest): The request object. Request message for the `GetReferenceImage` method. - name (:class:`str`): + name (str): Required. The resource name of the ReferenceImage to get. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1597,9 +1629,9 @@ def get_reference_image( sent along with the request as metadata. Returns: - ~.product_search_service.ReferenceImage: - A ``ReferenceImage`` represents a product image and its - associated metadata, such as bounding boxes. + google.cloud.vision_v1p4beta1.types.ReferenceImage: + A ReferenceImage represents a product image and its associated metadata, + such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1662,24 +1694,26 @@ def add_product_to_product_set( exist. Args: - request (:class:`~.product_search_service.AddProductToProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest): The request object. Request message for the `AddProductToProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be added to this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1747,24 +1781,26 @@ def remove_product_from_product_set( r"""Removes a Product from the specified ProductSet. Args: - request (:class:`~.product_search_service.RemoveProductFromProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest): The request object. Request message for the `RemoveProductFromProductSet` method. - name (:class:`str`): + name (str): Required. The resource name for the ProductSet to modify. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - product (:class:`str`): + product (str): Required. The resource name for the Product to be removed from this ProductSet. Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1838,15 +1874,16 @@ def list_products_in_product_set( less than 1. Args: - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): The request object. Request message for the `ListProductsInProductSet` method. - name (:class:`str`): + name (str): Required. The ProductSet resource for which to retrieve Products. Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1858,8 +1895,8 @@ def list_products_in_product_set( sent along with the request as metadata. Returns: - ~.pagers.ListProductsInProductSetPager: - Response message for the ``ListProductsInProductSet`` + google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetPager: + Response message for the ListProductsInProductSet method. Iterating over this object will yield results and @@ -1939,20 +1976,22 @@ def import_product_sets( [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. Args: - request (:class:`~.product_search_service.ImportProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest): The request object. Request message for the `ImportProductSets` method. - parent (:class:`str`): + parent (str): Required. The project in which the ProductSets should be imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.product_search_service.ImportProductSetsInputConfig`): + input_config (google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1964,18 +2003,18 @@ def import_product_sets( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.product_search_service.ImportProductSetsResponse``: - Response message for the ``ImportProductSets`` method. + :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` + Response message for the ImportProductSets method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. """ # Create or coerce a protobuf request object. @@ -2065,14 +2104,15 @@ def purge_products( ``BatchOperationMetadata``. (progress) Args: - request (:class:`~.product_search_service.PurgeProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.PurgeProductsRequest): The request object. Request message for the `PurgeProducts` method. - parent (:class:`str`): + parent (str): Required. The project and location in which the Products should be deleted. Format is ``projects/PROJECT_ID/locations/LOC_ID``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2084,24 +2124,22 @@ def purge_products( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py index c3ac34cd..2c5d61b2 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py @@ -24,7 +24,7 @@ class ListProductSetsPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``product_sets`` field. @@ -33,7 +33,7 @@ class ListProductSetsPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListProductSetsAsyncPager: """A pager for iterating through ``list_product_sets`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductSetsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``product_sets`` field. @@ -95,7 +95,7 @@ class ListProductSetsAsyncPager: through the ``product_sets`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductSetsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductSetsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductSetsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductSetsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -156,7 +156,7 @@ class ListProductsPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -165,7 +165,7 @@ class ListProductsPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -183,9 +183,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -218,7 +218,7 @@ class ListProductsAsyncPager: """A pager for iterating through ``list_products`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -227,7 +227,7 @@ class ListProductsAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -245,9 +245,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -284,7 +284,7 @@ class ListReferenceImagesPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` object, and provides an ``__iter__`` method to iterate through its ``reference_images`` field. @@ -293,7 +293,7 @@ class ListReferenceImagesPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -311,9 +311,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -346,7 +346,7 @@ class ListReferenceImagesAsyncPager: """A pager for iterating through ``list_reference_images`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListReferenceImagesResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` object, and provides an ``__aiter__`` method to iterate through its ``reference_images`` field. @@ -355,7 +355,7 @@ class ListReferenceImagesAsyncPager: through the ``reference_images`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListReferenceImagesResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -375,9 +375,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListReferenceImagesRequest`): + request (google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest): The initial request object. - response (:class:`~.product_search_service.ListReferenceImagesResponse`): + response (google.cloud.vision_v1p4beta1.types.ListReferenceImagesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -416,7 +416,7 @@ class ListProductsInProductSetPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` object, and provides an ``__iter__`` method to iterate through its ``products`` field. @@ -425,7 +425,7 @@ class ListProductsInProductSetPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -443,9 +443,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -480,7 +480,7 @@ class ListProductsInProductSetAsyncPager: """A pager for iterating through ``list_products_in_product_set`` requests. This class thinly wraps an initial - :class:`~.product_search_service.ListProductsInProductSetResponse` object, and + :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` object, and provides an ``__aiter__`` method to iterate through its ``products`` field. @@ -489,7 +489,7 @@ class ListProductsInProductSetAsyncPager: through the ``products`` field on the corresponding responses. - All the usual :class:`~.product_search_service.ListProductsInProductSetResponse` + All the usual :class:`google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -509,9 +509,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.product_search_service.ListProductsInProductSetRequest`): + request (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest): The initial request object. - response (:class:`~.product_search_service.ListProductsInProductSetResponse`): + response (google.cloud.vision_v1p4beta1.types.ListProductsInProductSetResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py b/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py index 3e8ea680..cded719d 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py @@ -79,6 +79,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -109,6 +110,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -125,6 +130,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -134,11 +144,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -182,12 +187,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py b/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py index 6a0af863..3edf5094 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py @@ -123,6 +123,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -154,6 +155,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -170,6 +175,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -179,11 +189,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -227,12 +232,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( host, credentials=credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/vision_v1p4beta1/types/face.py b/google/cloud/vision_v1p4beta1/types/face.py index 34ca9aa9..89fbc30b 100644 --- a/google/cloud/vision_v1p4beta1/types/face.py +++ b/google/cloud/vision_v1p4beta1/types/face.py @@ -64,7 +64,7 @@ class FaceRecognitionResult(proto.Message): r"""Information about a face's identity. Attributes: - celebrity (~.face.Celebrity): + celebrity (google.cloud.vision_v1p4beta1.types.Celebrity): The [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] that this face was matched to. confidence (float): diff --git a/google/cloud/vision_v1p4beta1/types/geometry.py b/google/cloud/vision_v1p4beta1/types/geometry.py index 60c32e6e..b43c8d06 100644 --- a/google/cloud/vision_v1p4beta1/types/geometry.py +++ b/google/cloud/vision_v1p4beta1/types/geometry.py @@ -62,9 +62,9 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[~.geometry.Vertex]): + vertices (Sequence[google.cloud.vision_v1p4beta1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[~.geometry.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.vision_v1p4beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ diff --git a/google/cloud/vision_v1p4beta1/types/image_annotator.py b/google/cloud/vision_v1p4beta1/types/image_annotator.py index 98788127..b4e3b321 100644 --- a/google/cloud/vision_v1p4beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p4beta1/types/image_annotator.py @@ -94,7 +94,7 @@ class Feature(proto.Message): ``Feature`` objects can be specified in the ``features`` list. Attributes: - type_ (~.image_annotator.Feature.Type): + type_ (google.cloud.vision_v1p4beta1.types.Feature.Type): The feature type. max_results (int): Maximum number of results of this type. Does not apply to @@ -177,7 +177,7 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - source (~.image_annotator.ImageSource): + source (google.cloud.vision_v1p4beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided for an image, ``content`` takes precedence and is used to @@ -194,7 +194,7 @@ class FaceAnnotation(proto.Message): detection. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human @@ -202,7 +202,7 @@ class FaceAnnotation(proto.Message): that one or more x and/or y coordinates may not be generated in the ``BoundingPoly`` (the polygon will be unbounded) if only a partial face appears in the image to be annotated. - fd_bounding_poly (~.geometry.BoundingPoly): + fd_bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The ``fd_bounding_poly`` bounding polygon is tighter than the ``boundingPoly``, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any @@ -210,7 +210,7 @@ class FaceAnnotation(proto.Message): an image. It is not based on the landmarker results, only on the initial face detection, hence the fd (face detection) prefix. - landmarks (Sequence[~.image_annotator.FaceAnnotation.Landmark]): + landmarks (Sequence[google.cloud.vision_v1p4beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): Roll angle, which indicates the amount of @@ -229,21 +229,21 @@ class FaceAnnotation(proto.Message): Detection confidence. Range [0, 1]. landmarking_confidence (float): Face landmarking confidence. Range [0, 1]. - joy_likelihood (~.image_annotator.Likelihood): + joy_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Joy likelihood. - sorrow_likelihood (~.image_annotator.Likelihood): + sorrow_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Sorrow likelihood. - anger_likelihood (~.image_annotator.Likelihood): + anger_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Anger likelihood. - surprise_likelihood (~.image_annotator.Likelihood): + surprise_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Surprise likelihood. - under_exposed_likelihood (~.image_annotator.Likelihood): + under_exposed_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Under-exposed likelihood. - blurred_likelihood (~.image_annotator.Likelihood): + blurred_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Blurred likelihood. - headwear_likelihood (~.image_annotator.Likelihood): + headwear_likelihood (google.cloud.vision_v1p4beta1.types.Likelihood): Headwear likelihood. - recognition_result (Sequence[~.face.FaceRecognitionResult]): + recognition_result (Sequence[google.cloud.vision_v1p4beta1.types.FaceRecognitionResult]): Additional recognition information. Only computed if image_context.face_recognition_params is provided, **and** a match is found to a @@ -258,9 +258,9 @@ class Landmark(proto.Message): r"""A face-specific landmark (for example, a face feature). Attributes: - type_ (~.image_annotator.FaceAnnotation.Landmark.Type): + type_ (google.cloud.vision_v1p4beta1.types.FaceAnnotation.Landmark.Type): Face landmark type. - position (~.geometry.Position): + position (google.cloud.vision_v1p4beta1.types.Position): Face landmark position. """ @@ -351,7 +351,7 @@ class LocationInfo(proto.Message): r"""Detected entity location information. Attributes: - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): lat/long location coordinates. """ @@ -406,17 +406,17 @@ class EntityAnnotation(proto.Message): than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): Image region to which this entity belongs. Not produced for ``LABEL_DETECTION`` features. - locations (Sequence[~.image_annotator.LocationInfo]): + locations (Sequence[google.cloud.vision_v1p4beta1.types.LocationInfo]): The location information for the detected entity. Multiple ``LocationInfo`` elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. - properties (Sequence[~.image_annotator.Property]): + properties (Sequence[google.cloud.vision_v1p4beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies the entity. @@ -456,7 +456,7 @@ class LocalizedObjectAnnotation(proto.Message): Object name, expressed in its ``language_code`` language. score (float): Score of the result. Range [0, 1]. - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): Image region to which this object belongs. This must be populated. """ @@ -478,21 +478,21 @@ class SafeSearchAnnotation(proto.Message): spoof, medical, violence). Attributes: - adult (~.image_annotator.Likelihood): + adult (google.cloud.vision_v1p4beta1.types.Likelihood): Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities. - spoof (~.image_annotator.Likelihood): + spoof (google.cloud.vision_v1p4beta1.types.Likelihood): Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive. - medical (~.image_annotator.Likelihood): + medical (google.cloud.vision_v1p4beta1.types.Likelihood): Likelihood that this is a medical image. - violence (~.image_annotator.Likelihood): + violence (google.cloud.vision_v1p4beta1.types.Likelihood): Likelihood that this image contains violent content. - racy (~.image_annotator.Likelihood): + racy (google.cloud.vision_v1p4beta1.types.Likelihood): Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, @@ -516,9 +516,9 @@ class LatLongRect(proto.Message): r"""Rectangle determined by min and max ``LatLng`` pairs. Attributes: - min_lat_lng (~.latlng.LatLng): + min_lat_lng (google.type.latlng_pb2.LatLng): Min lat/long pair. - max_lat_lng (~.latlng.LatLng): + max_lat_lng (google.type.latlng_pb2.LatLng): Max lat/long pair. """ @@ -532,7 +532,7 @@ class ColorInfo(proto.Message): fraction of the image that the color occupies in the image. Attributes: - color (~.gt_color.Color): + color (google.type.color_pb2.Color): RGB components of the color. score (float): Image-specific score for this color. Value in range [0, 1]. @@ -552,7 +552,7 @@ class DominantColorsAnnotation(proto.Message): r"""Set of dominant colors and their corresponding scores. Attributes: - colors (Sequence[~.image_annotator.ColorInfo]): + colors (Sequence[google.cloud.vision_v1p4beta1.types.ColorInfo]): RGB color values with their score and pixel fraction. """ @@ -564,7 +564,7 @@ class ImageProperties(proto.Message): r"""Stores image properties, such as dominant colors. Attributes: - dominant_colors (~.image_annotator.DominantColorsAnnotation): + dominant_colors (google.cloud.vision_v1p4beta1.types.DominantColorsAnnotation): If present, dominant colors completed successfully. """ @@ -579,7 +579,7 @@ class CropHint(proto.Message): serving an image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale. @@ -602,7 +602,7 @@ class CropHintsAnnotation(proto.Message): serving images. Attributes: - crop_hints (Sequence[~.image_annotator.CropHint]): + crop_hints (Sequence[google.cloud.vision_v1p4beta1.types.CropHint]): Crop hint results. """ @@ -657,7 +657,7 @@ class ImageContext(proto.Message): r"""Image context and/or feature-specific parameters. Attributes: - lat_long_rect (~.image_annotator.LatLongRect): + lat_long_rect (google.cloud.vision_v1p4beta1.types.LatLongRect): Not used. language_hints (Sequence[str]): List of languages to use for TEXT_DETECTION. In most cases, @@ -670,15 +670,15 @@ class ImageContext(proto.Message): Text detection returns an error if one or more of the specified languages is not one of the `supported languages `__. - crop_hints_params (~.image_annotator.CropHintsParams): + crop_hints_params (google.cloud.vision_v1p4beta1.types.CropHintsParams): Parameters for crop hints annotation request. - face_recognition_params (~.face.FaceRecognitionParams): + face_recognition_params (google.cloud.vision_v1p4beta1.types.FaceRecognitionParams): Parameters for face recognition. - product_search_params (~.product_search.ProductSearchParams): + product_search_params (google.cloud.vision_v1p4beta1.types.ProductSearchParams): Parameters for product search. - web_detection_params (~.image_annotator.WebDetectionParams): + web_detection_params (google.cloud.vision_v1p4beta1.types.WebDetectionParams): Parameters for web detection. - text_detection_params (~.image_annotator.TextDetectionParams): + text_detection_params (google.cloud.vision_v1p4beta1.types.TextDetectionParams): Parameters for text detection and document text detection. """ @@ -712,11 +712,11 @@ class AnnotateImageRequest(proto.Message): context information. Attributes: - image (~.image_annotator.Image): + image (google.cloud.vision_v1p4beta1.types.Image): The image to be processed. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p4beta1.types.ImageContext): Additional context that may accompany the image. """ @@ -751,50 +751,50 @@ class AnnotateImageResponse(proto.Message): r"""Response to an image annotation request. Attributes: - face_annotations (Sequence[~.image_annotator.FaceAnnotation]): + face_annotations (Sequence[google.cloud.vision_v1p4beta1.types.FaceAnnotation]): If present, face detection has completed successfully. - landmark_annotations (Sequence[~.image_annotator.EntityAnnotation]): + landmark_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, landmark detection has completed successfully. - logo_annotations (Sequence[~.image_annotator.EntityAnnotation]): + logo_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, logo detection has completed successfully. - label_annotations (Sequence[~.image_annotator.EntityAnnotation]): + label_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, label detection has completed successfully. - localized_object_annotations (Sequence[~.image_annotator.LocalizedObjectAnnotation]): + localized_object_annotations (Sequence[google.cloud.vision_v1p4beta1.types.LocalizedObjectAnnotation]): If present, localized object detection has completed successfully. This will be sorted descending by confidence score. - text_annotations (Sequence[~.image_annotator.EntityAnnotation]): + text_annotations (Sequence[google.cloud.vision_v1p4beta1.types.EntityAnnotation]): If present, text (OCR) detection has completed successfully. - full_text_annotation (~.text_annotation.TextAnnotation): + full_text_annotation (google.cloud.vision_v1p4beta1.types.TextAnnotation): If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text. - safe_search_annotation (~.image_annotator.SafeSearchAnnotation): + safe_search_annotation (google.cloud.vision_v1p4beta1.types.SafeSearchAnnotation): If present, safe-search annotation has completed successfully. - image_properties_annotation (~.image_annotator.ImageProperties): + image_properties_annotation (google.cloud.vision_v1p4beta1.types.ImageProperties): If present, image properties were extracted successfully. - crop_hints_annotation (~.image_annotator.CropHintsAnnotation): + crop_hints_annotation (google.cloud.vision_v1p4beta1.types.CropHintsAnnotation): If present, crop hints have completed successfully. - web_detection (~.gcv_web_detection.WebDetection): + web_detection (google.cloud.vision_v1p4beta1.types.WebDetection): If present, web detection has completed successfully. - product_search_results (~.product_search.ProductSearchResults): + product_search_results (google.cloud.vision_v1p4beta1.types.ProductSearchResults): If present, product search has completed successfully. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when ``error`` is set. - context (~.image_annotator.ImageAnnotationContext): + context (google.cloud.vision_v1p4beta1.types.ImageAnnotationContext): If present, contextual information is needed to understand where this image comes from. """ @@ -857,7 +857,7 @@ class BatchAnnotateImagesRequest(proto.Message): service call. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. """ @@ -871,7 +871,7 @@ class BatchAnnotateImagesResponse(proto.Message): r"""Response to a batch image annotation request. Attributes: - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageResponse]): Individual responses to image annotation requests within the batch. """ @@ -886,11 +886,11 @@ class AnnotateFileRequest(proto.Message): GIF file. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p4beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p4beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. pages (Sequence[int]): @@ -926,16 +926,16 @@ class AnnotateFileResponse(proto.Message): responses. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p4beta1.types.InputConfig): Information about the file for which this response is generated. - responses (Sequence[~.image_annotator.AnnotateImageResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageResponse]): Individual responses to images found within the file. This field will be empty if the ``error`` field is set. total_pages (int): This field gives the total number of pages in the file. - error (~.status.Status): + error (google.rpc.status_pb2.Status): If set, represents the error message for the failed request. The ``responses`` field will not be set in this case. """ @@ -956,7 +956,7 @@ class BatchAnnotateFilesRequest(proto.Message): BatchAnnotateFiles API. Attributes: - requests (Sequence[~.image_annotator.AnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]): Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in @@ -972,7 +972,7 @@ class BatchAnnotateFilesResponse(proto.Message): r"""A list of file annotation responses. Attributes: - responses (Sequence[~.image_annotator.AnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileResponse]): The list of file annotation responses, each response corresponding to each AnnotateFileRequest in @@ -988,14 +988,14 @@ class AsyncAnnotateFileRequest(proto.Message): r"""An offline file annotation request. Attributes: - input_config (~.image_annotator.InputConfig): + input_config (google.cloud.vision_v1p4beta1.types.InputConfig): Required. Information about the input file. - features (Sequence[~.image_annotator.Feature]): + features (Sequence[google.cloud.vision_v1p4beta1.types.Feature]): Required. Requested features. - image_context (~.image_annotator.ImageContext): + image_context (google.cloud.vision_v1p4beta1.types.ImageContext): Additional context that may accompany the image(s) in the file. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1013,7 +1013,7 @@ class AsyncAnnotateFileResponse(proto.Message): r"""The response for a single offline file annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): The output location and metadata from AsyncAnnotateFileRequest. """ @@ -1025,10 +1025,10 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): r"""Request for async image annotation for a list of images. Attributes: - requests (Sequence[~.image_annotator.AnnotateImageRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]): Required. Individual image annotation requests for this batch. - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): Required. The desired output location and metadata (e.g. format). """ @@ -1044,7 +1044,7 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): r"""Response to an async batch image annotation request. Attributes: - output_config (~.image_annotator.OutputConfig): + output_config (google.cloud.vision_v1p4beta1.types.OutputConfig): The output location and metadata from AsyncBatchAnnotateImagesRequest. """ @@ -1057,7 +1057,7 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): single service call. Attributes: - requests (Sequence[~.image_annotator.AsyncAnnotateFileRequest]): + requests (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]): Required. Individual async file annotation requests for this batch. """ @@ -1071,7 +1071,7 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): r"""Response to an async batch file annotation request. Attributes: - responses (Sequence[~.image_annotator.AsyncAnnotateFileResponse]): + responses (Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileResponse]): The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. @@ -1086,7 +1086,7 @@ class InputConfig(proto.Message): r"""The desired input location and metadata. Attributes: - gcs_source (~.image_annotator.GcsSource): + gcs_source (google.cloud.vision_v1p4beta1.types.GcsSource): The Google Cloud Storage location to read the input from. content (bytes): @@ -1114,7 +1114,7 @@ class OutputConfig(proto.Message): r"""The desired output location and metadata. Attributes: - gcs_destination (~.image_annotator.GcsDestination): + gcs_destination (google.cloud.vision_v1p4beta1.types.GcsDestination): The Google Cloud Storage location to write the output(s) to. batch_size (int): @@ -1191,11 +1191,11 @@ class OperationMetadata(proto.Message): r"""Contains metadata for the BatchAnnotateImages operation. Attributes: - state (~.image_annotator.OperationMetadata.State): + state (google.cloud.vision_v1p4beta1.types.OperationMetadata.State): Current state of the batch operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was received. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the operation result was last updated. """ diff --git a/google/cloud/vision_v1p4beta1/types/product_search.py b/google/cloud/vision_v1p4beta1/types/product_search.py index e16037c9..f0aa53b8 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search.py +++ b/google/cloud/vision_v1p4beta1/types/product_search.py @@ -33,7 +33,7 @@ class ProductSearchParams(proto.Message): r"""Parameters for a product search request. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon around the area of interest in the image. If it is not specified, system discretion will be applied. @@ -83,14 +83,14 @@ class ProductSearchResults(proto.Message): r"""Results for a product search request. Attributes: - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of the index which provided these results. Products added to the product set and products removed from the product set after this time are not reflected in the current results. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.Result]): List of results, one for each product match. - product_grouped_results (Sequence[~.product_search.ProductSearchResults.GroupedResult]): + product_grouped_results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.GroupedResult]): List of results grouped by products detected in the query image. Each entry corresponds to one bounding polygon in the query image, and @@ -103,7 +103,7 @@ class Result(proto.Message): r"""Information about a product. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p4beta1.types.Product): The Product. score (float): A confidence level on the match, ranging from @@ -151,12 +151,12 @@ class GroupedResult(proto.Message): a query image. Attributes: - bounding_poly (~.geometry.BoundingPoly): + bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding polygon around the product detected in the query image. - results (Sequence[~.product_search.ProductSearchResults.Result]): + results (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.Result]): List of results, one for each product match. - object_annotations (Sequence[~.product_search.ProductSearchResults.ObjectAnnotation]): + object_annotations (Sequence[google.cloud.vision_v1p4beta1.types.ProductSearchResults.ObjectAnnotation]): List of generic predictions for the object in the bounding box. """ diff --git a/google/cloud/vision_v1p4beta1/types/product_search_service.py b/google/cloud/vision_v1p4beta1/types/product_search_service.py index 598c868d..25df6719 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p4beta1/types/product_search_service.py @@ -87,7 +87,7 @@ class Product(proto.Message): "toys-v2". The legacy categories "homegoods", "apparel", and "toys" are still supported, but these should not be used for new products. - product_labels (Sequence[~.product_search_service.Product.KeyValue]): + product_labels (Sequence[google.cloud.vision_v1p4beta1.types.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels. @@ -150,7 +150,7 @@ class ProductSet(proto.Message): The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long. - index_time (~.timestamp.Timestamp): + index_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this @@ -160,7 +160,7 @@ class ProductSet(proto.Message): This field is ignored when creating a ProductSet. - index_error (~.status.Status): + index_error (google.rpc.status_pb2.Status): Output only. If there was an error with indexing the product set, the field is populated. @@ -195,7 +195,7 @@ class ReferenceImage(proto.Message): image. The URI must start with ``gs://``. - bounding_polys (Sequence[~.geometry.BoundingPoly]): + bounding_polys (Sequence[google.cloud.vision_v1p4beta1.types.BoundingPoly]): Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect @@ -226,7 +226,7 @@ class CreateProductRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product (~.product_search_service.Product): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The product to create. product_id (str): A user-supplied resource id for this Product. If set, the @@ -271,7 +271,7 @@ class ListProductsResponse(proto.Message): r"""Response message for the ``ListProducts`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p4beta1.types.Product]): List of products. next_page_token (str): Token to retrieve the next page of results, @@ -306,11 +306,11 @@ class UpdateProductRequest(proto.Message): r"""Request message for the ``UpdateProduct`` method. Attributes: - product (~.product_search_service.Product): + product (google.cloud.vision_v1p4beta1.types.Product): Required. The Product resource which replaces the one on the server. product.name is immutable. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include @@ -345,7 +345,7 @@ class CreateProductSetRequest(proto.Message): created. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): A user-supplied resource id for this ProductSet. If set, the @@ -390,7 +390,7 @@ class ListProductSetsResponse(proto.Message): r"""Response message for the ``ListProductSets`` method. Attributes: - product_sets (Sequence[~.product_search_service.ProductSet]): + product_sets (Sequence[google.cloud.vision_v1p4beta1.types.ProductSet]): List of ProductSets. next_page_token (str): Token to retrieve the next page of results, @@ -425,10 +425,10 @@ class UpdateProductSetRequest(proto.Message): r"""Request message for the ``UpdateProductSet`` method. Attributes: - product_set (~.product_search_service.ProductSet): + product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet resource which replaces the one on the server. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is @@ -464,7 +464,7 @@ class CreateReferenceImageRequest(proto.Message): Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. - reference_image (~.product_search_service.ReferenceImage): + reference_image (google.cloud.vision_v1p4beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): @@ -514,7 +514,7 @@ class ListReferenceImagesResponse(proto.Message): r"""Response message for the ``ListReferenceImages`` method. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p4beta1.types.ReferenceImage]): The list of reference images. page_size (int): The maximum number of items to return. @@ -641,7 +641,7 @@ class ListProductsInProductSetResponse(proto.Message): r"""Response message for the ``ListProductsInProductSet`` method. Attributes: - products (Sequence[~.product_search_service.Product]): + products (Sequence[google.cloud.vision_v1p4beta1.types.Product]): The list of Products. next_page_token (str): Token to retrieve the next page of results, @@ -746,7 +746,7 @@ class ImportProductSetsInputConfig(proto.Message): r"""The input content for the ``ImportProductSets`` method. Attributes: - gcs_source (~.product_search_service.ImportProductSetsGcsSource): + gcs_source (google.cloud.vision_v1p4beta1.types.ImportProductSetsGcsSource): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. @@ -766,7 +766,7 @@ class ImportProductSetsRequest(proto.Message): imported. Format is ``projects/PROJECT_ID/locations/LOC_ID``. - input_config (~.product_search_service.ImportProductSetsInputConfig): + input_config (google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig): Required. The input content for the list of requests. """ @@ -788,9 +788,9 @@ class ImportProductSetsResponse(proto.Message): field. Attributes: - reference_images (Sequence[~.product_search_service.ReferenceImage]): + reference_images (Sequence[google.cloud.vision_v1p4beta1.types.ReferenceImage]): The list of reference_images that are imported successfully. - statuses (Sequence[~.status.Status]): + statuses (Sequence[google.rpc.status_pb2.Status]): The rpc status for each ImportProductSet request, including both successes and errors. @@ -815,12 +815,12 @@ class BatchOperationMetadata(proto.Message): ``google::longrunning::Operations`` service. Attributes: - state (~.product_search_service.BatchOperationMetadata.State): + state (google.cloud.vision_v1p4beta1.types.BatchOperationMetadata.State): The current state of the batch operation. - submit_time (~.timestamp.Timestamp): + submit_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request was submitted to the server. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. @@ -861,7 +861,7 @@ class PurgeProductsRequest(proto.Message): r"""Request message for the ``PurgeProducts`` method. Attributes: - product_set_purge_config (~.product_search_service.ProductSetPurgeConfig): + product_set_purge_config (google.cloud.vision_v1p4beta1.types.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. delete_orphan_products (bool): diff --git a/google/cloud/vision_v1p4beta1/types/text_annotation.py b/google/cloud/vision_v1p4beta1/types/text_annotation.py index 25c4f0c9..ee384d68 100644 --- a/google/cloud/vision_v1p4beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p4beta1/types/text_annotation.py @@ -38,7 +38,7 @@ class TextAnnotation(proto.Message): message definition below for more detail. Attributes: - pages (Sequence[~.text_annotation.Page]): + pages (Sequence[google.cloud.vision_v1p4beta1.types.Page]): List of pages detected by OCR. text (str): UTF-8 text detected on the pages. @@ -64,7 +64,7 @@ class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. Attributes: - type_ (~.text_annotation.TextAnnotation.DetectedBreak.BreakType): + type_ (google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedBreak.BreakType): Detected break type. is_prefix (bool): True if break prepends the element. @@ -89,10 +89,10 @@ class TextProperty(proto.Message): r"""Additional information detected on the structural component. Attributes: - detected_languages (Sequence[~.text_annotation.TextAnnotation.DetectedLanguage]): + detected_languages (Sequence[google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedLanguage]): A list of detected languages together with confidence. - detected_break (~.text_annotation.TextAnnotation.DetectedBreak): + detected_break (google.cloud.vision_v1p4beta1.types.TextAnnotation.DetectedBreak): Detected start or end of a text segment. """ @@ -113,7 +113,7 @@ class Page(proto.Message): r"""Detected page from OCR. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected on the page. width (int): Page width. For PDFs the unit is points. For @@ -121,7 +121,7 @@ class Page(proto.Message): height (int): Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels. - blocks (Sequence[~.text_annotation.Block]): + blocks (Sequence[google.cloud.vision_v1p4beta1.types.Block]): List of blocks of text, images etc on this page. confidence (float): @@ -145,10 +145,10 @@ class Block(proto.Message): r"""Logical element on the page. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the block. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -173,10 +173,10 @@ class Block(proto.Message): 1----0 and the vertex order will still be (0, 1, 2, 3). - paragraphs (Sequence[~.text_annotation.Paragraph]): + paragraphs (Sequence[google.cloud.vision_v1p4beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). - block_type (~.text_annotation.Block.BlockType): + block_type (google.cloud.vision_v1p4beta1.types.Block.BlockType): Detected block type (text, image etc) for this block. confidence (float): @@ -210,10 +210,10 @@ class Paragraph(proto.Message): certain order. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the paragraph. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation @@ -225,7 +225,7 @@ class Paragraph(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - words (Sequence[~.text_annotation.Word]): + words (Sequence[google.cloud.vision_v1p4beta1.types.Word]): List of all words in this paragraph. confidence (float): Confidence of the OCR results for the paragraph. Range [0, @@ -247,9 +247,9 @@ class Word(proto.Message): r"""A word representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the word. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is @@ -261,7 +261,7 @@ class Word(proto.Message): - when it's rotated 180 degrees around the top-left corner it becomes: 2----3 \| \| 1----0 and the vertex order will still be (0, 1, 2, 3). - symbols (Sequence[~.text_annotation.Symbol]): + symbols (Sequence[google.cloud.vision_v1p4beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural reading order. @@ -284,10 +284,10 @@ class Symbol(proto.Message): r"""A single symbol representation. Attributes: - property (~.text_annotation.TextAnnotation.TextProperty): + property (google.cloud.vision_v1p4beta1.types.TextAnnotation.TextProperty): Additional information detected for the symbol. - bounding_box (~.geometry.BoundingPoly): + bounding_box (google.cloud.vision_v1p4beta1.types.BoundingPoly): The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation diff --git a/google/cloud/vision_v1p4beta1/types/web_detection.py b/google/cloud/vision_v1p4beta1/types/web_detection.py index 344fd0b0..c9efe25e 100644 --- a/google/cloud/vision_v1p4beta1/types/web_detection.py +++ b/google/cloud/vision_v1p4beta1/types/web_detection.py @@ -27,24 +27,24 @@ class WebDetection(proto.Message): r"""Relevant information for the image from the Internet. Attributes: - web_entities (Sequence[~.web_detection.WebDetection.WebEntity]): + web_entities (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebEntity]): Deduced entities from similar images on the Internet. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Fully matching images from the Internet. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops. - pages_with_matching_images (Sequence[~.web_detection.WebDetection.WebPage]): + pages_with_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebPage]): Web pages containing the matching images from the Internet. - visually_similar_images (Sequence[~.web_detection.WebDetection.WebImage]): + visually_similar_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): The visually similar image results. - best_guess_labels (Sequence[~.web_detection.WebDetection.WebLabel]): + best_guess_labels (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebLabel]): The service's best guess as to the topic of the request image. Inferred from similar images on the open web. @@ -98,10 +98,10 @@ class WebPage(proto.Message): page_title (str): Title for the web page, may contain HTML markups. - full_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + full_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Fully matching images on the page. Can include resized copies of the query image. - partial_matching_images (Sequence[~.web_detection.WebDetection.WebImage]): + partial_matching_images (Sequence[google.cloud.vision_v1p4beta1.types.WebDetection.WebImage]): Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original diff --git a/synth.metadata b/synth.metadata index a706fe1a..c8a74192 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-vision.git", - "sha": "62f5df93426f6d7fd796a470c2fa049f90dd56ed" + "sha": "2fa6dcd06b59debf1dba80e7061c83e3e3f972a9" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907", - "internalRef": "347055288" + "sha": "20712b8fe95001b312f62c6c5f33e3e3ec92cfaf", + "internalRef": "354996675" } }, { @@ -131,12 +131,19 @@ "docs/_templates/layout.html", "docs/conf.py", "docs/multiprocessing.rst", + "docs/vision_v1/image_annotator.rst", + "docs/vision_v1/product_search.rst", "docs/vision_v1/services.rst", "docs/vision_v1/types.rst", + "docs/vision_v1p2beta1/image_annotator.rst", "docs/vision_v1p2beta1/services.rst", "docs/vision_v1p2beta1/types.rst", + "docs/vision_v1p3beta1/image_annotator.rst", + "docs/vision_v1p3beta1/product_search.rst", "docs/vision_v1p3beta1/services.rst", "docs/vision_v1p3beta1/types.rst", + "docs/vision_v1p4beta1/image_annotator.rst", + "docs/vision_v1p4beta1/product_search.rst", "docs/vision_v1p4beta1/services.rst", "docs/vision_v1p4beta1/types.rst", "google/cloud/vision/__init__.py", diff --git a/tests/unit/gapic/vision_v1/test_image_annotator.py b/tests/unit/gapic/vision_v1/test_image_annotator.py index 7e39be07..a14cf483 100644 --- a/tests/unit/gapic/vision_v1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1/test_image_annotator.py @@ -90,8 +90,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -110,7 +123,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -161,7 +177,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -177,7 +193,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -193,7 +209,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -221,7 +237,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -272,29 +288,25 @@ def test_image_annotator_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -303,66 +315,53 @@ def test_image_annotator_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -388,7 +387,7 @@ def test_image_annotator_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -418,7 +417,7 @@ def test_image_annotator_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -437,7 +436,7 @@ def test_image_annotator_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1362,6 +1361,54 @@ def test_image_annotator_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ImageAnnotatorGrpcTransport, + transports.ImageAnnotatorGrpcAsyncIOTransport, + ], +) +def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_image_annotator_host_no_port(): client = ImageAnnotatorClient( credentials=credentials.AnonymousCredentials(), @@ -1383,7 +1430,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1395,7 +1442,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1406,6 +1453,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1420,7 +1469,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1461,6 +1510,8 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1476,7 +1527,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1/test_product_search.py b/tests/unit/gapic/vision_v1/test_product_search.py index 52c594c3..2081be13 100644 --- a/tests/unit/gapic/vision_v1/test_product_search.py +++ b/tests/unit/gapic/vision_v1/test_product_search.py @@ -93,8 +93,21 @@ def test__get_default_mtls_endpoint(): ) +def test_product_search_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProductSearchClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient] + "client_class", [ProductSearchClient, ProductSearchAsyncClient,] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -113,7 +126,10 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - assert transport == transports.ProductSearchGrpcTransport + available_transports = [ + transports.ProductSearchGrpcTransport, + ] + assert transport in available_transports transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -164,7 +180,7 @@ def test_product_search_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -180,7 +196,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -196,7 +212,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -224,7 +240,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -275,29 +291,25 @@ def test_product_search_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -306,66 +318,53 @@ def test_product_search_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -391,7 +390,7 @@ def test_product_search_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -421,7 +420,7 @@ def test_product_search_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -440,7 +439,7 @@ def test_product_search_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -5344,6 +5343,54 @@ def test_product_search_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ProductSearchGrpcTransport, + transports.ProductSearchGrpcAsyncIOTransport, + ], +) +def test_product_search_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_product_search_host_no_port(): client = ProductSearchClient( credentials=credentials.AnonymousCredentials(), @@ -5365,7 +5412,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5377,7 +5424,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5388,6 +5435,8 @@ def test_product_search_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -5400,7 +5449,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5441,6 +5490,8 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -5456,7 +5507,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py index 4ee68cf4..d121bd2b 100644 --- a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py @@ -86,8 +86,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -106,7 +119,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -157,7 +173,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -173,7 +189,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -189,7 +205,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -217,7 +233,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -268,29 +284,25 @@ def test_image_annotator_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -299,66 +311,53 @@ def test_image_annotator_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -384,7 +383,7 @@ def test_image_annotator_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -414,7 +413,7 @@ def test_image_annotator_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -433,7 +432,7 @@ def test_image_annotator_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -780,6 +779,54 @@ def test_image_annotator_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ImageAnnotatorGrpcTransport, + transports.ImageAnnotatorGrpcAsyncIOTransport, + ], +) +def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_image_annotator_host_no_port(): client = ImageAnnotatorClient( credentials=credentials.AnonymousCredentials(), @@ -801,7 +848,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -813,7 +860,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -824,6 +871,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -838,7 +887,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -879,6 +928,8 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -894,7 +945,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py index 3527d957..b3a8b01b 100644 --- a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py @@ -90,8 +90,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -110,7 +123,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -161,7 +177,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -177,7 +193,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -193,7 +209,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -221,7 +237,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -272,29 +288,25 @@ def test_image_annotator_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -303,66 +315,53 @@ def test_image_annotator_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -388,7 +387,7 @@ def test_image_annotator_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -418,7 +417,7 @@ def test_image_annotator_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -437,7 +436,7 @@ def test_image_annotator_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -978,6 +977,54 @@ def test_image_annotator_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ImageAnnotatorGrpcTransport, + transports.ImageAnnotatorGrpcAsyncIOTransport, + ], +) +def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_image_annotator_host_no_port(): client = ImageAnnotatorClient( credentials=credentials.AnonymousCredentials(), @@ -999,7 +1046,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1011,7 +1058,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1022,6 +1069,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1036,7 +1085,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1077,6 +1126,8 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1092,7 +1143,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py index a2afe4ad..522d9cdf 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py @@ -92,8 +92,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -112,7 +125,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -163,7 +179,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -179,7 +195,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -195,7 +211,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -223,7 +239,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -274,29 +290,25 @@ def test_image_annotator_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -305,66 +317,53 @@ def test_image_annotator_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -390,7 +389,7 @@ def test_image_annotator_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -420,7 +419,7 @@ def test_image_annotator_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -439,7 +438,7 @@ def test_image_annotator_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -980,6 +979,54 @@ def test_image_annotator_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ImageAnnotatorGrpcTransport, + transports.ImageAnnotatorGrpcAsyncIOTransport, + ], +) +def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_image_annotator_host_no_port(): client = ImageAnnotatorClient( credentials=credentials.AnonymousCredentials(), @@ -1001,7 +1048,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1013,7 +1060,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1024,6 +1071,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1038,7 +1087,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1079,6 +1128,8 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1094,7 +1145,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py index af66ff8b..a6f4a49a 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py @@ -95,8 +95,21 @@ def test__get_default_mtls_endpoint(): ) +def test_product_search_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProductSearchClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient] + "client_class", [ProductSearchClient, ProductSearchAsyncClient,] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -115,7 +128,10 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - assert transport == transports.ProductSearchGrpcTransport + available_transports = [ + transports.ProductSearchGrpcTransport, + ] + assert transport in available_transports transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -166,7 +182,7 @@ def test_product_search_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -182,7 +198,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -198,7 +214,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -226,7 +242,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -277,29 +293,25 @@ def test_product_search_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -308,66 +320,53 @@ def test_product_search_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -393,7 +392,7 @@ def test_product_search_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -423,7 +422,7 @@ def test_product_search_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -442,7 +441,7 @@ def test_product_search_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -5158,6 +5157,54 @@ def test_product_search_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ProductSearchGrpcTransport, + transports.ProductSearchGrpcAsyncIOTransport, + ], +) +def test_product_search_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_product_search_host_no_port(): client = ProductSearchClient( credentials=credentials.AnonymousCredentials(), @@ -5179,7 +5226,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5191,7 +5238,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5202,6 +5249,8 @@ def test_product_search_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -5214,7 +5263,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5255,6 +5304,8 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -5270,7 +5321,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py index 2a8d5072..0582f419 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py @@ -93,8 +93,21 @@ def test__get_default_mtls_endpoint(): ) +def test_image_annotator_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ImageAnnotatorClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient] + "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] ) def test_image_annotator_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -113,7 +126,10 @@ def test_image_annotator_client_from_service_account_file(client_class): def test_image_annotator_client_get_transport_class(): transport = ImageAnnotatorClient.get_transport_class() - assert transport == transports.ImageAnnotatorGrpcTransport + available_transports = [ + transports.ImageAnnotatorGrpcTransport, + ] + assert transport in available_transports transport = ImageAnnotatorClient.get_transport_class("grpc") assert transport == transports.ImageAnnotatorGrpcTransport @@ -164,7 +180,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -180,7 +196,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -196,7 +212,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -224,7 +240,7 @@ def test_image_annotator_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -275,29 +291,25 @@ def test_image_annotator_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -306,66 +318,53 @@ def test_image_annotator_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -391,7 +390,7 @@ def test_image_annotator_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -421,7 +420,7 @@ def test_image_annotator_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -440,7 +439,7 @@ def test_image_annotator_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1365,6 +1364,54 @@ def test_image_annotator_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ImageAnnotatorGrpcTransport, + transports.ImageAnnotatorGrpcAsyncIOTransport, + ], +) +def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_image_annotator_host_no_port(): client = ImageAnnotatorClient( credentials=credentials.AnonymousCredentials(), @@ -1386,7 +1433,7 @@ def test_image_annotator_host_with_port(): def test_image_annotator_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( @@ -1398,7 +1445,7 @@ def test_image_annotator_grpc_transport_channel(): def test_image_annotator_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( @@ -1409,6 +1456,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1423,7 +1472,7 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1464,6 +1513,8 @@ def test_image_annotator_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1479,7 +1530,7 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py index 0ad20e9a..0b4abd53 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py @@ -95,8 +95,21 @@ def test__get_default_mtls_endpoint(): ) +def test_product_search_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProductSearchClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "vision.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient] + "client_class", [ProductSearchClient, ProductSearchAsyncClient,] ) def test_product_search_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -115,7 +128,10 @@ def test_product_search_client_from_service_account_file(client_class): def test_product_search_client_get_transport_class(): transport = ProductSearchClient.get_transport_class() - assert transport == transports.ProductSearchGrpcTransport + available_transports = [ + transports.ProductSearchGrpcTransport, + ] + assert transport in available_transports transport = ProductSearchClient.get_transport_class("grpc") assert transport == transports.ProductSearchGrpcTransport @@ -166,7 +182,7 @@ def test_product_search_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -182,7 +198,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -198,7 +214,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -226,7 +242,7 @@ def test_product_search_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -277,29 +293,25 @@ def test_product_search_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -308,66 +320,53 @@ def test_product_search_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -393,7 +392,7 @@ def test_product_search_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -423,7 +422,7 @@ def test_product_search_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -442,7 +441,7 @@ def test_product_search_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -5346,6 +5345,54 @@ def test_product_search_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ProductSearchGrpcTransport, + transports.ProductSearchGrpcAsyncIOTransport, + ], +) +def test_product_search_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_product_search_host_no_port(): client = ProductSearchClient( credentials=credentials.AnonymousCredentials(), @@ -5367,7 +5414,7 @@ def test_product_search_host_with_port(): def test_product_search_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( @@ -5379,7 +5426,7 @@ def test_product_search_grpc_transport_channel(): def test_product_search_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( @@ -5390,6 +5437,8 @@ def test_product_search_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -5402,7 +5451,7 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5443,6 +5492,8 @@ def test_product_search_transport_channel_mtls_with_client_cert_source(transport assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -5458,7 +5509,7 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel From caee254597f617384b61555c09004fe4964b3af4 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:55:53 -0800 Subject: [PATCH 07/11] feat: Add `ErrorReason` enum from `google.api.error_reason` for Google API and minor proto updates. PiperOrigin-RevId: 355218181 Source-Author: Google APIs Source-Date: Tue Feb 2 11:53:01 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 2f8d204b9bc1126439565e25a456eaf6435f38f4 Source-Link: https://github.com/googleapis/googleapis/commit/2f8d204b9bc1126439565e25a456eaf6435f38f4 --- google/cloud/vision_v1p3beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index c00754cf..b38431b4 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,7 +143,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -173,6 +172,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/synth.metadata b/synth.metadata index c8a74192..aa25e393 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "20712b8fe95001b312f62c6c5f33e3e3ec92cfaf", - "internalRef": "354996675" + "sha": "2f8d204b9bc1126439565e25a456eaf6435f38f4", + "internalRef": "355218181" } }, { From 7426aa7591bf215be2bc4a24d4492235863d45c1 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 07:59:04 -0800 Subject: [PATCH 08/11] chore: remove unused package option from Bazel build in aiplatform, speakerid Committer: @miraleung PiperOrigin-RevId: 355238153 Source-Author: Google APIs Source-Date: Tue Feb 2 13:21:18 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: acdf818e86e1b67512f2f6c86d37b7e7ff67e212 Source-Link: https://github.com/googleapis/googleapis/commit/acdf818e86e1b67512f2f6c86d37b7e7ff67e212 --- google/cloud/vision_v1p4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/vision_v1p4beta1/__init__.py b/google/cloud/vision_v1p4beta1/__init__.py index 890dd009..c2b932ed 100644 --- a/google/cloud/vision_v1p4beta1/__init__.py +++ b/google/cloud/vision_v1p4beta1/__init__.py @@ -158,7 +158,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -186,6 +185,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -204,5 +204,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/synth.metadata b/synth.metadata index aa25e393..f04e8c91 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2f8d204b9bc1126439565e25a456eaf6435f38f4", - "internalRef": "355218181" + "sha": "acdf818e86e1b67512f2f6c86d37b7e7ff67e212", + "internalRef": "355238153" } }, { From 3aea5fd24240a38fb988a7034fdb5287622da484 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 08:01:56 -0800 Subject: [PATCH 09/11] chore: update gapic-generator-python PiperOrigin-RevId: 355923884 Source-Author: Google APIs Source-Date: Fri Feb 5 14:04:52 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 5e3dacee19405529b841b53797df799c2383536c Source-Link: https://github.com/googleapis/googleapis/commit/5e3dacee19405529b841b53797df799c2383536c --- .../services/image_annotator/client.py | 17 ++++++++--------- .../vision_v1/services/product_search/pagers.py | 11 ++++++++++- .../services/image_annotator/client.py | 4 ++-- .../services/image_annotator/client.py | 8 ++++---- google/cloud/vision_v1p3beta1/__init__.py | 4 ++-- .../services/image_annotator/client.py | 8 ++++---- .../services/product_search/pagers.py | 11 ++++++++++- google/cloud/vision_v1p4beta1/__init__.py | 4 ++-- .../services/image_annotator/client.py | 17 ++++++++--------- .../services/product_search/pagers.py | 11 ++++++++++- synth.metadata | 4 ++-- 11 files changed, 62 insertions(+), 37 deletions(-) diff --git a/google/cloud/vision_v1/services/image_annotator/client.py b/google/cloud/vision_v1/services/image_annotator/client.py index 70f1a314..9bf982c9 100644 --- a/google/cloud/vision_v1/services/image_annotator/client.py +++ b/google/cloud/vision_v1/services/image_annotator/client.py @@ -423,8 +423,8 @@ def batch_annotate_images( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -501,8 +501,8 @@ def batch_annotate_files( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -594,12 +594,11 @@ def async_batch_annotate_images( # If we have keyword arguments corresponding to fields on the # request, apply these. + if requests is not None: + request.requests = requests if output_config is not None: request.output_config = output_config - if requests: - request.requests.extend(requests) - # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ @@ -687,8 +686,8 @@ def async_batch_annotate_files( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/google/cloud/vision_v1/services/product_search/pagers.py b/google/cloud/vision_v1/services/product_search/pagers.py index cf8c6a00..8d317b18 100644 --- a/google/cloud/vision_v1/services/product_search/pagers.py +++ b/google/cloud/vision_v1/services/product_search/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.vision_v1.types import product_search_service diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py index 5fd7dee1..23d0dddd 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py @@ -389,8 +389,8 @@ def batch_annotate_images( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py index be73d3f1..25d7616a 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py @@ -391,8 +391,8 @@ def batch_annotate_images( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -471,8 +471,8 @@ def async_batch_annotate_files( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index b38431b4..c00754cf 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,6 +143,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -172,7 +173,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py index 975509de..eb5a0cf9 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py @@ -423,8 +423,8 @@ def batch_annotate_images( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -503,8 +503,8 @@ def async_batch_annotate_files( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py index b145dd71..49f585a6 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.vision_v1p3beta1.types import product_search_service diff --git a/google/cloud/vision_v1p4beta1/__init__.py b/google/cloud/vision_v1p4beta1/__init__.py index c2b932ed..890dd009 100644 --- a/google/cloud/vision_v1p4beta1/__init__.py +++ b/google/cloud/vision_v1p4beta1/__init__.py @@ -158,6 +158,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", + "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -185,7 +186,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", - "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -204,5 +204,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ImageAnnotatorClient", + "ProductSearchClient", ) diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py index e8a00a76..340a462f 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py @@ -423,8 +423,8 @@ def batch_annotate_images( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -501,8 +501,8 @@ def batch_annotate_files( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -594,12 +594,11 @@ def async_batch_annotate_images( # If we have keyword arguments corresponding to fields on the # request, apply these. + if requests is not None: + request.requests = requests if output_config is not None: request.output_config = output_config - if requests: - request.requests.extend(requests) - # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ @@ -687,8 +686,8 @@ def async_batch_annotate_files( # If we have keyword arguments corresponding to fields on the # request, apply these. - if requests: - request.requests.extend(requests) + if requests is not None: + request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py index 2c5d61b2..2786380e 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/pagers.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.vision_v1p4beta1.types import product_search_service diff --git a/synth.metadata b/synth.metadata index f04e8c91..d994bd87 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "acdf818e86e1b67512f2f6c86d37b7e7ff67e212", - "internalRef": "355238153" + "sha": "5e3dacee19405529b841b53797df799c2383536c", + "internalRef": "355923884" } }, { From 45fecf91417d18af12816c25d7411474d55c6000 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 08:03:46 -0800 Subject: [PATCH 10/11] fix: sync vision v1 protos to get extra FaceAnnotation Landmark Types PiperOrigin-RevId: 356556588 Source-Author: Google APIs Source-Date: Tue Feb 9 11:55:06 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 9b95bf0e95501ec98537e0d2d9d36bb763ebd5b9 Source-Link: https://github.com/googleapis/googleapis/commit/9b95bf0e95501ec98537e0d2d9d36bb763ebd5b9 --- google/cloud/vision_v1/__init__.py | 4 +- google/cloud/vision_v1/proto/geometry.proto | 3 +- .../vision_v1/proto/image_annotator.proto | 53 ++++++++++++------- .../vision_v1/proto/product_search.proto | 11 ++-- .../proto/product_search_service.proto | 14 ++--- .../vision_v1/proto/text_annotation.proto | 3 +- .../cloud/vision_v1/proto/web_detection.proto | 3 +- .../services/product_search/async_client.py | 4 +- .../services/product_search/client.py | 4 +- .../cloud/vision_v1/types/image_annotator.py | 6 +++ .../cloud/vision_v1/types/product_search.py | 4 +- .../vision_v1/types/product_search_service.py | 14 +++-- synth.metadata | 4 +- 13 files changed, 67 insertions(+), 60 deletions(-) diff --git a/google/cloud/vision_v1/__init__.py b/google/cloud/vision_v1/__init__.py index 8b1d075a..df7114a8 100644 --- a/google/cloud/vision_v1/__init__.py +++ b/google/cloud/vision_v1/__init__.py @@ -152,7 +152,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -180,6 +179,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Paragraph", "Position", "Product", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSet", @@ -198,5 +198,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/google/cloud/vision_v1/proto/geometry.proto b/google/cloud/vision_v1/proto/geometry.proto index 881c8f84..376d2da3 100644 --- a/google/cloud/vision_v1/proto/geometry.proto +++ b/google/cloud/vision_v1/proto/geometry.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; diff --git a/google/cloud/vision_v1/proto/image_annotator.proto b/google/cloud/vision_v1/proto/image_annotator.proto index 7f13e35c..3852bed7 100644 --- a/google/cloud/vision_v1/proto/image_annotator.proto +++ b/google/cloud/vision_v1/proto/image_annotator.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; @@ -48,7 +47,8 @@ service ImageAnnotator { "https://www.googleapis.com/auth/cloud-vision"; // Run image detection and annotation for a batch of images. - rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) { + rpc BatchAnnotateImages(BatchAnnotateImagesRequest) + returns (BatchAnnotateImagesResponse) { option (google.api.http) = { post: "/v1/images:annotate" body: "*" @@ -71,7 +71,8 @@ service ImageAnnotator { // AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each // file provided and perform detection and annotation for each image // extracted. - rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) returns (BatchAnnotateFilesResponse) { + rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) + returns (BatchAnnotateFilesResponse) { option (google.api.http) = { post: "/v1/files:annotate" body: "*" @@ -96,7 +97,8 @@ service ImageAnnotator { // // This service will write image annotation outputs to json files in customer // GCS bucket, each json file containing BatchAnnotateImagesResponse proto. - rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) returns (google.longrunning.Operation) { + rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1/images:asyncBatchAnnotate" body: "*" @@ -122,7 +124,8 @@ service ImageAnnotator { // `google.longrunning.Operations` interface. // `Operation.metadata` contains `OperationMetadata` (metadata). // `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). - rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (google.longrunning.Operation) { + rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1/files:asyncBatchAnnotate" body: "*" @@ -242,6 +245,9 @@ message Image { // Image content, represented as a stream of bytes. // Note: As with all `bytes` fields, protobuffers use a pure binary // representation, whereas JSON representations use base64. + // + // Currently, this field only works for BatchAnnotateImages requests. It does + // not work for AsyncBatchAnnotateImages requests. bytes content = 1; // Google Cloud Storage image location, or publicly-accessible image @@ -385,6 +391,12 @@ message FaceAnnotation { // Chin right gonion. CHIN_RIGHT_GONION = 34; + + // Left cheek center. + LEFT_CHEEK_CENTER = 35; + + // Right cheek center. + RIGHT_CHEEK_CENTER = 36; } // Face landmark type. @@ -569,27 +581,27 @@ message SafeSearchAnnotation { // Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means // very confident. - float adult_confidence = 16; + float adult_confidence = 16 [deprecated = true]; // Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means // very confident. - float spoof_confidence = 18; + float spoof_confidence = 18 [deprecated = true]; // Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means // very confident. - float medical_confidence = 20; + float medical_confidence = 20 [deprecated = true]; // Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means // very confident. - float violence_confidence = 22; + float violence_confidence = 22 [deprecated = true]; // Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very // confident. - float racy_confidence = 24; + float racy_confidence = 24 [deprecated = true]; // Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very // confident. - float nsfw_confidence = 26; + float nsfw_confidence = 26 [deprecated = true]; } // Rectangle determined by min and max `LatLng` pairs. @@ -667,7 +679,6 @@ message WebDetectionParams { // Parameters for text detections. This is used to control TEXT_DETECTION and // DOCUMENT_TEXT_DETECTION features. message TextDetectionParams { - // By default, Cloud Vision API only includes confidence score for // DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence // score for TEXT_DETECTION as well. @@ -781,7 +792,8 @@ message AnnotateImageResponse { // Multiple image annotation requests are batched into a single service call. message BatchAnnotateImagesRequest { // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; + repeated AnnotateImageRequest requests = 1 + [(google.api.field_behavior) = REQUIRED]; // Optional. Target project and location to make a call. // @@ -852,9 +864,10 @@ message AnnotateFileResponse { // A list of requests to annotate files using the BatchAnnotateFiles API. message BatchAnnotateFilesRequest { - // Required. The list of file annotation requests. Right now we support only one - // AnnotateFileRequest in BatchAnnotateFilesRequest. - repeated AnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; + // Required. The list of file annotation requests. Right now we support only + // one AnnotateFileRequest in BatchAnnotateFilesRequest. + repeated AnnotateFileRequest requests = 1 + [(google.api.field_behavior) = REQUIRED]; // Optional. Target project and location to make a call. // @@ -902,7 +915,8 @@ message AsyncAnnotateFileResponse { // Request for async image annotation for a list of images. message AsyncBatchAnnotateImagesRequest { // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; + repeated AnnotateImageRequest requests = 1 + [(google.api.field_behavior) = REQUIRED]; // Required. The desired output location and metadata (e.g. format). OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; @@ -932,7 +946,8 @@ message AsyncBatchAnnotateImagesResponse { // call. message AsyncBatchAnnotateFilesRequest { // Required. Individual async file annotation requests for this batch. - repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; + repeated AsyncAnnotateFileRequest requests = 1 + [(google.api.field_behavior) = REQUIRED]; // Optional. Target project and location to make a call. // diff --git a/google/cloud/vision_v1/proto/product_search.proto b/google/cloud/vision_v1/proto/product_search.proto index 6df694b8..564925fe 100644 --- a/google/cloud/vision_v1/proto/product_search.proto +++ b/google/cloud/vision_v1/proto/product_search.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,17 +11,16 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; package google.cloud.vision.v1; +import "google/api/resource.proto"; import "google/cloud/vision/v1/geometry.proto"; import "google/cloud/vision/v1/product_search_service.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; -import "google/api/resource.proto"; option cc_enable_arenas = true; option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; @@ -33,7 +32,7 @@ option objc_class_prefix = "GCVN"; // Parameters for a product search request. message ProductSearchParams { // The bounding polygon around the area of interest in the image. - // Optional. If it is not specified, system discretion will be applied. + // If it is not specified, system discretion will be applied. BoundingPoly bounding_poly = 9; // The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. @@ -41,8 +40,8 @@ message ProductSearchParams { // Format is: // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. string product_set = 6 [(google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - }]; + type: "vision.googleapis.com/ProductSet" + }]; // The list of product categories to search in. Currently, we only consider // the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", diff --git a/google/cloud/vision_v1/proto/product_search_service.proto b/google/cloud/vision_v1/proto/product_search_service.proto index ecfcdf6c..5a61f542 100644 --- a/google/cloud/vision_v1/proto/product_search_service.proto +++ b/google/cloud/vision_v1/proto/product_search_service.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; @@ -397,9 +396,9 @@ message Product { string description = 3; // Immutable. The category for the product identified by the reference image. This should - // be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories - // "homegoods", "apparel", and "toys" are still supported, but these should - // not be used for new products. + // be one of "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1" or + // "general-v1". The legacy categories "homegoods", "apparel", and "toys" are + // still supported, but these should not be used for new products. string product_category = 4 [(google.api.field_behavior) = IMMUTABLE]; // Key-value pairs that can be attached to a product. At query time, @@ -465,7 +464,6 @@ message ReferenceImage { // The resource name of the reference image. // // Format is: - // // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. // // This field is ignored when creating a reference image. @@ -638,7 +636,7 @@ message GetProductSetRequest { // Required. Resource name of the ProductSet to get. // // Format is: - // `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -737,7 +735,6 @@ message GetReferenceImageRequest { // Required. The resource name of the ReferenceImage to get. // // Format is: - // // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. string name = 1 [ (google.api.field_behavior) = REQUIRED, @@ -752,7 +749,6 @@ message DeleteReferenceImageRequest { // Required. The resource name of the reference image to delete. // // Format is: - // // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` string name = 1 [ (google.api.field_behavior) = REQUIRED, diff --git a/google/cloud/vision_v1/proto/text_annotation.proto b/google/cloud/vision_v1/proto/text_annotation.proto index 97f9c8fa..db3bbdc5 100644 --- a/google/cloud/vision_v1/proto/text_annotation.proto +++ b/google/cloud/vision_v1/proto/text_annotation.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; diff --git a/google/cloud/vision_v1/proto/web_detection.proto b/google/cloud/vision_v1/proto/web_detection.proto index 5ba86403..5d239b89 100644 --- a/google/cloud/vision_v1/proto/web_detection.proto +++ b/google/cloud/vision_v1/proto/web_detection.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; diff --git a/google/cloud/vision_v1/services/product_search/async_client.py b/google/cloud/vision_v1/services/product_search/async_client.py index 4535cd22..2bb84807 100644 --- a/google/cloud/vision_v1/services/product_search/async_client.py +++ b/google/cloud/vision_v1/services/product_search/async_client.py @@ -401,7 +401,7 @@ async def get_product_set( Required. Resource name of the ProductSet to get. Format is: - ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` + ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1287,7 +1287,6 @@ async def delete_reference_image( delete. Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` This corresponds to the ``name`` field @@ -1467,7 +1466,6 @@ async def get_reference_image( get. Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. This corresponds to the ``name`` field diff --git a/google/cloud/vision_v1/services/product_search/client.py b/google/cloud/vision_v1/services/product_search/client.py index d1ff5e2c..86b6a2a6 100644 --- a/google/cloud/vision_v1/services/product_search/client.py +++ b/google/cloud/vision_v1/services/product_search/client.py @@ -620,7 +620,7 @@ def get_product_set( Required. Resource name of the ProductSet to get. Format is: - ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` + ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1447,7 +1447,6 @@ def delete_reference_image( delete. Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` This corresponds to the ``name`` field @@ -1613,7 +1612,6 @@ def get_reference_image( get. Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. This corresponds to the ``name`` field diff --git a/google/cloud/vision_v1/types/image_annotator.py b/google/cloud/vision_v1/types/image_annotator.py index 4f901266..2a69494e 100644 --- a/google/cloud/vision_v1/types/image_annotator.py +++ b/google/cloud/vision_v1/types/image_annotator.py @@ -176,6 +176,10 @@ class Image(proto.Message): Image content, represented as a stream of bytes. Note: As with all ``bytes`` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. + + Currently, this field only works for BatchAnnotateImages + requests. It does not work for AsyncBatchAnnotateImages + requests. source (google.cloud.vision_v1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible image URL. If both ``content`` and ``source`` are provided @@ -295,6 +299,8 @@ class Type(proto.Enum): CHIN_GNATHION = 32 CHIN_LEFT_GONION = 33 CHIN_RIGHT_GONION = 34 + LEFT_CHEEK_CENTER = 35 + RIGHT_CHEEK_CENTER = 36 type_ = proto.Field(proto.ENUM, number=3, enum="FaceAnnotation.Landmark.Type",) diff --git a/google/cloud/vision_v1/types/product_search.py b/google/cloud/vision_v1/types/product_search.py index 127bbb97..d28d3390 100644 --- a/google/cloud/vision_v1/types/product_search.py +++ b/google/cloud/vision_v1/types/product_search.py @@ -35,8 +35,8 @@ class ProductSearchParams(proto.Message): Attributes: bounding_poly (google.cloud.vision_v1.types.BoundingPoly): The bounding polygon around the area of - interest in the image. Optional. If it is not - specified, system discretion will be applied. + interest in the image. If it is not specified, + system discretion will be applied. product_set (str): The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be diff --git a/google/cloud/vision_v1/types/product_search_service.py b/google/cloud/vision_v1/types/product_search_service.py index 158deb5a..65cb5d7f 100644 --- a/google/cloud/vision_v1/types/product_search_service.py +++ b/google/cloud/vision_v1/types/product_search_service.py @@ -83,10 +83,11 @@ class Product(proto.Message): product_category (str): Immutable. The category for the product identified by the reference image. This should - be either "homegoods-v2", "apparel-v2", or - "toys-v2". The legacy categories "homegoods", - "apparel", and "toys" are still supported, but - these should not be used for new products. + be one of "homegoods-v2", "apparel-v2", + "toys-v2", "packagedgoods-v1" or "general-v1". + The legacy categories "homegoods", "apparel", + and "toys" are still supported, but these should + not be used for new products. product_labels (Sequence[google.cloud.vision_v1.types.Product.KeyValue]): Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the @@ -186,7 +187,6 @@ class ReferenceImage(proto.Message): The resource name of the reference image. Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. This field is ignored when creating a reference image. @@ -415,7 +415,7 @@ class GetProductSetRequest(proto.Message): Required. Resource name of the ProductSet to get. Format is: - ``projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`` + ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ name = proto.Field(proto.STRING, number=1) @@ -545,7 +545,6 @@ class GetReferenceImageRequest(proto.Message): Required. The resource name of the ReferenceImage to get. Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. """ @@ -561,7 +560,6 @@ class DeleteReferenceImageRequest(proto.Message): delete. Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` """ diff --git a/synth.metadata b/synth.metadata index d994bd87..dde27ef9 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5e3dacee19405529b841b53797df799c2383536c", - "internalRef": "355923884" + "sha": "9b95bf0e95501ec98537e0d2d9d36bb763ebd5b9", + "internalRef": "356556588" } }, { From 62732e0bd28e3268134f271e6de5ed630382eebf Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Wed, 10 Feb 2021 08:03:46 -0800 Subject: [PATCH 11/11] feat: supports SentimentAnalysisResult in webhook request docs: minor updates in wording PiperOrigin-RevId: 356624136 Source-Author: Google APIs Source-Date: Tue Feb 9 16:52:56 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: e28aa8570dc86136fe677202c976f4ee00d77f61 Source-Link: https://github.com/googleapis/googleapis/commit/e28aa8570dc86136fe677202c976f4ee00d77f61 --- google/cloud/vision_v1p3beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/vision_v1p3beta1/__init__.py b/google/cloud/vision_v1p3beta1/__init__.py index c00754cf..b38431b4 100644 --- a/google/cloud/vision_v1p3beta1/__init__.py +++ b/google/cloud/vision_v1p3beta1/__init__.py @@ -143,7 +143,6 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "GetReferenceImageRequest", "Image", "ImageAnnotationContext", - "ImageAnnotatorClient", "ImageContext", "ImageProperties", "ImageSource", @@ -173,6 +172,7 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "Position", "Product", "ProductSearchCategory", + "ProductSearchClient", "ProductSearchParams", "ProductSearchResults", "ProductSearchResultsView", @@ -190,5 +190,5 @@ class ImageAnnotatorClient(VisionHelpers, IacImageAnnotatorClient): "WebDetection", "WebDetectionParams", "Word", - "ProductSearchClient", + "ImageAnnotatorClient", ) diff --git a/synth.metadata b/synth.metadata index dde27ef9..d168bcaa 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "9b95bf0e95501ec98537e0d2d9d36bb763ebd5b9", - "internalRef": "356556588" + "sha": "e28aa8570dc86136fe677202c976f4ee00d77f61", + "internalRef": "356624136" } }, {