diff --git a/docs/gapic/v1/api.rst b/docs/gapic/v1/api.rst
new file mode 100644
index 0000000..756900a
--- /dev/null
+++ b/docs/gapic/v1/api.rst
@@ -0,0 +1,6 @@
+Client for Web Risk API
+=======================
+
+.. automodule:: google.cloud.webrisk_v1
+ :members:
+ :inherited-members:
\ No newline at end of file
diff --git a/docs/gapic/v1/types.rst b/docs/gapic/v1/types.rst
new file mode 100644
index 0000000..da1de57
--- /dev/null
+++ b/docs/gapic/v1/types.rst
@@ -0,0 +1,5 @@
+Types for Web Risk API Client
+=============================
+
+.. automodule:: google.cloud.webrisk_v1.types
+ :members:
\ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index 0df8ada..a73df25 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,10 +1,26 @@
.. include:: README.rst
-Api Reference
+v1
+-------------
+.. toctree::
+ :maxdepth: 2
+
+ gapic/v1/api
+ gapic/v1/types
+
+
+v1beta1
-------------
.. toctree::
:maxdepth: 2
gapic/v1beta1/api
gapic/v1beta1/types
+ changelog
+
+Changelog
+---------
+.. toctree::
+ :maxdepth: 2
+
changelog
\ No newline at end of file
diff --git a/google/cloud/webrisk.py b/google/cloud/webrisk.py
index e2971fd..a5d83db 100644
--- a/google/cloud/webrisk.py
+++ b/google/cloud/webrisk.py
@@ -17,9 +17,9 @@
from __future__ import absolute_import
-from google.cloud.webrisk_v1beta1 import WebRiskServiceV1Beta1Client
-from google.cloud.webrisk_v1beta1 import enums
-from google.cloud.webrisk_v1beta1 import types
+from google.cloud.webrisk_v1 import WebRiskServiceClient
+from google.cloud.webrisk_v1 import enums
+from google.cloud.webrisk_v1 import types
-__all__ = ("enums", "types", "WebRiskServiceV1Beta1Client")
+__all__ = ("enums", "types", "WebRiskServiceClient")
diff --git a/google/cloud/webrisk_v1/__init__.py b/google/cloud/webrisk_v1/__init__.py
new file mode 100644
index 0000000..6ee9a05
--- /dev/null
+++ b/google/cloud/webrisk_v1/__init__.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+
+from __future__ import absolute_import
+import sys
+import warnings
+
+from google.cloud.webrisk_v1 import types
+from google.cloud.webrisk_v1.gapic import enums
+from google.cloud.webrisk_v1.gapic import web_risk_service_client
+
+
+if sys.version_info[:2] == (2, 7):
+ message = (
+ "A future version of this library will drop support for Python 2.7."
+ "More details about Python 2 support for Google Cloud Client Libraries"
+ "can be found at https://cloud.google.com/python/docs/python2-sunset/"
+ )
+ warnings.warn(message, DeprecationWarning)
+
+
+class WebRiskServiceClient(web_risk_service_client.WebRiskServiceClient):
+ __doc__ = web_risk_service_client.WebRiskServiceClient.__doc__
+ enums = enums
+
+
+__all__ = ("enums", "types", "WebRiskServiceClient")
diff --git a/google/cloud/webrisk_v1/gapic/__init__.py b/google/cloud/webrisk_v1/gapic/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/google/cloud/webrisk_v1/gapic/enums.py b/google/cloud/webrisk_v1/gapic/enums.py
new file mode 100644
index 0000000..42fad3e
--- /dev/null
+++ b/google/cloud/webrisk_v1/gapic/enums.py
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+"""Wrappers for protocol buffer enum types."""
+
+import enum
+
+
+class CompressionType(enum.IntEnum):
+ """
+ The ways in which threat entry sets can be compressed.
+
+ Attributes:
+ COMPRESSION_TYPE_UNSPECIFIED (int): Unknown.
+ RAW (int): Raw, uncompressed data.
+ RICE (int): Rice-Golomb encoded data.
+ """
+
+ COMPRESSION_TYPE_UNSPECIFIED = 0
+ RAW = 1
+ RICE = 2
+
+
+class ThreatType(enum.IntEnum):
+ """
+ The type of threat. This maps dirrectly to the threat list a threat may
+ belong to.
+
+ Attributes:
+ THREAT_TYPE_UNSPECIFIED (int): Unknown.
+ MALWARE (int): Malware targeting any platform.
+ SOCIAL_ENGINEERING (int): Social engineering targeting any platform.
+ UNWANTED_SOFTWARE (int): Unwanted software targeting any platform.
+ """
+
+ THREAT_TYPE_UNSPECIFIED = 0
+ MALWARE = 1
+ SOCIAL_ENGINEERING = 2
+ UNWANTED_SOFTWARE = 3
+
+
+class ComputeThreatListDiffResponse(object):
+ class ResponseType(enum.IntEnum):
+ """
+ The type of response sent to the client.
+
+ Attributes:
+ RESPONSE_TYPE_UNSPECIFIED (int): Unknown.
+ DIFF (int): Partial updates are applied to the client's existing local database.
+ RESET (int): Full updates resets the client's entire local database. This means
+ that either the client had no state, was seriously out-of-date,
+ or the client is believed to be corrupt.
+ """
+
+ RESPONSE_TYPE_UNSPECIFIED = 0
+ DIFF = 1
+ RESET = 2
diff --git a/google/cloud/webrisk_v1/gapic/transports/__init__.py b/google/cloud/webrisk_v1/gapic/transports/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/google/cloud/webrisk_v1/gapic/transports/web_risk_service_grpc_transport.py b/google/cloud/webrisk_v1/gapic/transports/web_risk_service_grpc_transport.py
new file mode 100644
index 0000000..b82d975
--- /dev/null
+++ b/google/cloud/webrisk_v1/gapic/transports/web_risk_service_grpc_transport.py
@@ -0,0 +1,180 @@
+# -*- coding: utf-8 -*-
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+
+import google.api_core.grpc_helpers
+
+from google.cloud.webrisk_v1.proto import webrisk_pb2_grpc
+
+
+class WebRiskServiceGrpcTransport(object):
+ """gRPC transport class providing stubs for
+ google.cloud.webrisk.v1 WebRiskService API.
+
+ The transport provides access to the raw gRPC stubs,
+ which can be used to take advantage of advanced
+ features of gRPC.
+ """
+
+ # The scopes needed to make gRPC calls to all of the methods defined
+ # in this service.
+ _OAUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
+
+ def __init__(
+ self, channel=None, credentials=None, address="webrisk.googleapis.com:443"
+ ):
+ """Instantiate the transport class.
+
+ Args:
+ channel (grpc.Channel): A ``Channel`` instance through
+ which to make calls. This argument is mutually exclusive
+ with ``credentials``; providing both will raise an exception.
+ credentials (google.auth.credentials.Credentials): The
+ authorization credentials to attach to requests. These
+ credentials identify this application to the service. If none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ address (str): The address where the service is hosted.
+ """
+ # If both `channel` and `credentials` are specified, raise an
+ # exception (channels come with credentials baked in already).
+ if channel is not None and credentials is not None:
+ raise ValueError(
+ "The `channel` and `credentials` arguments are mutually " "exclusive."
+ )
+
+ # Create the channel.
+ if channel is None:
+ channel = self.create_channel(
+ address=address,
+ credentials=credentials,
+ options={
+ "grpc.max_send_message_length": -1,
+ "grpc.max_receive_message_length": -1,
+ }.items(),
+ )
+
+ self._channel = channel
+
+ # gRPC uses objects called "stubs" that are bound to the
+ # channel and provide a basic method for each RPC.
+ self._stubs = {
+ "web_risk_service_stub": webrisk_pb2_grpc.WebRiskServiceStub(channel)
+ }
+
+ @classmethod
+ def create_channel(
+ cls, address="webrisk.googleapis.com:443", credentials=None, **kwargs
+ ):
+ """Create and return a gRPC channel object.
+
+ Args:
+ address (str): The host for the channel to use.
+ credentials (~.Credentials): The
+ authorization credentials to attach to requests. These
+ credentials identify this application to the service. If
+ none are specified, the client will attempt to ascertain
+ the credentials from the environment.
+ kwargs (dict): Keyword arguments, which are passed to the
+ channel creation.
+
+ Returns:
+ grpc.Channel: A gRPC channel object.
+ """
+ return google.api_core.grpc_helpers.create_channel(
+ address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
+ )
+
+ @property
+ def channel(self):
+ """The gRPC channel used by the transport.
+
+ Returns:
+ grpc.Channel: A gRPC channel object.
+ """
+ return self._channel
+
+ @property
+ def compute_threat_list_diff(self):
+ """Return the gRPC stub for :meth:`WebRiskServiceClient.compute_threat_list_diff`.
+
+ Gets the most recent threat list diffs. These diffs should be applied to
+ a local database of hashes to keep it up-to-date. If the local database is
+ empty or excessively out-of-date, a complete snapshot of the database will
+ be returned. This Method only updates a single ThreatList at a time. To
+ update multiple ThreatList databases, this method needs to be called once
+ for each list.
+
+ Returns:
+ Callable: A callable which accepts the appropriate
+ deserialized request object and returns a
+ deserialized response object.
+ """
+ return self._stubs["web_risk_service_stub"].ComputeThreatListDiff
+
+ @property
+ def search_uris(self):
+ """Return the gRPC stub for :meth:`WebRiskServiceClient.search_uris`.
+
+ This method is used to check whether a URI is on a given threatList.
+ Multiple threatLists may be searched in a single query.
+ The response will list all requested threatLists the URI was found to
+ match. If the URI is not found on any of the requested ThreatList an
+ empty response will be returned.
+
+ Returns:
+ Callable: A callable which accepts the appropriate
+ deserialized request object and returns a
+ deserialized response object.
+ """
+ return self._stubs["web_risk_service_stub"].SearchUris
+
+ @property
+ def search_hashes(self):
+ """Return the gRPC stub for :meth:`WebRiskServiceClient.search_hashes`.
+
+ Gets the full hashes that match the requested hash prefix.
+ This is used after a hash prefix is looked up in a threatList
+ and there is a match. The client side threatList only holds partial hashes
+ so the client must query this method to determine if there is a full
+ hash match of a threat.
+
+ Returns:
+ Callable: A callable which accepts the appropriate
+ deserialized request object and returns a
+ deserialized response object.
+ """
+ return self._stubs["web_risk_service_stub"].SearchHashes
+
+ @property
+ def create_submission(self):
+ """Return the gRPC stub for :meth:`WebRiskServiceClient.create_submission`.
+
+ Creates a Submission of a URI suspected of containing phishing
+ content to be reviewed. If the result verifies the existence of
+ malicious phishing content, the site will be added to the `Google's
+ Social Engineering
+ lists `__ in
+ order to protect users that could get exposed to this threat in the
+ future. Only projects with CREATE_SUBMISSION_USERS visibility can use
+ this method.
+
+ Returns:
+ Callable: A callable which accepts the appropriate
+ deserialized request object and returns a
+ deserialized response object.
+ """
+ return self._stubs["web_risk_service_stub"].CreateSubmission
diff --git a/google/cloud/webrisk_v1/gapic/web_risk_service_client.py b/google/cloud/webrisk_v1/gapic/web_risk_service_client.py
new file mode 100644
index 0000000..5e6c4a0
--- /dev/null
+++ b/google/cloud/webrisk_v1/gapic/web_risk_service_client.py
@@ -0,0 +1,495 @@
+# -*- coding: utf-8 -*-
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+"""Accesses the google.cloud.webrisk.v1 WebRiskService API."""
+
+import pkg_resources
+import warnings
+
+from google.oauth2 import service_account
+import google.api_core.client_options
+import google.api_core.gapic_v1.client_info
+import google.api_core.gapic_v1.config
+import google.api_core.gapic_v1.method
+import google.api_core.gapic_v1.routing_header
+import google.api_core.grpc_helpers
+import google.api_core.path_template
+import grpc
+
+from google.cloud.webrisk_v1.gapic import enums
+from google.cloud.webrisk_v1.gapic import web_risk_service_client_config
+from google.cloud.webrisk_v1.gapic.transports import web_risk_service_grpc_transport
+from google.cloud.webrisk_v1.proto import webrisk_pb2
+from google.cloud.webrisk_v1.proto import webrisk_pb2_grpc
+
+
+_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-webrisk").version
+
+
+class WebRiskServiceClient(object):
+ """
+ Web Risk API defines an interface to detect malicious URLs on your
+ website and in client applications.
+ """
+
+ SERVICE_ADDRESS = "webrisk.googleapis.com:443"
+ """The default address of the service."""
+
+ # The name of the interface for this client. This is the key used to
+ # find the method configuration in the client_config dictionary.
+ _INTERFACE_NAME = "google.cloud.webrisk.v1.WebRiskService"
+
+ @classmethod
+ def from_service_account_file(cls, filename, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ file.
+
+ Args:
+ filename (str): The path to the service account private key json
+ file.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ WebRiskServiceClient: The constructed client.
+ """
+ credentials = service_account.Credentials.from_service_account_file(filename)
+ kwargs["credentials"] = credentials
+ return cls(*args, **kwargs)
+
+ from_service_account_json = from_service_account_file
+
+ @classmethod
+ def project_path(cls, project):
+ """Return a fully-qualified project string."""
+ return google.api_core.path_template.expand(
+ "projects/{project}", project=project
+ )
+
+ def __init__(
+ self,
+ transport=None,
+ channel=None,
+ credentials=None,
+ client_config=None,
+ client_info=None,
+ client_options=None,
+ ):
+ """Constructor.
+
+ Args:
+ transport (Union[~.WebRiskServiceGrpcTransport,
+ Callable[[~.Credentials, type], ~.WebRiskServiceGrpcTransport]): A transport
+ instance, responsible for actually making the API calls.
+ The default transport uses the gRPC protocol.
+ This argument may also be a callable which returns a
+ transport instance. Callables will be sent the credentials
+ as the first argument and the default transport class as
+ the second argument.
+ channel (grpc.Channel): DEPRECATED. A ``Channel`` instance
+ through which to make calls. This argument is mutually exclusive
+ with ``credentials``; providing both will raise an exception.
+ credentials (google.auth.credentials.Credentials): The
+ authorization credentials to attach to requests. These
+ credentials identify this application to the service. If none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ This argument is mutually exclusive with providing a
+ transport instance to ``transport``; doing so will raise
+ an exception.
+ client_config (dict): DEPRECATED. A dictionary of call options for
+ each method. If not specified, the default configuration is used.
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+ client_options (Union[dict, google.api_core.client_options.ClientOptions]):
+ Client options used to set user options on the client. API Endpoint
+ should be set through client_options.
+ """
+ # Raise deprecation warnings for things we want to go away.
+ if client_config is not None:
+ warnings.warn(
+ "The `client_config` argument is deprecated.",
+ PendingDeprecationWarning,
+ stacklevel=2,
+ )
+ else:
+ client_config = web_risk_service_client_config.config
+
+ if channel:
+ warnings.warn(
+ "The `channel` argument is deprecated; use " "`transport` instead.",
+ PendingDeprecationWarning,
+ stacklevel=2,
+ )
+
+ api_endpoint = self.SERVICE_ADDRESS
+ if client_options:
+ if type(client_options) == dict:
+ client_options = google.api_core.client_options.from_dict(
+ client_options
+ )
+ if client_options.api_endpoint:
+ api_endpoint = client_options.api_endpoint
+
+ # Instantiate the transport.
+ # The transport is responsible for handling serialization and
+ # deserialization and actually sending data to the service.
+ if transport:
+ if callable(transport):
+ self.transport = transport(
+ credentials=credentials,
+ default_class=web_risk_service_grpc_transport.WebRiskServiceGrpcTransport,
+ address=api_endpoint,
+ )
+ else:
+ if credentials:
+ raise ValueError(
+ "Received both a transport instance and "
+ "credentials; these are mutually exclusive."
+ )
+ self.transport = transport
+ else:
+ self.transport = web_risk_service_grpc_transport.WebRiskServiceGrpcTransport(
+ address=api_endpoint, channel=channel, credentials=credentials
+ )
+
+ if client_info is None:
+ client_info = google.api_core.gapic_v1.client_info.ClientInfo(
+ gapic_version=_GAPIC_LIBRARY_VERSION
+ )
+ else:
+ client_info.gapic_version = _GAPIC_LIBRARY_VERSION
+ self._client_info = client_info
+
+ # Parse out the default settings for retry and timeout for each RPC
+ # from the client configuration.
+ # (Ordinarily, these are the defaults specified in the `*_config.py`
+ # file next to this one.)
+ self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
+ client_config["interfaces"][self._INTERFACE_NAME]
+ )
+
+ # Save a dictionary of cached API call functions.
+ # These are the actual callables which invoke the proper
+ # transport methods, wrapped with `wrap_method` to add retry,
+ # timeout, and the like.
+ self._inner_api_calls = {}
+
+ # Service calls
+ def compute_threat_list_diff(
+ self,
+ threat_type,
+ constraints,
+ version_token=None,
+ retry=google.api_core.gapic_v1.method.DEFAULT,
+ timeout=google.api_core.gapic_v1.method.DEFAULT,
+ metadata=None,
+ ):
+ """
+ Gets the most recent threat list diffs. These diffs should be applied to
+ a local database of hashes to keep it up-to-date. If the local database is
+ empty or excessively out-of-date, a complete snapshot of the database will
+ be returned. This Method only updates a single ThreatList at a time. To
+ update multiple ThreatList databases, this method needs to be called once
+ for each list.
+
+ Example:
+ >>> from google.cloud import webrisk_v1
+ >>> from google.cloud.webrisk_v1 import enums
+ >>>
+ >>> client = webrisk_v1.WebRiskServiceClient()
+ >>>
+ >>> # TODO: Initialize `threat_type`:
+ >>> threat_type = enums.ThreatType.THREAT_TYPE_UNSPECIFIED
+ >>>
+ >>> # TODO: Initialize `constraints`:
+ >>> constraints = {}
+ >>>
+ >>> response = client.compute_threat_list_diff(threat_type, constraints)
+
+ Args:
+ threat_type (~google.cloud.webrisk_v1.types.ThreatType): Required. The threat list to update. Only a single ThreatType should be specified.
+ constraints (Union[dict, ~google.cloud.webrisk_v1.types.Constraints]): Required. The constraints associated with this request.
+
+ If a dict is provided, it must be of the same form as the protobuf
+ message :class:`~google.cloud.webrisk_v1.types.Constraints`
+ version_token (bytes): The current version token of the client for the requested list (the
+ client version that was received from the last successful diff).
+ If the client does not have a version token (this is the first time calling
+ ComputeThreatListDiff), this may be left empty and a full database
+ snapshot will be returned.
+ retry (Optional[google.api_core.retry.Retry]): A retry object used
+ to retry requests. If ``None`` is specified, requests will
+ be retried using a default configuration.
+ timeout (Optional[float]): The amount of time, in seconds, to wait
+ for the request to complete. Note that if ``retry`` is
+ specified, the timeout applies to each individual attempt.
+ metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
+ that is provided to the method.
+
+ Returns:
+ A :class:`~google.cloud.webrisk_v1.types.ComputeThreatListDiffResponse` instance.
+
+ Raises:
+ google.api_core.exceptions.GoogleAPICallError: If the request
+ failed for any reason.
+ google.api_core.exceptions.RetryError: If the request failed due
+ to a retryable error and retry attempts failed.
+ ValueError: If the parameters are invalid.
+ """
+ # Wrap the transport method to add retry and timeout logic.
+ if "compute_threat_list_diff" not in self._inner_api_calls:
+ self._inner_api_calls[
+ "compute_threat_list_diff"
+ ] = google.api_core.gapic_v1.method.wrap_method(
+ self.transport.compute_threat_list_diff,
+ default_retry=self._method_configs["ComputeThreatListDiff"].retry,
+ default_timeout=self._method_configs["ComputeThreatListDiff"].timeout,
+ client_info=self._client_info,
+ )
+
+ request = webrisk_pb2.ComputeThreatListDiffRequest(
+ threat_type=threat_type,
+ constraints=constraints,
+ version_token=version_token,
+ )
+ return self._inner_api_calls["compute_threat_list_diff"](
+ request, retry=retry, timeout=timeout, metadata=metadata
+ )
+
+ def search_uris(
+ self,
+ uri,
+ threat_types,
+ retry=google.api_core.gapic_v1.method.DEFAULT,
+ timeout=google.api_core.gapic_v1.method.DEFAULT,
+ metadata=None,
+ ):
+ """
+ This method is used to check whether a URI is on a given threatList.
+ Multiple threatLists may be searched in a single query.
+ The response will list all requested threatLists the URI was found to
+ match. If the URI is not found on any of the requested ThreatList an
+ empty response will be returned.
+
+ Example:
+ >>> from google.cloud import webrisk_v1
+ >>> from google.cloud.webrisk_v1 import enums
+ >>>
+ >>> client = webrisk_v1.WebRiskServiceClient()
+ >>>
+ >>> # TODO: Initialize `uri`:
+ >>> uri = ''
+ >>>
+ >>> # TODO: Initialize `threat_types`:
+ >>> threat_types = []
+ >>>
+ >>> response = client.search_uris(uri, threat_types)
+
+ Args:
+ uri (str): Required. The URI to be checked for matches.
+ threat_types (list[~google.cloud.webrisk_v1.types.ThreatType]): Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+ retry (Optional[google.api_core.retry.Retry]): A retry object used
+ to retry requests. If ``None`` is specified, requests will
+ be retried using a default configuration.
+ timeout (Optional[float]): The amount of time, in seconds, to wait
+ for the request to complete. Note that if ``retry`` is
+ specified, the timeout applies to each individual attempt.
+ metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
+ that is provided to the method.
+
+ Returns:
+ A :class:`~google.cloud.webrisk_v1.types.SearchUrisResponse` instance.
+
+ Raises:
+ google.api_core.exceptions.GoogleAPICallError: If the request
+ failed for any reason.
+ google.api_core.exceptions.RetryError: If the request failed due
+ to a retryable error and retry attempts failed.
+ ValueError: If the parameters are invalid.
+ """
+ # Wrap the transport method to add retry and timeout logic.
+ if "search_uris" not in self._inner_api_calls:
+ self._inner_api_calls[
+ "search_uris"
+ ] = google.api_core.gapic_v1.method.wrap_method(
+ self.transport.search_uris,
+ default_retry=self._method_configs["SearchUris"].retry,
+ default_timeout=self._method_configs["SearchUris"].timeout,
+ client_info=self._client_info,
+ )
+
+ request = webrisk_pb2.SearchUrisRequest(uri=uri, threat_types=threat_types)
+ return self._inner_api_calls["search_uris"](
+ request, retry=retry, timeout=timeout, metadata=metadata
+ )
+
+ def search_hashes(
+ self,
+ threat_types,
+ hash_prefix=None,
+ retry=google.api_core.gapic_v1.method.DEFAULT,
+ timeout=google.api_core.gapic_v1.method.DEFAULT,
+ metadata=None,
+ ):
+ """
+ Gets the full hashes that match the requested hash prefix.
+ This is used after a hash prefix is looked up in a threatList
+ and there is a match. The client side threatList only holds partial hashes
+ so the client must query this method to determine if there is a full
+ hash match of a threat.
+
+ Example:
+ >>> from google.cloud import webrisk_v1
+ >>> from google.cloud.webrisk_v1 import enums
+ >>>
+ >>> client = webrisk_v1.WebRiskServiceClient()
+ >>>
+ >>> # TODO: Initialize `threat_types`:
+ >>> threat_types = []
+ >>>
+ >>> response = client.search_hashes(threat_types)
+
+ Args:
+ threat_types (list[~google.cloud.webrisk_v1.types.ThreatType]): Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
+ hash_prefix (bytes): A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
+ hash. For JSON requests, this field is base64-encoded.
+ retry (Optional[google.api_core.retry.Retry]): A retry object used
+ to retry requests. If ``None`` is specified, requests will
+ be retried using a default configuration.
+ timeout (Optional[float]): The amount of time, in seconds, to wait
+ for the request to complete. Note that if ``retry`` is
+ specified, the timeout applies to each individual attempt.
+ metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
+ that is provided to the method.
+
+ Returns:
+ A :class:`~google.cloud.webrisk_v1.types.SearchHashesResponse` instance.
+
+ Raises:
+ google.api_core.exceptions.GoogleAPICallError: If the request
+ failed for any reason.
+ google.api_core.exceptions.RetryError: If the request failed due
+ to a retryable error and retry attempts failed.
+ ValueError: If the parameters are invalid.
+ """
+ # Wrap the transport method to add retry and timeout logic.
+ if "search_hashes" not in self._inner_api_calls:
+ self._inner_api_calls[
+ "search_hashes"
+ ] = google.api_core.gapic_v1.method.wrap_method(
+ self.transport.search_hashes,
+ default_retry=self._method_configs["SearchHashes"].retry,
+ default_timeout=self._method_configs["SearchHashes"].timeout,
+ client_info=self._client_info,
+ )
+
+ request = webrisk_pb2.SearchHashesRequest(
+ threat_types=threat_types, hash_prefix=hash_prefix
+ )
+ return self._inner_api_calls["search_hashes"](
+ request, retry=retry, timeout=timeout, metadata=metadata
+ )
+
+ def create_submission(
+ self,
+ parent,
+ submission,
+ retry=google.api_core.gapic_v1.method.DEFAULT,
+ timeout=google.api_core.gapic_v1.method.DEFAULT,
+ metadata=None,
+ ):
+ """
+ Creates a Submission of a URI suspected of containing phishing
+ content to be reviewed. If the result verifies the existence of
+ malicious phishing content, the site will be added to the `Google's
+ Social Engineering
+ lists `__ in
+ order to protect users that could get exposed to this threat in the
+ future. Only projects with CREATE_SUBMISSION_USERS visibility can use
+ this method.
+
+ Example:
+ >>> from google.cloud import webrisk_v1
+ >>>
+ >>> client = webrisk_v1.WebRiskServiceClient()
+ >>>
+ >>> parent = client.project_path('[PROJECT]')
+ >>>
+ >>> # TODO: Initialize `submission`:
+ >>> submission = {}
+ >>>
+ >>> response = client.create_submission(parent, submission)
+
+ Args:
+ parent (str): Required. The name of the project that is making the submission.
+ This string is in the format "projects/{project_number}".
+ submission (Union[dict, ~google.cloud.webrisk_v1.types.Submission]): Required. The submission that contains the content of the phishing report.
+
+ If a dict is provided, it must be of the same form as the protobuf
+ message :class:`~google.cloud.webrisk_v1.types.Submission`
+ retry (Optional[google.api_core.retry.Retry]): A retry object used
+ to retry requests. If ``None`` is specified, requests will
+ be retried using a default configuration.
+ timeout (Optional[float]): The amount of time, in seconds, to wait
+ for the request to complete. Note that if ``retry`` is
+ specified, the timeout applies to each individual attempt.
+ metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
+ that is provided to the method.
+
+ Returns:
+ A :class:`~google.cloud.webrisk_v1.types.Submission` instance.
+
+ Raises:
+ google.api_core.exceptions.GoogleAPICallError: If the request
+ failed for any reason.
+ google.api_core.exceptions.RetryError: If the request failed due
+ to a retryable error and retry attempts failed.
+ ValueError: If the parameters are invalid.
+ """
+ # Wrap the transport method to add retry and timeout logic.
+ if "create_submission" not in self._inner_api_calls:
+ self._inner_api_calls[
+ "create_submission"
+ ] = google.api_core.gapic_v1.method.wrap_method(
+ self.transport.create_submission,
+ default_retry=self._method_configs["CreateSubmission"].retry,
+ default_timeout=self._method_configs["CreateSubmission"].timeout,
+ client_info=self._client_info,
+ )
+
+ request = webrisk_pb2.CreateSubmissionRequest(
+ parent=parent, submission=submission
+ )
+ if metadata is None:
+ metadata = []
+ metadata = list(metadata)
+ try:
+ routing_header = [("parent", parent)]
+ except AttributeError:
+ pass
+ else:
+ routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
+ routing_header
+ )
+ metadata.append(routing_metadata)
+
+ return self._inner_api_calls["create_submission"](
+ request, retry=retry, timeout=timeout, metadata=metadata
+ )
diff --git a/google/cloud/webrisk_v1/gapic/web_risk_service_client_config.py b/google/cloud/webrisk_v1/gapic/web_risk_service_client_config.py
new file mode 100644
index 0000000..a476101
--- /dev/null
+++ b/google/cloud/webrisk_v1/gapic/web_risk_service_client_config.py
@@ -0,0 +1,43 @@
+config = {
+ "interfaces": {
+ "google.cloud.webrisk.v1.WebRiskService": {
+ "retry_codes": {
+ "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
+ "non_idempotent": [],
+ },
+ "retry_params": {
+ "default": {
+ "initial_retry_delay_millis": 100,
+ "retry_delay_multiplier": 1.3,
+ "max_retry_delay_millis": 60000,
+ "initial_rpc_timeout_millis": 20000,
+ "rpc_timeout_multiplier": 1.0,
+ "max_rpc_timeout_millis": 20000,
+ "total_timeout_millis": 600000,
+ }
+ },
+ "methods": {
+ "ComputeThreatListDiff": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default",
+ },
+ "SearchUris": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default",
+ },
+ "SearchHashes": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default",
+ },
+ "CreateSubmission": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "non_idempotent",
+ "retry_params_name": "default",
+ },
+ },
+ }
+ }
+}
diff --git a/google/cloud/webrisk_v1/proto/__init__.py b/google/cloud/webrisk_v1/proto/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/google/cloud/webrisk_v1/proto/webrisk_pb2.py b/google/cloud/webrisk_v1/proto/webrisk_pb2.py
new file mode 100644
index 0000000..70fc37e
--- /dev/null
+++ b/google/cloud/webrisk_v1/proto/webrisk_pb2.py
@@ -0,0 +1,1749 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/cloud/webrisk_v1/proto/webrisk.proto
+
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
+from google.api import client_pb2 as google_dot_api_dot_client__pb2
+from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
+from google.api import resource_pb2 as google_dot_api_dot_resource__pb2
+from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+ name="google/cloud/webrisk_v1/proto/webrisk.proto",
+ package="google.cloud.webrisk.v1",
+ syntax="proto3",
+ serialized_options=b"\n\025com.google.webrisk.v1B\014WebRiskProtoP\001Z>google.golang.org/genproto/googleapis/cloud/webrisk/v1;webrisk\242\002\004GCWR\252\002\027Google.Cloud.WebRisk.V1\312\002\027Google\\Cloud\\WebRisk\\V1",
+ serialized_pb=b'\n+google/cloud/webrisk_v1/proto/webrisk.proto\x12\x17google.cloud.webrisk.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xe3\x02\n\x1c\x43omputeThreatListDiffRequest\x12=\n\x0bthreat_type\x18\x01 \x01(\x0e\x32#.google.cloud.webrisk.v1.ThreatTypeB\x03\xe0\x41\x02\x12\x15\n\rversion_token\x18\x02 \x01(\x0c\x12[\n\x0b\x63onstraints\x18\x03 \x01(\x0b\x32\x41.google.cloud.webrisk.v1.ComputeThreatListDiffRequest.ConstraintsB\x03\xe0\x41\x02\x1a\x8f\x01\n\x0b\x43onstraints\x12\x18\n\x10max_diff_entries\x18\x01 \x01(\x05\x12\x1c\n\x14max_database_entries\x18\x02 \x01(\x05\x12H\n\x16supported_compressions\x18\x03 \x03(\x0e\x32(.google.cloud.webrisk.v1.CompressionType"\x86\x04\n\x1d\x43omputeThreatListDiffResponse\x12Z\n\rresponse_type\x18\x04 \x01(\x0e\x32\x43.google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType\x12@\n\tadditions\x18\x05 \x01(\x0b\x32-.google.cloud.webrisk.v1.ThreatEntryAdditions\x12>\n\x08removals\x18\x06 \x01(\x0b\x32,.google.cloud.webrisk.v1.ThreatEntryRemovals\x12\x19\n\x11new_version_token\x18\x07 \x01(\x0c\x12Q\n\x08\x63hecksum\x18\x08 \x01(\x0b\x32?.google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum\x12\x39\n\x15recommended_next_diff\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x1a\n\x08\x43hecksum\x12\x0e\n\x06sha256\x18\x01 \x01(\x0c"B\n\x0cResponseType\x12\x1d\n\x19RESPONSE_TYPE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x44IFF\x10\x01\x12\t\n\x05RESET\x10\x02"e\n\x11SearchUrisRequest\x12\x10\n\x03uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12>\n\x0cthreat_types\x18\x02 \x03(\x0e\x32#.google.cloud.webrisk.v1.ThreatTypeB\x03\xe0\x41\x02"\xd4\x01\n\x12SearchUrisResponse\x12\x45\n\x06threat\x18\x01 \x01(\x0b\x32\x35.google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri\x1aw\n\tThreatUri\x12\x39\n\x0cthreat_types\x18\x01 \x03(\x0e\x32#.google.cloud.webrisk.v1.ThreatType\x12/\n\x0b\x65xpire_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"j\n\x13SearchHashesRequest\x12\x13\n\x0bhash_prefix\x18\x01 \x01(\x0c\x12>\n\x0cthreat_types\x18\x02 \x03(\x0e\x32#.google.cloud.webrisk.v1.ThreatTypeB\x03\xe0\x41\x02"\xa4\x02\n\x14SearchHashesResponse\x12I\n\x07threats\x18\x01 \x03(\x0b\x32\x38.google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash\x12\x38\n\x14negative_expire_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x86\x01\n\nThreatHash\x12\x39\n\x0cthreat_types\x18\x01 \x03(\x0e\x32#.google.cloud.webrisk.v1.ThreatType\x12\x0c\n\x04hash\x18\x02 \x01(\x0c\x12/\n\x0b\x65xpire_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\x8f\x01\n\x14ThreatEntryAdditions\x12\x36\n\nraw_hashes\x18\x01 \x03(\x0b\x32".google.cloud.webrisk.v1.RawHashes\x12?\n\x0brice_hashes\x18\x02 \x01(\x0b\x32*.google.cloud.webrisk.v1.RiceDeltaEncoding"\x91\x01\n\x13ThreatEntryRemovals\x12\x38\n\x0braw_indices\x18\x01 \x01(\x0b\x32#.google.cloud.webrisk.v1.RawIndices\x12@\n\x0crice_indices\x18\x02 \x01(\x0b\x32*.google.cloud.webrisk.v1.RiceDeltaEncoding"\x1d\n\nRawIndices\x12\x0f\n\x07indices\x18\x01 \x03(\x05"4\n\tRawHashes\x12\x13\n\x0bprefix_size\x18\x01 \x01(\x05\x12\x12\n\nraw_hashes\x18\x02 \x01(\x0c"k\n\x11RiceDeltaEncoding\x12\x13\n\x0b\x66irst_value\x18\x01 \x01(\x03\x12\x16\n\x0erice_parameter\x18\x02 \x01(\x05\x12\x13\n\x0b\x65ntry_count\x18\x03 \x01(\x05\x12\x14\n\x0c\x65ncoded_data\x18\x04 \x01(\x0c"\x1e\n\nSubmission\x12\x10\n\x03uri\x18\x01 \x01(\tB\x03\xe0\x41\x02"\x9c\x01\n\x17\x43reateSubmissionRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12<\n\nsubmission\x18\x02 \x01(\x0b\x32#.google.cloud.webrisk.v1.SubmissionB\x03\xe0\x41\x02*e\n\nThreatType\x12\x1b\n\x17THREAT_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07MALWARE\x10\x01\x12\x16\n\x12SOCIAL_ENGINEERING\x10\x02\x12\x15\n\x11UNWANTED_SOFTWARE\x10\x03*F\n\x0f\x43ompressionType\x12 \n\x1c\x43OMPRESSION_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03RAW\x10\x01\x12\x08\n\x04RICE\x10\x02\x32\xa3\x06\n\x0eWebRiskService\x12\xd3\x01\n\x15\x43omputeThreatListDiff\x12\x35.google.cloud.webrisk.v1.ComputeThreatListDiffRequest\x1a\x36.google.cloud.webrisk.v1.ComputeThreatListDiffResponse"K\x82\xd3\xe4\x93\x02\x1d\x12\x1b/v1/threatLists:computeDiff\xda\x41%threat_type,version_token,constraints\x12\x91\x01\n\nSearchUris\x12*.google.cloud.webrisk.v1.SearchUrisRequest\x1a+.google.cloud.webrisk.v1.SearchUrisResponse"*\x82\xd3\xe4\x93\x02\x11\x12\x0f/v1/uris:search\xda\x41\x10uri,threat_types\x12\xa1\x01\n\x0cSearchHashes\x12,.google.cloud.webrisk.v1.SearchHashesRequest\x1a-.google.cloud.webrisk.v1.SearchHashesResponse"4\x82\xd3\xe4\x93\x02\x13\x12\x11/v1/hashes:search\xda\x41\x18hash_prefix,threat_types\x12\xb6\x01\n\x10\x43reateSubmission\x12\x30.google.cloud.webrisk.v1.CreateSubmissionRequest\x1a#.google.cloud.webrisk.v1.Submission"K\x82\xd3\xe4\x93\x02\x31"#/v1/{parent=projects/*}/submissions:\nsubmission\xda\x41\x11parent,submission\x1aJ\xca\x41\x16webrisk.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xa2\x01\n\x15\x63om.google.webrisk.v1B\x0cWebRiskProtoP\x01Z>google.golang.org/genproto/googleapis/cloud/webrisk/v1;webrisk\xa2\x02\x04GCWR\xaa\x02\x17Google.Cloud.WebRisk.V1\xca\x02\x17Google\\Cloud\\WebRisk\\V1b\x06proto3',
+ dependencies=[
+ google_dot_api_dot_annotations__pb2.DESCRIPTOR,
+ google_dot_api_dot_client__pb2.DESCRIPTOR,
+ google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,
+ google_dot_api_dot_resource__pb2.DESCRIPTOR,
+ google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,
+ ],
+)
+
+_THREATTYPE = _descriptor.EnumDescriptor(
+ name="ThreatType",
+ full_name="google.cloud.webrisk.v1.ThreatType",
+ filename=None,
+ file=DESCRIPTOR,
+ values=[
+ _descriptor.EnumValueDescriptor(
+ name="THREAT_TYPE_UNSPECIFIED",
+ index=0,
+ number=0,
+ serialized_options=None,
+ type=None,
+ ),
+ _descriptor.EnumValueDescriptor(
+ name="MALWARE", index=1, number=1, serialized_options=None, type=None
+ ),
+ _descriptor.EnumValueDescriptor(
+ name="SOCIAL_ENGINEERING",
+ index=2,
+ number=2,
+ serialized_options=None,
+ type=None,
+ ),
+ _descriptor.EnumValueDescriptor(
+ name="UNWANTED_SOFTWARE",
+ index=3,
+ number=3,
+ serialized_options=None,
+ type=None,
+ ),
+ ],
+ containing_type=None,
+ serialized_options=None,
+ serialized_start=2499,
+ serialized_end=2600,
+)
+_sym_db.RegisterEnumDescriptor(_THREATTYPE)
+
+ThreatType = enum_type_wrapper.EnumTypeWrapper(_THREATTYPE)
+_COMPRESSIONTYPE = _descriptor.EnumDescriptor(
+ name="CompressionType",
+ full_name="google.cloud.webrisk.v1.CompressionType",
+ filename=None,
+ file=DESCRIPTOR,
+ values=[
+ _descriptor.EnumValueDescriptor(
+ name="COMPRESSION_TYPE_UNSPECIFIED",
+ index=0,
+ number=0,
+ serialized_options=None,
+ type=None,
+ ),
+ _descriptor.EnumValueDescriptor(
+ name="RAW", index=1, number=1, serialized_options=None, type=None
+ ),
+ _descriptor.EnumValueDescriptor(
+ name="RICE", index=2, number=2, serialized_options=None, type=None
+ ),
+ ],
+ containing_type=None,
+ serialized_options=None,
+ serialized_start=2602,
+ serialized_end=2672,
+)
+_sym_db.RegisterEnumDescriptor(_COMPRESSIONTYPE)
+
+CompressionType = enum_type_wrapper.EnumTypeWrapper(_COMPRESSIONTYPE)
+THREAT_TYPE_UNSPECIFIED = 0
+MALWARE = 1
+SOCIAL_ENGINEERING = 2
+UNWANTED_SOFTWARE = 3
+COMPRESSION_TYPE_UNSPECIFIED = 0
+RAW = 1
+RICE = 2
+
+
+_COMPUTETHREATLISTDIFFRESPONSE_RESPONSETYPE = _descriptor.EnumDescriptor(
+ name="ResponseType",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType",
+ filename=None,
+ file=DESCRIPTOR,
+ values=[
+ _descriptor.EnumValueDescriptor(
+ name="RESPONSE_TYPE_UNSPECIFIED",
+ index=0,
+ number=0,
+ serialized_options=None,
+ type=None,
+ ),
+ _descriptor.EnumValueDescriptor(
+ name="DIFF", index=1, number=1, serialized_options=None, type=None
+ ),
+ _descriptor.EnumValueDescriptor(
+ name="RESET", index=2, number=2, serialized_options=None, type=None
+ ),
+ ],
+ containing_type=None,
+ serialized_options=None,
+ serialized_start=1031,
+ serialized_end=1097,
+)
+_sym_db.RegisterEnumDescriptor(_COMPUTETHREATLISTDIFFRESPONSE_RESPONSETYPE)
+
+
+_COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS = _descriptor.Descriptor(
+ name="Constraints",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="max_diff_entries",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints.max_diff_entries",
+ index=0,
+ number=1,
+ type=5,
+ cpp_type=1,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="max_database_entries",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints.max_database_entries",
+ index=1,
+ number=2,
+ type=5,
+ cpp_type=1,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="supported_compressions",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints.supported_compressions",
+ index=2,
+ number=3,
+ type=14,
+ cpp_type=8,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=433,
+ serialized_end=576,
+)
+
+_COMPUTETHREATLISTDIFFREQUEST = _descriptor.Descriptor(
+ name="ComputeThreatListDiffRequest",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="threat_type",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest.threat_type",
+ index=0,
+ number=1,
+ type=14,
+ cpp_type=8,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002",
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="version_token",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest.version_token",
+ index=1,
+ number=2,
+ type=12,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"",
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="constraints",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffRequest.constraints",
+ index=2,
+ number=3,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002",
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[_COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=221,
+ serialized_end=576,
+)
+
+
+_COMPUTETHREATLISTDIFFRESPONSE_CHECKSUM = _descriptor.Descriptor(
+ name="Checksum",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="sha256",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum.sha256",
+ index=0,
+ number=1,
+ type=12,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"",
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ )
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1003,
+ serialized_end=1029,
+)
+
+_COMPUTETHREATLISTDIFFRESPONSE = _descriptor.Descriptor(
+ name="ComputeThreatListDiffResponse",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="response_type",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.response_type",
+ index=0,
+ number=4,
+ type=14,
+ cpp_type=8,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="additions",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.additions",
+ index=1,
+ number=5,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="removals",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.removals",
+ index=2,
+ number=6,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="new_version_token",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.new_version_token",
+ index=3,
+ number=7,
+ type=12,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"",
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="checksum",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.checksum",
+ index=4,
+ number=8,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="recommended_next_diff",
+ full_name="google.cloud.webrisk.v1.ComputeThreatListDiffResponse.recommended_next_diff",
+ index=5,
+ number=2,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[_COMPUTETHREATLISTDIFFRESPONSE_CHECKSUM],
+ enum_types=[_COMPUTETHREATLISTDIFFRESPONSE_RESPONSETYPE],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=579,
+ serialized_end=1097,
+)
+
+
+_SEARCHURISREQUEST = _descriptor.Descriptor(
+ name="SearchUrisRequest",
+ full_name="google.cloud.webrisk.v1.SearchUrisRequest",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="uri",
+ full_name="google.cloud.webrisk.v1.SearchUrisRequest.uri",
+ index=0,
+ number=1,
+ type=9,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"".decode("utf-8"),
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002",
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="threat_types",
+ full_name="google.cloud.webrisk.v1.SearchUrisRequest.threat_types",
+ index=1,
+ number=2,
+ type=14,
+ cpp_type=8,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002",
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1099,
+ serialized_end=1200,
+)
+
+
+_SEARCHURISRESPONSE_THREATURI = _descriptor.Descriptor(
+ name="ThreatUri",
+ full_name="google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="threat_types",
+ full_name="google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri.threat_types",
+ index=0,
+ number=1,
+ type=14,
+ cpp_type=8,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="expire_time",
+ full_name="google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri.expire_time",
+ index=1,
+ number=2,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1296,
+ serialized_end=1415,
+)
+
+_SEARCHURISRESPONSE = _descriptor.Descriptor(
+ name="SearchUrisResponse",
+ full_name="google.cloud.webrisk.v1.SearchUrisResponse",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="threat",
+ full_name="google.cloud.webrisk.v1.SearchUrisResponse.threat",
+ index=0,
+ number=1,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ )
+ ],
+ extensions=[],
+ nested_types=[_SEARCHURISRESPONSE_THREATURI],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1203,
+ serialized_end=1415,
+)
+
+
+_SEARCHHASHESREQUEST = _descriptor.Descriptor(
+ name="SearchHashesRequest",
+ full_name="google.cloud.webrisk.v1.SearchHashesRequest",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="hash_prefix",
+ full_name="google.cloud.webrisk.v1.SearchHashesRequest.hash_prefix",
+ index=0,
+ number=1,
+ type=12,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"",
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="threat_types",
+ full_name="google.cloud.webrisk.v1.SearchHashesRequest.threat_types",
+ index=1,
+ number=2,
+ type=14,
+ cpp_type=8,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002",
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1417,
+ serialized_end=1523,
+)
+
+
+_SEARCHHASHESRESPONSE_THREATHASH = _descriptor.Descriptor(
+ name="ThreatHash",
+ full_name="google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="threat_types",
+ full_name="google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash.threat_types",
+ index=0,
+ number=1,
+ type=14,
+ cpp_type=8,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="hash",
+ full_name="google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash.hash",
+ index=1,
+ number=2,
+ type=12,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"",
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="expire_time",
+ full_name="google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash.expire_time",
+ index=2,
+ number=3,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1684,
+ serialized_end=1818,
+)
+
+_SEARCHHASHESRESPONSE = _descriptor.Descriptor(
+ name="SearchHashesResponse",
+ full_name="google.cloud.webrisk.v1.SearchHashesResponse",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="threats",
+ full_name="google.cloud.webrisk.v1.SearchHashesResponse.threats",
+ index=0,
+ number=1,
+ type=11,
+ cpp_type=10,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="negative_expire_time",
+ full_name="google.cloud.webrisk.v1.SearchHashesResponse.negative_expire_time",
+ index=1,
+ number=2,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[_SEARCHHASHESRESPONSE_THREATHASH],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1526,
+ serialized_end=1818,
+)
+
+
+_THREATENTRYADDITIONS = _descriptor.Descriptor(
+ name="ThreatEntryAdditions",
+ full_name="google.cloud.webrisk.v1.ThreatEntryAdditions",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="raw_hashes",
+ full_name="google.cloud.webrisk.v1.ThreatEntryAdditions.raw_hashes",
+ index=0,
+ number=1,
+ type=11,
+ cpp_type=10,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="rice_hashes",
+ full_name="google.cloud.webrisk.v1.ThreatEntryAdditions.rice_hashes",
+ index=1,
+ number=2,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1821,
+ serialized_end=1964,
+)
+
+
+_THREATENTRYREMOVALS = _descriptor.Descriptor(
+ name="ThreatEntryRemovals",
+ full_name="google.cloud.webrisk.v1.ThreatEntryRemovals",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="raw_indices",
+ full_name="google.cloud.webrisk.v1.ThreatEntryRemovals.raw_indices",
+ index=0,
+ number=1,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="rice_indices",
+ full_name="google.cloud.webrisk.v1.ThreatEntryRemovals.rice_indices",
+ index=1,
+ number=2,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=1967,
+ serialized_end=2112,
+)
+
+
+_RAWINDICES = _descriptor.Descriptor(
+ name="RawIndices",
+ full_name="google.cloud.webrisk.v1.RawIndices",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="indices",
+ full_name="google.cloud.webrisk.v1.RawIndices.indices",
+ index=0,
+ number=1,
+ type=5,
+ cpp_type=1,
+ label=3,
+ has_default_value=False,
+ default_value=[],
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ )
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=2114,
+ serialized_end=2143,
+)
+
+
+_RAWHASHES = _descriptor.Descriptor(
+ name="RawHashes",
+ full_name="google.cloud.webrisk.v1.RawHashes",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="prefix_size",
+ full_name="google.cloud.webrisk.v1.RawHashes.prefix_size",
+ index=0,
+ number=1,
+ type=5,
+ cpp_type=1,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="raw_hashes",
+ full_name="google.cloud.webrisk.v1.RawHashes.raw_hashes",
+ index=1,
+ number=2,
+ type=12,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"",
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=2145,
+ serialized_end=2197,
+)
+
+
+_RICEDELTAENCODING = _descriptor.Descriptor(
+ name="RiceDeltaEncoding",
+ full_name="google.cloud.webrisk.v1.RiceDeltaEncoding",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="first_value",
+ full_name="google.cloud.webrisk.v1.RiceDeltaEncoding.first_value",
+ index=0,
+ number=1,
+ type=3,
+ cpp_type=2,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="rice_parameter",
+ full_name="google.cloud.webrisk.v1.RiceDeltaEncoding.rice_parameter",
+ index=1,
+ number=2,
+ type=5,
+ cpp_type=1,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="entry_count",
+ full_name="google.cloud.webrisk.v1.RiceDeltaEncoding.entry_count",
+ index=2,
+ number=3,
+ type=5,
+ cpp_type=1,
+ label=1,
+ has_default_value=False,
+ default_value=0,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="encoded_data",
+ full_name="google.cloud.webrisk.v1.RiceDeltaEncoding.encoded_data",
+ index=3,
+ number=4,
+ type=12,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"",
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=None,
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=2199,
+ serialized_end=2306,
+)
+
+
+_SUBMISSION = _descriptor.Descriptor(
+ name="Submission",
+ full_name="google.cloud.webrisk.v1.Submission",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="uri",
+ full_name="google.cloud.webrisk.v1.Submission.uri",
+ index=0,
+ number=1,
+ type=9,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"".decode("utf-8"),
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002",
+ file=DESCRIPTOR,
+ )
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=2308,
+ serialized_end=2338,
+)
+
+
+_CREATESUBMISSIONREQUEST = _descriptor.Descriptor(
+ name="CreateSubmissionRequest",
+ full_name="google.cloud.webrisk.v1.CreateSubmissionRequest",
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name="parent",
+ full_name="google.cloud.webrisk.v1.CreateSubmissionRequest.parent",
+ index=0,
+ number=1,
+ type=9,
+ cpp_type=9,
+ label=1,
+ has_default_value=False,
+ default_value=b"".decode("utf-8"),
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project",
+ file=DESCRIPTOR,
+ ),
+ _descriptor.FieldDescriptor(
+ name="submission",
+ full_name="google.cloud.webrisk.v1.CreateSubmissionRequest.submission",
+ index=1,
+ number=2,
+ type=11,
+ cpp_type=10,
+ label=1,
+ has_default_value=False,
+ default_value=None,
+ message_type=None,
+ enum_type=None,
+ containing_type=None,
+ is_extension=False,
+ extension_scope=None,
+ serialized_options=b"\340A\002",
+ file=DESCRIPTOR,
+ ),
+ ],
+ extensions=[],
+ nested_types=[],
+ enum_types=[],
+ serialized_options=None,
+ is_extendable=False,
+ syntax="proto3",
+ extension_ranges=[],
+ oneofs=[],
+ serialized_start=2341,
+ serialized_end=2497,
+)
+
+_COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS.fields_by_name[
+ "supported_compressions"
+].enum_type = _COMPRESSIONTYPE
+_COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS.containing_type = (
+ _COMPUTETHREATLISTDIFFREQUEST
+)
+_COMPUTETHREATLISTDIFFREQUEST.fields_by_name["threat_type"].enum_type = _THREATTYPE
+_COMPUTETHREATLISTDIFFREQUEST.fields_by_name[
+ "constraints"
+].message_type = _COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS
+_COMPUTETHREATLISTDIFFRESPONSE_CHECKSUM.containing_type = _COMPUTETHREATLISTDIFFRESPONSE
+_COMPUTETHREATLISTDIFFRESPONSE.fields_by_name[
+ "response_type"
+].enum_type = _COMPUTETHREATLISTDIFFRESPONSE_RESPONSETYPE
+_COMPUTETHREATLISTDIFFRESPONSE.fields_by_name[
+ "additions"
+].message_type = _THREATENTRYADDITIONS
+_COMPUTETHREATLISTDIFFRESPONSE.fields_by_name[
+ "removals"
+].message_type = _THREATENTRYREMOVALS
+_COMPUTETHREATLISTDIFFRESPONSE.fields_by_name[
+ "checksum"
+].message_type = _COMPUTETHREATLISTDIFFRESPONSE_CHECKSUM
+_COMPUTETHREATLISTDIFFRESPONSE.fields_by_name[
+ "recommended_next_diff"
+].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
+_COMPUTETHREATLISTDIFFRESPONSE_RESPONSETYPE.containing_type = (
+ _COMPUTETHREATLISTDIFFRESPONSE
+)
+_SEARCHURISREQUEST.fields_by_name["threat_types"].enum_type = _THREATTYPE
+_SEARCHURISRESPONSE_THREATURI.fields_by_name["threat_types"].enum_type = _THREATTYPE
+_SEARCHURISRESPONSE_THREATURI.fields_by_name[
+ "expire_time"
+].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
+_SEARCHURISRESPONSE_THREATURI.containing_type = _SEARCHURISRESPONSE
+_SEARCHURISRESPONSE.fields_by_name[
+ "threat"
+].message_type = _SEARCHURISRESPONSE_THREATURI
+_SEARCHHASHESREQUEST.fields_by_name["threat_types"].enum_type = _THREATTYPE
+_SEARCHHASHESRESPONSE_THREATHASH.fields_by_name["threat_types"].enum_type = _THREATTYPE
+_SEARCHHASHESRESPONSE_THREATHASH.fields_by_name[
+ "expire_time"
+].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
+_SEARCHHASHESRESPONSE_THREATHASH.containing_type = _SEARCHHASHESRESPONSE
+_SEARCHHASHESRESPONSE.fields_by_name[
+ "threats"
+].message_type = _SEARCHHASHESRESPONSE_THREATHASH
+_SEARCHHASHESRESPONSE.fields_by_name[
+ "negative_expire_time"
+].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
+_THREATENTRYADDITIONS.fields_by_name["raw_hashes"].message_type = _RAWHASHES
+_THREATENTRYADDITIONS.fields_by_name["rice_hashes"].message_type = _RICEDELTAENCODING
+_THREATENTRYREMOVALS.fields_by_name["raw_indices"].message_type = _RAWINDICES
+_THREATENTRYREMOVALS.fields_by_name["rice_indices"].message_type = _RICEDELTAENCODING
+_CREATESUBMISSIONREQUEST.fields_by_name["submission"].message_type = _SUBMISSION
+DESCRIPTOR.message_types_by_name[
+ "ComputeThreatListDiffRequest"
+] = _COMPUTETHREATLISTDIFFREQUEST
+DESCRIPTOR.message_types_by_name[
+ "ComputeThreatListDiffResponse"
+] = _COMPUTETHREATLISTDIFFRESPONSE
+DESCRIPTOR.message_types_by_name["SearchUrisRequest"] = _SEARCHURISREQUEST
+DESCRIPTOR.message_types_by_name["SearchUrisResponse"] = _SEARCHURISRESPONSE
+DESCRIPTOR.message_types_by_name["SearchHashesRequest"] = _SEARCHHASHESREQUEST
+DESCRIPTOR.message_types_by_name["SearchHashesResponse"] = _SEARCHHASHESRESPONSE
+DESCRIPTOR.message_types_by_name["ThreatEntryAdditions"] = _THREATENTRYADDITIONS
+DESCRIPTOR.message_types_by_name["ThreatEntryRemovals"] = _THREATENTRYREMOVALS
+DESCRIPTOR.message_types_by_name["RawIndices"] = _RAWINDICES
+DESCRIPTOR.message_types_by_name["RawHashes"] = _RAWHASHES
+DESCRIPTOR.message_types_by_name["RiceDeltaEncoding"] = _RICEDELTAENCODING
+DESCRIPTOR.message_types_by_name["Submission"] = _SUBMISSION
+DESCRIPTOR.message_types_by_name["CreateSubmissionRequest"] = _CREATESUBMISSIONREQUEST
+DESCRIPTOR.enum_types_by_name["ThreatType"] = _THREATTYPE
+DESCRIPTOR.enum_types_by_name["CompressionType"] = _COMPRESSIONTYPE
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+ComputeThreatListDiffRequest = _reflection.GeneratedProtocolMessageType(
+ "ComputeThreatListDiffRequest",
+ (_message.Message,),
+ {
+ "Constraints": _reflection.GeneratedProtocolMessageType(
+ "Constraints",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """The constraints for this diff.
+
+
+ Attributes:
+ max_diff_entries:
+ The maximum size in number of entries. The diff will not
+ contain more entries than this value. This should be a power
+ of 2 between 2\ **10 and 2**\ 20. If zero, no diff size limit
+ is set.
+ max_database_entries:
+ Sets the maximum number of entries that the client is willing
+ to have in the local database. This should be a power of 2
+ between 2\ **10 and 2**\ 20. If zero, no database size limit
+ is set.
+ supported_compressions:
+ The compression types supported by the client.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints)
+ },
+ ),
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFREQUEST,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Describes an API diff request.
+
+
+ Attributes:
+ threat_type:
+ Required. The threat list to update. Only a single ThreatType
+ should be specified.
+ version_token:
+ The current version token of the client for the requested list
+ (the client version that was received from the last successful
+ diff). If the client does not have a version token (this is
+ the first time calling ComputeThreatListDiff), this may be
+ left empty and a full database snapshot will be returned.
+ constraints:
+ Required. The constraints associated with this request.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffRequest)
+ },
+)
+_sym_db.RegisterMessage(ComputeThreatListDiffRequest)
+_sym_db.RegisterMessage(ComputeThreatListDiffRequest.Constraints)
+
+ComputeThreatListDiffResponse = _reflection.GeneratedProtocolMessageType(
+ "ComputeThreatListDiffResponse",
+ (_message.Message,),
+ {
+ "Checksum": _reflection.GeneratedProtocolMessageType(
+ "Checksum",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFRESPONSE_CHECKSUM,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """The expected state of a client’s local database.
+
+
+ Attributes:
+ sha256:
+ The SHA256 hash of the client state; that is, of the sorted
+ list of all hashes present in the database.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum)
+ },
+ ),
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFRESPONSE,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """
+ Attributes:
+ response_type:
+ The type of response. This may indicate that an action must be
+ taken by the client when the response is received.
+ additions:
+ A set of entries to add to a local threat type’s list.
+ removals:
+ A set of entries to remove from a local threat type’s list.
+ This field may be empty.
+ new_version_token:
+ The new opaque client version token. This should be retained
+ by the client and passed into the next call of
+ ComputeThreatListDiff as ‘version_token’. A separate version
+ token should be stored and used for each threatList.
+ checksum:
+ The expected SHA256 hash of the client state; that is, of the
+ sorted list of all hashes present in the database after
+ applying the provided diff. If the client state doesn’t match
+ the expected state, the client must discard this diff and
+ retry later.
+ recommended_next_diff:
+ The soonest the client should wait before issuing any diff
+ request. Querying sooner is unlikely to produce a meaningful
+ diff. Waiting longer is acceptable considering the use case.
+ If this field is not set clients may update as soon as they
+ want.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ComputeThreatListDiffResponse)
+ },
+)
+_sym_db.RegisterMessage(ComputeThreatListDiffResponse)
+_sym_db.RegisterMessage(ComputeThreatListDiffResponse.Checksum)
+
+SearchUrisRequest = _reflection.GeneratedProtocolMessageType(
+ "SearchUrisRequest",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _SEARCHURISREQUEST,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Request to check URI entries against threatLists.
+
+
+ Attributes:
+ uri:
+ Required. The URI to be checked for matches.
+ threat_types:
+ Required. The ThreatLists to search in. Multiple ThreatLists
+ may be specified.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchUrisRequest)
+ },
+)
+_sym_db.RegisterMessage(SearchUrisRequest)
+
+SearchUrisResponse = _reflection.GeneratedProtocolMessageType(
+ "SearchUrisResponse",
+ (_message.Message,),
+ {
+ "ThreatUri": _reflection.GeneratedProtocolMessageType(
+ "ThreatUri",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _SEARCHURISRESPONSE_THREATURI,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Contains threat information on a matching uri.
+
+
+ Attributes:
+ threat_types:
+ The ThreatList this threat belongs to.
+ expire_time:
+ The cache lifetime for the returned match. Clients must not
+ cache this response past this timestamp to avoid false
+ positives.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri)
+ },
+ ),
+ "DESCRIPTOR": _SEARCHURISRESPONSE,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """
+ Attributes:
+ threat:
+ The threat list matches. This may be empty if the URI is on no
+ list.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchUrisResponse)
+ },
+)
+_sym_db.RegisterMessage(SearchUrisResponse)
+_sym_db.RegisterMessage(SearchUrisResponse.ThreatUri)
+
+SearchHashesRequest = _reflection.GeneratedProtocolMessageType(
+ "SearchHashesRequest",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _SEARCHHASHESREQUEST,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Request to return full hashes matched by the provided hash
+ prefixes.
+
+
+ Attributes:
+ hash_prefix:
+ A hash prefix, consisting of the most significant 4-32 bytes
+ of a SHA256 hash. For JSON requests, this field is
+ base64-encoded.
+ threat_types:
+ Required. The ThreatLists to search in. Multiple ThreatLists
+ may be specified.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchHashesRequest)
+ },
+)
+_sym_db.RegisterMessage(SearchHashesRequest)
+
+SearchHashesResponse = _reflection.GeneratedProtocolMessageType(
+ "SearchHashesResponse",
+ (_message.Message,),
+ {
+ "ThreatHash": _reflection.GeneratedProtocolMessageType(
+ "ThreatHash",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _SEARCHHASHESRESPONSE_THREATHASH,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Contains threat information on a matching hash.
+
+
+ Attributes:
+ threat_types:
+ The ThreatList this threat belongs to. This must contain at
+ least one entry.
+ hash:
+ A 32 byte SHA256 hash. This field is in binary format. For
+ JSON requests, hashes are base64-encoded.
+ expire_time:
+ The cache lifetime for the returned match. Clients must not
+ cache this response past this timestamp to avoid false
+ positives.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash)
+ },
+ ),
+ "DESCRIPTOR": _SEARCHHASHESRESPONSE,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """
+ Attributes:
+ threats:
+ The full hashes that matched the requested prefixes. The hash
+ will be populated in the key.
+ negative_expire_time:
+ For requested entities that did not match the threat list, how
+ long to cache the response until.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.SearchHashesResponse)
+ },
+)
+_sym_db.RegisterMessage(SearchHashesResponse)
+_sym_db.RegisterMessage(SearchHashesResponse.ThreatHash)
+
+ThreatEntryAdditions = _reflection.GeneratedProtocolMessageType(
+ "ThreatEntryAdditions",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _THREATENTRYADDITIONS,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Contains the set of entries to add to a local database.
+ May contain a combination of compressed and raw data in a single
+ response.
+
+
+ Attributes:
+ raw_hashes:
+ The raw SHA256-formatted entries. Repeated to allow returning
+ sets of hashes with different prefix sizes.
+ rice_hashes:
+ The encoded 4-byte prefixes of SHA256-formatted entries, using
+ a Golomb-Rice encoding. The hashes are converted to uint32,
+ sorted in ascending order, then delta encoded and stored as
+ encoded_data.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatEntryAdditions)
+ },
+)
+_sym_db.RegisterMessage(ThreatEntryAdditions)
+
+ThreatEntryRemovals = _reflection.GeneratedProtocolMessageType(
+ "ThreatEntryRemovals",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _THREATENTRYREMOVALS,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Contains the set of entries to remove from a local
+ database.
+
+
+ Attributes:
+ raw_indices:
+ The raw removal indices for a local list.
+ rice_indices:
+ The encoded local, lexicographically-sorted list indices,
+ using a Golomb-Rice encoding. Used for sending compressed
+ removal indices. The removal indices (uint32) are sorted in
+ ascending order, then delta encoded and stored as
+ encoded_data.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.ThreatEntryRemovals)
+ },
+)
+_sym_db.RegisterMessage(ThreatEntryRemovals)
+
+RawIndices = _reflection.GeneratedProtocolMessageType(
+ "RawIndices",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _RAWINDICES,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """A set of raw indices to remove from a local list.
+
+
+ Attributes:
+ indices:
+ The indices to remove from a lexicographically-sorted local
+ list.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.RawIndices)
+ },
+)
+_sym_db.RegisterMessage(RawIndices)
+
+RawHashes = _reflection.GeneratedProtocolMessageType(
+ "RawHashes",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _RAWHASHES,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """The uncompressed threat entries in hash format. Hashes can
+ be anywhere from 4 to 32 bytes in size. A large majority are 4 bytes,
+ but some hashes are lengthened if they collide with the hash of a
+ popular URI.
+
+ Used for sending ThreatEntryAdditons to clients that do not support
+ compression, or when sending non-4-byte hashes to clients that do
+ support compression.
+
+
+ Attributes:
+ prefix_size:
+ The number of bytes for each prefix encoded below. This field
+ can be anywhere from 4 (shortest prefix) to 32 (full SHA256
+ hash). In practice this is almost always 4, except in
+ exceptional circumstances.
+ raw_hashes:
+ The hashes, in binary format, concatenated into one long
+ string. Hashes are sorted in lexicographic order. For JSON API
+ users, hashes are base64-encoded.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.RawHashes)
+ },
+)
+_sym_db.RegisterMessage(RawHashes)
+
+RiceDeltaEncoding = _reflection.GeneratedProtocolMessageType(
+ "RiceDeltaEncoding",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _RICEDELTAENCODING,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """The Rice-Golomb encoded data. Used for sending compressed
+ 4-byte hashes or compressed removal indices.
+
+
+ Attributes:
+ first_value:
+ The offset of the first entry in the encoded data, or, if only
+ a single integer was encoded, that single integer’s value. If
+ the field is empty or missing, assume zero.
+ rice_parameter:
+ The Golomb-Rice parameter, which is a number between 2 and 28.
+ This field is missing (that is, zero) if ``num_entries`` is
+ zero.
+ entry_count:
+ The number of entries that are delta encoded in the encoded
+ data. If only a single integer was encoded, this will be zero
+ and the single value will be stored in ``first_value``.
+ encoded_data:
+ The encoded deltas that are encoded using the Golomb-Rice
+ coder.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.RiceDeltaEncoding)
+ },
+)
+_sym_db.RegisterMessage(RiceDeltaEncoding)
+
+Submission = _reflection.GeneratedProtocolMessageType(
+ "Submission",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _SUBMISSION,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Wraps a URI that might be displaying phishing content.
+
+
+ Attributes:
+ uri:
+ Required. The URI that is being reported for phishing content
+ to be analyzed.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.Submission)
+ },
+)
+_sym_db.RegisterMessage(Submission)
+
+CreateSubmissionRequest = _reflection.GeneratedProtocolMessageType(
+ "CreateSubmissionRequest",
+ (_message.Message,),
+ {
+ "DESCRIPTOR": _CREATESUBMISSIONREQUEST,
+ "__module__": "google.cloud.webrisk_v1.proto.webrisk_pb2",
+ "__doc__": """Request to send a potentially phishy URI to WebRisk.
+
+
+ Attributes:
+ parent:
+ Required. The name of the project that is making the
+ submission. This string is in the format
+ “projects/{project_number}”.
+ submission:
+ Required. The submission that contains the content of the
+ phishing report.
+ """,
+ # @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1.CreateSubmissionRequest)
+ },
+)
+_sym_db.RegisterMessage(CreateSubmissionRequest)
+
+
+DESCRIPTOR._options = None
+_COMPUTETHREATLISTDIFFREQUEST.fields_by_name["threat_type"]._options = None
+_COMPUTETHREATLISTDIFFREQUEST.fields_by_name["constraints"]._options = None
+_SEARCHURISREQUEST.fields_by_name["uri"]._options = None
+_SEARCHURISREQUEST.fields_by_name["threat_types"]._options = None
+_SEARCHHASHESREQUEST.fields_by_name["threat_types"]._options = None
+_SUBMISSION.fields_by_name["uri"]._options = None
+_CREATESUBMISSIONREQUEST.fields_by_name["parent"]._options = None
+_CREATESUBMISSIONREQUEST.fields_by_name["submission"]._options = None
+
+_WEBRISKSERVICE = _descriptor.ServiceDescriptor(
+ name="WebRiskService",
+ full_name="google.cloud.webrisk.v1.WebRiskService",
+ file=DESCRIPTOR,
+ index=0,
+ serialized_options=b"\312A\026webrisk.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform",
+ serialized_start=2675,
+ serialized_end=3478,
+ methods=[
+ _descriptor.MethodDescriptor(
+ name="ComputeThreatListDiff",
+ full_name="google.cloud.webrisk.v1.WebRiskService.ComputeThreatListDiff",
+ index=0,
+ containing_service=None,
+ input_type=_COMPUTETHREATLISTDIFFREQUEST,
+ output_type=_COMPUTETHREATLISTDIFFRESPONSE,
+ serialized_options=b"\202\323\344\223\002\035\022\033/v1/threatLists:computeDiff\332A%threat_type,version_token,constraints",
+ ),
+ _descriptor.MethodDescriptor(
+ name="SearchUris",
+ full_name="google.cloud.webrisk.v1.WebRiskService.SearchUris",
+ index=1,
+ containing_service=None,
+ input_type=_SEARCHURISREQUEST,
+ output_type=_SEARCHURISRESPONSE,
+ serialized_options=b"\202\323\344\223\002\021\022\017/v1/uris:search\332A\020uri,threat_types",
+ ),
+ _descriptor.MethodDescriptor(
+ name="SearchHashes",
+ full_name="google.cloud.webrisk.v1.WebRiskService.SearchHashes",
+ index=2,
+ containing_service=None,
+ input_type=_SEARCHHASHESREQUEST,
+ output_type=_SEARCHHASHESRESPONSE,
+ serialized_options=b"\202\323\344\223\002\023\022\021/v1/hashes:search\332A\030hash_prefix,threat_types",
+ ),
+ _descriptor.MethodDescriptor(
+ name="CreateSubmission",
+ full_name="google.cloud.webrisk.v1.WebRiskService.CreateSubmission",
+ index=3,
+ containing_service=None,
+ input_type=_CREATESUBMISSIONREQUEST,
+ output_type=_SUBMISSION,
+ serialized_options=b'\202\323\344\223\0021"#/v1/{parent=projects/*}/submissions:\nsubmission\332A\021parent,submission',
+ ),
+ ],
+)
+_sym_db.RegisterServiceDescriptor(_WEBRISKSERVICE)
+
+DESCRIPTOR.services_by_name["WebRiskService"] = _WEBRISKSERVICE
+
+# @@protoc_insertion_point(module_scope)
diff --git a/google/cloud/webrisk_v1/proto/webrisk_pb2_grpc.py b/google/cloud/webrisk_v1/proto/webrisk_pb2_grpc.py
new file mode 100644
index 0000000..6b3906e
--- /dev/null
+++ b/google/cloud/webrisk_v1/proto/webrisk_pb2_grpc.py
@@ -0,0 +1,120 @@
+# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+import grpc
+
+from google.cloud.webrisk_v1.proto import (
+ webrisk_pb2 as google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2,
+)
+
+
+class WebRiskServiceStub(object):
+ """Web Risk API defines an interface to detect malicious URLs on your
+ website and in client applications.
+ """
+
+ def __init__(self, channel):
+ """Constructor.
+
+ Args:
+ channel: A grpc.Channel.
+ """
+ self.ComputeThreatListDiff = channel.unary_unary(
+ "/google.cloud.webrisk.v1.WebRiskService/ComputeThreatListDiff",
+ request_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.ComputeThreatListDiffRequest.SerializeToString,
+ response_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.ComputeThreatListDiffResponse.FromString,
+ )
+ self.SearchUris = channel.unary_unary(
+ "/google.cloud.webrisk.v1.WebRiskService/SearchUris",
+ request_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchUrisRequest.SerializeToString,
+ response_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchUrisResponse.FromString,
+ )
+ self.SearchHashes = channel.unary_unary(
+ "/google.cloud.webrisk.v1.WebRiskService/SearchHashes",
+ request_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchHashesRequest.SerializeToString,
+ response_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchHashesResponse.FromString,
+ )
+ self.CreateSubmission = channel.unary_unary(
+ "/google.cloud.webrisk.v1.WebRiskService/CreateSubmission",
+ request_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.CreateSubmissionRequest.SerializeToString,
+ response_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.Submission.FromString,
+ )
+
+
+class WebRiskServiceServicer(object):
+ """Web Risk API defines an interface to detect malicious URLs on your
+ website and in client applications.
+ """
+
+ def ComputeThreatListDiff(self, request, context):
+ """Gets the most recent threat list diffs. These diffs should be applied to
+ a local database of hashes to keep it up-to-date. If the local database is
+ empty or excessively out-of-date, a complete snapshot of the database will
+ be returned. This Method only updates a single ThreatList at a time. To
+ update multiple ThreatList databases, this method needs to be called once
+ for each list.
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
+ def SearchUris(self, request, context):
+ """This method is used to check whether a URI is on a given threatList.
+ Multiple threatLists may be searched in a single query.
+ The response will list all requested threatLists the URI was found to
+ match. If the URI is not found on any of the requested ThreatList an
+ empty response will be returned.
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
+ def SearchHashes(self, request, context):
+ """Gets the full hashes that match the requested hash prefix.
+ This is used after a hash prefix is looked up in a threatList
+ and there is a match. The client side threatList only holds partial hashes
+ so the client must query this method to determine if there is a full
+ hash match of a threat.
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
+ def CreateSubmission(self, request, context):
+ """Creates a Submission of a URI suspected of containing phishing content to
+ be reviewed. If the result verifies the existence of malicious phishing
+ content, the site will be added to the [Google's Social Engineering
+ lists](https://support.google.com/webmasters/answer/6350487/) in order to
+ protect users that could get exposed to this threat in the future. Only
+ projects with CREATE_SUBMISSION_USERS visibility can use this method.
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details("Method not implemented!")
+ raise NotImplementedError("Method not implemented!")
+
+
+def add_WebRiskServiceServicer_to_server(servicer, server):
+ rpc_method_handlers = {
+ "ComputeThreatListDiff": grpc.unary_unary_rpc_method_handler(
+ servicer.ComputeThreatListDiff,
+ request_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.ComputeThreatListDiffRequest.FromString,
+ response_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.ComputeThreatListDiffResponse.SerializeToString,
+ ),
+ "SearchUris": grpc.unary_unary_rpc_method_handler(
+ servicer.SearchUris,
+ request_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchUrisRequest.FromString,
+ response_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchUrisResponse.SerializeToString,
+ ),
+ "SearchHashes": grpc.unary_unary_rpc_method_handler(
+ servicer.SearchHashes,
+ request_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchHashesRequest.FromString,
+ response_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.SearchHashesResponse.SerializeToString,
+ ),
+ "CreateSubmission": grpc.unary_unary_rpc_method_handler(
+ servicer.CreateSubmission,
+ request_deserializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.CreateSubmissionRequest.FromString,
+ response_serializer=google_dot_cloud_dot_webrisk__v1_dot_proto_dot_webrisk__pb2.Submission.SerializeToString,
+ ),
+ }
+ generic_handler = grpc.method_handlers_generic_handler(
+ "google.cloud.webrisk.v1.WebRiskService", rpc_method_handlers
+ )
+ server.add_generic_rpc_handlers((generic_handler,))
diff --git a/google/cloud/webrisk_v1/types.py b/google/cloud/webrisk_v1/types.py
new file mode 100644
index 0000000..7af0d2c
--- /dev/null
+++ b/google/cloud/webrisk_v1/types.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+
+from __future__ import absolute_import
+import sys
+
+from google.api_core.protobuf_helpers import get_messages
+
+from google.cloud.webrisk_v1.proto import webrisk_pb2
+from google.protobuf import timestamp_pb2
+
+
+_shared_modules = [timestamp_pb2]
+
+_local_modules = [webrisk_pb2]
+
+names = []
+
+for module in _shared_modules: # pragma: NO COVER
+ for name, message in get_messages(module).items():
+ setattr(sys.modules[__name__], name, message)
+ names.append(name)
+for module in _local_modules:
+ for name, message in get_messages(module).items():
+ message.__module__ = "google.cloud.webrisk_v1.types"
+ setattr(sys.modules[__name__], name, message)
+ names.append(name)
+
+
+__all__ = tuple(sorted(names))
diff --git a/google/cloud/webrisk_v1beta1/proto/webrisk.proto b/google/cloud/webrisk_v1beta1/proto/webrisk.proto
deleted file mode 100644
index 7f8021d..0000000
--- a/google/cloud/webrisk_v1beta1/proto/webrisk.proto
+++ /dev/null
@@ -1,302 +0,0 @@
-// Copyright 2019 Google LLC.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// 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.webrisk.v1beta1;
-
-import "google/api/annotations.proto";
-import "google/api/client.proto";
-import "google/api/field_behavior.proto";
-import "google/protobuf/timestamp.proto";
-
-option csharp_namespace = "Google.Cloud.WebRisk.V1Beta1";
-option go_package = "google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1;webrisk";
-option java_multiple_files = true;
-option java_outer_classname = "WebRiskProto";
-option java_package = "com.google.webrisk.v1beta1";
-option objc_class_prefix = "GCWR";
-option php_namespace = "Google\\Cloud\\WebRisk\\V1beta1";
-
-// Web Risk v1beta1 API defines an interface to detect malicious URLs on your
-// website and in client applications.
-service WebRiskServiceV1Beta1 {
- option (google.api.default_host) = "webrisk.googleapis.com";
- option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
-
- // Gets the most recent threat list diffs.
- rpc ComputeThreatListDiff(ComputeThreatListDiffRequest) returns (ComputeThreatListDiffResponse) {
- option (google.api.http) = {
- get: "/v1beta1/threatLists:computeDiff"
- };
- option (google.api.method_signature) = "threat_type,version_token,constraints";
- }
-
- // This method is used to check whether a URI is on a given threatList.
- rpc SearchUris(SearchUrisRequest) returns (SearchUrisResponse) {
- option (google.api.http) = {
- get: "/v1beta1/uris:search"
- };
- option (google.api.method_signature) = "uri,threat_types";
- }
-
- // Gets the full hashes that match the requested hash prefix.
- // This is used after a hash prefix is looked up in a threatList
- // and there is a match. The client side threatList only holds partial hashes
- // so the client must query this method to determine if there is a full
- // hash match of a threat.
- rpc SearchHashes(SearchHashesRequest) returns (SearchHashesResponse) {
- option (google.api.http) = {
- get: "/v1beta1/hashes:search"
- };
- option (google.api.method_signature) = "hash_prefix,threat_types";
- }
-}
-
-// Describes an API diff request.
-message ComputeThreatListDiffRequest {
- // The constraints for this diff.
- message Constraints {
- // The maximum size in number of entries. The diff will not contain more
- // entries than this value. This should be a power of 2 between 2**10 and
- // 2**20. If zero, no diff size limit is set.
- int32 max_diff_entries = 1;
-
- // Sets the maximum number of entries that the client is willing to have
- // in the local database. This should be a power of 2 between 2**10 and
- // 2**20. If zero, no database size limit is set.
- int32 max_database_entries = 2;
-
- // The compression types supported by the client.
- repeated CompressionType supported_compressions = 3;
- }
-
- // The ThreatList to update.
- ThreatType threat_type = 1 [(google.api.field_behavior) = REQUIRED];
-
- // The current version token of the client for the requested list (the
- // client version that was received from the last successful diff).
- bytes version_token = 2;
-
- // Required. The constraints associated with this request.
- Constraints constraints = 3 [(google.api.field_behavior) = REQUIRED];
-}
-
-message ComputeThreatListDiffResponse {
- // The expected state of a client's local database.
- message Checksum {
- // The SHA256 hash of the client state; that is, of the sorted list of all
- // hashes present in the database.
- bytes sha256 = 1;
- }
-
- // The type of response sent to the client.
- enum ResponseType {
- // Unknown.
- RESPONSE_TYPE_UNSPECIFIED = 0;
-
- // Partial updates are applied to the client's existing local database.
- DIFF = 1;
-
- // Full updates resets the client's entire local database. This means
- // that either the client had no state, was seriously out-of-date,
- // or the client is believed to be corrupt.
- RESET = 2;
- }
-
- // The type of response. This may indicate that an action must be taken by the
- // client when the response is received.
- ResponseType response_type = 4;
-
- // A set of entries to add to a local threat type's list.
- ThreatEntryAdditions additions = 5;
-
- // A set of entries to remove from a local threat type's list.
- // This field may be empty.
- ThreatEntryRemovals removals = 6;
-
- // The new opaque client version token.
- bytes new_version_token = 7;
-
- // The expected SHA256 hash of the client state; that is, of the sorted list
- // of all hashes present in the database after applying the provided diff.
- // If the client state doesn't match the expected state, the client must
- // disregard this diff and retry later.
- Checksum checksum = 8;
-
- // The soonest the client should wait before issuing any diff
- // request. Querying sooner is unlikely to produce a meaningful diff.
- // Waiting longer is acceptable considering the use case.
- // If this field is not set clients may update as soon as they want.
- google.protobuf.Timestamp recommended_next_diff = 2;
-}
-
-// Request to check URI entries against threatLists.
-message SearchUrisRequest {
- // Required. The URI to be checked for matches.
- string uri = 1 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The ThreatLists to search in.
- repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED];
-}
-
-message SearchUrisResponse {
- // Contains threat information on a matching uri.
- message ThreatUri {
- // The ThreatList this threat belongs to.
- repeated ThreatType threat_types = 1;
-
- // The cache lifetime for the returned match. Clients must not cache this
- // response past this timestamp to avoid false positives.
- google.protobuf.Timestamp expire_time = 2;
- }
-
- // The threat list matches. This may be empty if the URI is on no list.
- ThreatUri threat = 1;
-}
-
-// Request to return full hashes matched by the provided hash prefixes.
-message SearchHashesRequest {
- // A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
- // hash. For JSON requests, this field is base64-encoded.
- bytes hash_prefix = 1;
-
- // Required. The ThreatLists to search in.
- repeated ThreatType threat_types = 2 [(google.api.field_behavior) = REQUIRED];
-}
-
-message SearchHashesResponse {
- // Contains threat information on a matching hash.
- message ThreatHash {
- // The ThreatList this threat belongs to.
- // This must contain at least one entry.
- repeated ThreatType threat_types = 1;
-
- // A 32 byte SHA256 hash. This field is in binary format. For JSON
- // requests, hashes are base64-encoded.
- bytes hash = 2;
-
- // The cache lifetime for the returned match. Clients must not cache this
- // response past this timestamp to avoid false positives.
- google.protobuf.Timestamp expire_time = 3;
- }
-
- // The full hashes that matched the requested prefixes.
- // The hash will be populated in the key.
- repeated ThreatHash threats = 1;
-
- // For requested entities that did not match the threat list, how long to
- // cache the response until.
- google.protobuf.Timestamp negative_expire_time = 2;
-}
-
-// Contains the set of entries to add to a local database.
-// May contain a combination of compressed and raw data in a single response.
-message ThreatEntryAdditions {
- // The raw SHA256-formatted entries.
- // Repeated to allow returning sets of hashes with different prefix sizes.
- repeated RawHashes raw_hashes = 1;
-
- // The encoded 4-byte prefixes of SHA256-formatted entries, using a
- // Golomb-Rice encoding. The hashes are converted to uint32, sorted in
- // ascending order, then delta encoded and stored as encoded_data.
- RiceDeltaEncoding rice_hashes = 2;
-}
-
-// Contains the set of entries to remove from a local database.
-message ThreatEntryRemovals {
- // The raw removal indices for a local list.
- RawIndices raw_indices = 1;
-
- // The encoded local, lexicographically-sorted list indices, using a
- // Golomb-Rice encoding. Used for sending compressed removal indices. The
- // removal indices (uint32) are sorted in ascending order, then delta encoded
- // and stored as encoded_data.
- RiceDeltaEncoding rice_indices = 2;
-}
-
-// The type of threat. This maps dirrectly to the threat list a threat may
-// belong to.
-enum ThreatType {
- // Unknown.
- THREAT_TYPE_UNSPECIFIED = 0;
-
- // Malware targeting any platform.
- MALWARE = 1;
-
- // Social engineering targeting any platform.
- SOCIAL_ENGINEERING = 2;
-
- // Unwanted software targeting any platform.
- UNWANTED_SOFTWARE = 3;
-}
-
-// The ways in which threat entry sets can be compressed.
-enum CompressionType {
- // Unknown.
- COMPRESSION_TYPE_UNSPECIFIED = 0;
-
- // Raw, uncompressed data.
- RAW = 1;
-
- // Rice-Golomb encoded data.
- RICE = 2;
-}
-
-// A set of raw indices to remove from a local list.
-message RawIndices {
- // The indices to remove from a lexicographically-sorted local list.
- repeated int32 indices = 1;
-}
-
-// The uncompressed threat entries in hash format.
-// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4
-// bytes, but some hashes are lengthened if they collide with the hash of a
-// popular URI.
-//
-// Used for sending ThreatEntryAdditons to clients that do not support
-// compression, or when sending non-4-byte hashes to clients that do support
-// compression.
-message RawHashes {
- // The number of bytes for each prefix encoded below. This field can be
- // anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
- int32 prefix_size = 1;
-
- // The hashes, in binary format, concatenated into one long string. Hashes are
- // sorted in lexicographic order. For JSON API users, hashes are
- // base64-encoded.
- bytes raw_hashes = 2;
-}
-
-// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or
-// compressed removal indices.
-message RiceDeltaEncoding {
- // The offset of the first entry in the encoded data, or, if only a single
- // integer was encoded, that single integer's value. If the field is empty or
- // missing, assume zero.
- int64 first_value = 1;
-
- // The Golomb-Rice parameter, which is a number between 2 and 28. This field
- // is missing (that is, zero) if `num_entries` is zero.
- int32 rice_parameter = 2;
-
- // The number of entries that are delta encoded in the encoded data. If only a
- // single integer was encoded, this will be zero and the single value will be
- // stored in `first_value`.
- int32 entry_count = 3;
-
- // The encoded deltas that are encoded using the Golomb-Rice coder.
- bytes encoded_data = 4;
-}
diff --git a/google/cloud/webrisk_v1beta1/proto/webrisk_pb2.py b/google/cloud/webrisk_v1beta1/proto/webrisk_pb2.py
index bc5f367..f16d803 100644
--- a/google/cloud/webrisk_v1beta1/proto/webrisk_pb2.py
+++ b/google/cloud/webrisk_v1beta1/proto/webrisk_pb2.py
@@ -2,9 +2,6 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/webrisk_v1beta1/proto/webrisk.proto
-import sys
-
-_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
@@ -26,12 +23,8 @@
name="google/cloud/webrisk_v1beta1/proto/webrisk.proto",
package="google.cloud.webrisk.v1beta1",
syntax="proto3",
- serialized_options=_b(
- "\n\032com.google.webrisk.v1beta1B\014WebRiskProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/webrisk/v1beta1;webrisk\242\002\004GCWR\252\002\034Google.Cloud.WebRisk.V1Beta1\312\002\034Google\\Cloud\\WebRisk\\V1beta1"
- ),
- serialized_pb=_b(
- '\n0google/cloud/webrisk_v1beta1/proto/webrisk.proto\x12\x1cgoogle.cloud.webrisk.v1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xf2\x02\n\x1c\x43omputeThreatListDiffRequest\x12\x42\n\x0bthreat_type\x18\x01 \x01(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatTypeB\x03\xe0\x41\x02\x12\x15\n\rversion_token\x18\x02 \x01(\x0c\x12`\n\x0b\x63onstraints\x18\x03 \x01(\x0b\x32\x46.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.ConstraintsB\x03\xe0\x41\x02\x1a\x94\x01\n\x0b\x43onstraints\x12\x18\n\x10max_diff_entries\x18\x01 \x01(\x05\x12\x1c\n\x14max_database_entries\x18\x02 \x01(\x05\x12M\n\x16supported_compressions\x18\x03 \x03(\x0e\x32-.google.cloud.webrisk.v1beta1.CompressionType"\x9a\x04\n\x1d\x43omputeThreatListDiffResponse\x12_\n\rresponse_type\x18\x04 \x01(\x0e\x32H.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.ResponseType\x12\x45\n\tadditions\x18\x05 \x01(\x0b\x32\x32.google.cloud.webrisk.v1beta1.ThreatEntryAdditions\x12\x43\n\x08removals\x18\x06 \x01(\x0b\x32\x31.google.cloud.webrisk.v1beta1.ThreatEntryRemovals\x12\x19\n\x11new_version_token\x18\x07 \x01(\x0c\x12V\n\x08\x63hecksum\x18\x08 \x01(\x0b\x32\x44.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.Checksum\x12\x39\n\x15recommended_next_diff\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x1a\n\x08\x43hecksum\x12\x0e\n\x06sha256\x18\x01 \x01(\x0c"B\n\x0cResponseType\x12\x1d\n\x19RESPONSE_TYPE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x44IFF\x10\x01\x12\t\n\x05RESET\x10\x02"j\n\x11SearchUrisRequest\x12\x10\n\x03uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x43\n\x0cthreat_types\x18\x02 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatTypeB\x03\xe0\x41\x02"\xde\x01\n\x12SearchUrisResponse\x12J\n\x06threat\x18\x01 \x01(\x0b\x32:.google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri\x1a|\n\tThreatUri\x12>\n\x0cthreat_types\x18\x01 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatType\x12/\n\x0b\x65xpire_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"o\n\x13SearchHashesRequest\x12\x13\n\x0bhash_prefix\x18\x01 \x01(\x0c\x12\x43\n\x0cthreat_types\x18\x02 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatTypeB\x03\xe0\x41\x02"\xae\x02\n\x14SearchHashesResponse\x12N\n\x07threats\x18\x01 \x03(\x0b\x32=.google.cloud.webrisk.v1beta1.SearchHashesResponse.ThreatHash\x12\x38\n\x14negative_expire_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x8b\x01\n\nThreatHash\x12>\n\x0cthreat_types\x18\x01 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatType\x12\x0c\n\x04hash\x18\x02 \x01(\x0c\x12/\n\x0b\x65xpire_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\x99\x01\n\x14ThreatEntryAdditions\x12;\n\nraw_hashes\x18\x01 \x03(\x0b\x32\'.google.cloud.webrisk.v1beta1.RawHashes\x12\x44\n\x0brice_hashes\x18\x02 \x01(\x0b\x32/.google.cloud.webrisk.v1beta1.RiceDeltaEncoding"\x9b\x01\n\x13ThreatEntryRemovals\x12=\n\x0braw_indices\x18\x01 \x01(\x0b\x32(.google.cloud.webrisk.v1beta1.RawIndices\x12\x45\n\x0crice_indices\x18\x02 \x01(\x0b\x32/.google.cloud.webrisk.v1beta1.RiceDeltaEncoding"\x1d\n\nRawIndices\x12\x0f\n\x07indices\x18\x01 \x03(\x05"4\n\tRawHashes\x12\x13\n\x0bprefix_size\x18\x01 \x01(\x05\x12\x12\n\nraw_hashes\x18\x02 \x01(\x0c"k\n\x11RiceDeltaEncoding\x12\x13\n\x0b\x66irst_value\x18\x01 \x01(\x03\x12\x16\n\x0erice_parameter\x18\x02 \x01(\x05\x12\x13\n\x0b\x65ntry_count\x18\x03 \x01(\x05\x12\x14\n\x0c\x65ncoded_data\x18\x04 \x01(\x0c*e\n\nThreatType\x12\x1b\n\x17THREAT_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07MALWARE\x10\x01\x12\x16\n\x12SOCIAL_ENGINEERING\x10\x02\x12\x15\n\x11UNWANTED_SOFTWARE\x10\x03*F\n\x0f\x43ompressionType\x12 \n\x1c\x43OMPRESSION_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03RAW\x10\x01\x12\x08\n\x04RICE\x10\x02\x32\x9e\x05\n\x15WebRiskServiceV1Beta1\x12\xe2\x01\n\x15\x43omputeThreatListDiff\x12:.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest\x1a;.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse"P\x82\xd3\xe4\x93\x02"\x12 /v1beta1/threatLists:computeDiff\xda\x41%threat_type,version_token,constraints\x12\xa0\x01\n\nSearchUris\x12/.google.cloud.webrisk.v1beta1.SearchUrisRequest\x1a\x30.google.cloud.webrisk.v1beta1.SearchUrisResponse"/\x82\xd3\xe4\x93\x02\x16\x12\x14/v1beta1/uris:search\xda\x41\x10uri,threat_types\x12\xb0\x01\n\x0cSearchHashes\x12\x31.google.cloud.webrisk.v1beta1.SearchHashesRequest\x1a\x32.google.cloud.webrisk.v1beta1.SearchHashesResponse"9\x82\xd3\xe4\x93\x02\x18\x12\x16/v1beta1/hashes:search\xda\x41\x18hash_prefix,threat_types\x1aJ\xca\x41\x16webrisk.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb6\x01\n\x1a\x63om.google.webrisk.v1beta1B\x0cWebRiskProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/webrisk/v1beta1;webrisk\xa2\x02\x04GCWR\xaa\x02\x1cGoogle.Cloud.WebRisk.V1Beta1\xca\x02\x1cGoogle\\Cloud\\WebRisk\\V1beta1b\x06proto3'
- ),
+ serialized_options=b"\n\032com.google.webrisk.v1beta1B\014WebRiskProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/webrisk/v1beta1;webrisk\242\002\004GCWR\252\002\034Google.Cloud.WebRisk.V1Beta1\312\002\034Google\\Cloud\\WebRisk\\V1beta1",
+ serialized_pb=b'\n0google/cloud/webrisk_v1beta1/proto/webrisk.proto\x12\x1cgoogle.cloud.webrisk.v1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xf2\x02\n\x1c\x43omputeThreatListDiffRequest\x12\x42\n\x0bthreat_type\x18\x01 \x01(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatTypeB\x03\xe0\x41\x02\x12\x15\n\rversion_token\x18\x02 \x01(\x0c\x12`\n\x0b\x63onstraints\x18\x03 \x01(\x0b\x32\x46.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.ConstraintsB\x03\xe0\x41\x02\x1a\x94\x01\n\x0b\x43onstraints\x12\x18\n\x10max_diff_entries\x18\x01 \x01(\x05\x12\x1c\n\x14max_database_entries\x18\x02 \x01(\x05\x12M\n\x16supported_compressions\x18\x03 \x03(\x0e\x32-.google.cloud.webrisk.v1beta1.CompressionType"\x9a\x04\n\x1d\x43omputeThreatListDiffResponse\x12_\n\rresponse_type\x18\x04 \x01(\x0e\x32H.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.ResponseType\x12\x45\n\tadditions\x18\x05 \x01(\x0b\x32\x32.google.cloud.webrisk.v1beta1.ThreatEntryAdditions\x12\x43\n\x08removals\x18\x06 \x01(\x0b\x32\x31.google.cloud.webrisk.v1beta1.ThreatEntryRemovals\x12\x19\n\x11new_version_token\x18\x07 \x01(\x0c\x12V\n\x08\x63hecksum\x18\x08 \x01(\x0b\x32\x44.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.Checksum\x12\x39\n\x15recommended_next_diff\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x1a\n\x08\x43hecksum\x12\x0e\n\x06sha256\x18\x01 \x01(\x0c"B\n\x0cResponseType\x12\x1d\n\x19RESPONSE_TYPE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x44IFF\x10\x01\x12\t\n\x05RESET\x10\x02"j\n\x11SearchUrisRequest\x12\x10\n\x03uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x43\n\x0cthreat_types\x18\x02 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatTypeB\x03\xe0\x41\x02"\xde\x01\n\x12SearchUrisResponse\x12J\n\x06threat\x18\x01 \x01(\x0b\x32:.google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri\x1a|\n\tThreatUri\x12>\n\x0cthreat_types\x18\x01 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatType\x12/\n\x0b\x65xpire_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"o\n\x13SearchHashesRequest\x12\x13\n\x0bhash_prefix\x18\x01 \x01(\x0c\x12\x43\n\x0cthreat_types\x18\x02 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatTypeB\x03\xe0\x41\x02"\xae\x02\n\x14SearchHashesResponse\x12N\n\x07threats\x18\x01 \x03(\x0b\x32=.google.cloud.webrisk.v1beta1.SearchHashesResponse.ThreatHash\x12\x38\n\x14negative_expire_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x8b\x01\n\nThreatHash\x12>\n\x0cthreat_types\x18\x01 \x03(\x0e\x32(.google.cloud.webrisk.v1beta1.ThreatType\x12\x0c\n\x04hash\x18\x02 \x01(\x0c\x12/\n\x0b\x65xpire_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\x99\x01\n\x14ThreatEntryAdditions\x12;\n\nraw_hashes\x18\x01 \x03(\x0b\x32\'.google.cloud.webrisk.v1beta1.RawHashes\x12\x44\n\x0brice_hashes\x18\x02 \x01(\x0b\x32/.google.cloud.webrisk.v1beta1.RiceDeltaEncoding"\x9b\x01\n\x13ThreatEntryRemovals\x12=\n\x0braw_indices\x18\x01 \x01(\x0b\x32(.google.cloud.webrisk.v1beta1.RawIndices\x12\x45\n\x0crice_indices\x18\x02 \x01(\x0b\x32/.google.cloud.webrisk.v1beta1.RiceDeltaEncoding"\x1d\n\nRawIndices\x12\x0f\n\x07indices\x18\x01 \x03(\x05"4\n\tRawHashes\x12\x13\n\x0bprefix_size\x18\x01 \x01(\x05\x12\x12\n\nraw_hashes\x18\x02 \x01(\x0c"k\n\x11RiceDeltaEncoding\x12\x13\n\x0b\x66irst_value\x18\x01 \x01(\x03\x12\x16\n\x0erice_parameter\x18\x02 \x01(\x05\x12\x13\n\x0b\x65ntry_count\x18\x03 \x01(\x05\x12\x14\n\x0c\x65ncoded_data\x18\x04 \x01(\x0c*e\n\nThreatType\x12\x1b\n\x17THREAT_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07MALWARE\x10\x01\x12\x16\n\x12SOCIAL_ENGINEERING\x10\x02\x12\x15\n\x11UNWANTED_SOFTWARE\x10\x03*F\n\x0f\x43ompressionType\x12 \n\x1c\x43OMPRESSION_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03RAW\x10\x01\x12\x08\n\x04RICE\x10\x02\x32\x9e\x05\n\x15WebRiskServiceV1Beta1\x12\xe2\x01\n\x15\x43omputeThreatListDiff\x12:.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest\x1a;.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse"P\x82\xd3\xe4\x93\x02"\x12 /v1beta1/threatLists:computeDiff\xda\x41%threat_type,version_token,constraints\x12\xa0\x01\n\nSearchUris\x12/.google.cloud.webrisk.v1beta1.SearchUrisRequest\x1a\x30.google.cloud.webrisk.v1beta1.SearchUrisResponse"/\x82\xd3\xe4\x93\x02\x16\x12\x14/v1beta1/uris:search\xda\x41\x10uri,threat_types\x12\xb0\x01\n\x0cSearchHashes\x12\x31.google.cloud.webrisk.v1beta1.SearchHashesRequest\x1a\x32.google.cloud.webrisk.v1beta1.SearchHashesResponse"9\x82\xd3\xe4\x93\x02\x18\x12\x16/v1beta1/hashes:search\xda\x41\x18hash_prefix,threat_types\x1aJ\xca\x41\x16webrisk.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb6\x01\n\x1a\x63om.google.webrisk.v1beta1B\x0cWebRiskProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/webrisk/v1beta1;webrisk\xa2\x02\x04GCWR\xaa\x02\x1cGoogle.Cloud.WebRisk.V1Beta1\xca\x02\x1cGoogle\\Cloud\\WebRisk\\V1beta1b\x06proto3',
dependencies=[
google_dot_api_dot_annotations__pb2.DESCRIPTOR,
google_dot_api_dot_client__pb2.DESCRIPTOR,
@@ -240,7 +233,7 @@
containing_type=None,
is_extension=False,
extension_scope=None,
- serialized_options=_b("\340A\002"),
+ serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
@@ -252,7 +245,7 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b(""),
+ default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
@@ -276,7 +269,7 @@
containing_type=None,
is_extension=False,
extension_scope=None,
- serialized_options=_b("\340A\002"),
+ serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
],
@@ -309,7 +302,7 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b(""),
+ default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
@@ -401,7 +394,7 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b(""),
+ default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
@@ -476,13 +469,13 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b("").decode("utf-8"),
+ default_value=b"".decode("utf-8"),
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
- serialized_options=_b("\340A\002"),
+ serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
@@ -500,7 +493,7 @@
containing_type=None,
is_extension=False,
extension_scope=None,
- serialized_options=_b("\340A\002"),
+ serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
],
@@ -628,7 +621,7 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b(""),
+ default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
@@ -652,7 +645,7 @@
containing_type=None,
is_extension=False,
extension_scope=None,
- serialized_options=_b("\340A\002"),
+ serialized_options=b"\340A\002",
file=DESCRIPTOR,
),
],
@@ -703,7 +696,7 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b(""),
+ default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
@@ -987,7 +980,7 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b(""),
+ default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
@@ -1080,7 +1073,7 @@
cpp_type=9,
label=1,
has_default_value=False,
- default_value=_b(""),
+ default_value=b"",
message_type=None,
enum_type=None,
containing_type=None,
@@ -1178,14 +1171,14 @@
ComputeThreatListDiffRequest = _reflection.GeneratedProtocolMessageType(
"ComputeThreatListDiffRequest",
(_message.Message,),
- dict(
- Constraints=_reflection.GeneratedProtocolMessageType(
+ {
+ "Constraints": _reflection.GeneratedProtocolMessageType(
"Constraints",
(_message.Message,),
- dict(
- DESCRIPTOR=_COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""The constraints for this diff.
+ {
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFREQUEST_CONSTRAINTS,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """The constraints for this diff.
Attributes:
@@ -1203,11 +1196,11 @@
The compression types supported by the client.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints)
- ),
+ },
),
- DESCRIPTOR=_COMPUTETHREATLISTDIFFREQUEST,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""Describes an API diff request.
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFREQUEST,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """Describes an API diff request.
Attributes:
@@ -1221,7 +1214,7 @@
Required. The constraints associated with this request.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest)
- ),
+ },
)
_sym_db.RegisterMessage(ComputeThreatListDiffRequest)
_sym_db.RegisterMessage(ComputeThreatListDiffRequest.Constraints)
@@ -1229,14 +1222,14 @@
ComputeThreatListDiffResponse = _reflection.GeneratedProtocolMessageType(
"ComputeThreatListDiffResponse",
(_message.Message,),
- dict(
- Checksum=_reflection.GeneratedProtocolMessageType(
+ {
+ "Checksum": _reflection.GeneratedProtocolMessageType(
"Checksum",
(_message.Message,),
- dict(
- DESCRIPTOR=_COMPUTETHREATLISTDIFFRESPONSE_CHECKSUM,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""The expected state of a client's local database.
+ {
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFRESPONSE_CHECKSUM,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """The expected state of a client’s local database.
Attributes:
@@ -1245,26 +1238,26 @@
list of all hashes present in the database.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.Checksum)
- ),
+ },
),
- DESCRIPTOR=_COMPUTETHREATLISTDIFFRESPONSE,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""
+ "DESCRIPTOR": _COMPUTETHREATLISTDIFFRESPONSE,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """
Attributes:
response_type:
The type of response. This may indicate that an action must be
taken by the client when the response is received.
additions:
- A set of entries to add to a local threat type's list.
+ A set of entries to add to a local threat type’s list.
removals:
- A set of entries to remove from a local threat type's list.
+ A set of entries to remove from a local threat type’s list.
This field may be empty.
new_version_token:
The new opaque client version token.
checksum:
The expected SHA256 hash of the client state; that is, of the
sorted list of all hashes present in the database after
- applying the provided diff. If the client state doesn't match
+ applying the provided diff. If the client state doesn’t match
the expected state, the client must disregard this diff and
retry later.
recommended_next_diff:
@@ -1275,7 +1268,7 @@
want.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse)
- ),
+ },
)
_sym_db.RegisterMessage(ComputeThreatListDiffResponse)
_sym_db.RegisterMessage(ComputeThreatListDiffResponse.Checksum)
@@ -1283,10 +1276,10 @@
SearchUrisRequest = _reflection.GeneratedProtocolMessageType(
"SearchUrisRequest",
(_message.Message,),
- dict(
- DESCRIPTOR=_SEARCHURISREQUEST,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""Request to check URI entries against threatLists.
+ {
+ "DESCRIPTOR": _SEARCHURISREQUEST,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """Request to check URI entries against threatLists.
Attributes:
@@ -1296,21 +1289,21 @@
Required. The ThreatLists to search in.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.SearchUrisRequest)
- ),
+ },
)
_sym_db.RegisterMessage(SearchUrisRequest)
SearchUrisResponse = _reflection.GeneratedProtocolMessageType(
"SearchUrisResponse",
(_message.Message,),
- dict(
- ThreatUri=_reflection.GeneratedProtocolMessageType(
+ {
+ "ThreatUri": _reflection.GeneratedProtocolMessageType(
"ThreatUri",
(_message.Message,),
- dict(
- DESCRIPTOR=_SEARCHURISRESPONSE_THREATURI,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""Contains threat information on a matching uri.
+ {
+ "DESCRIPTOR": _SEARCHURISRESPONSE_THREATURI,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """Contains threat information on a matching uri.
Attributes:
@@ -1322,18 +1315,18 @@
positives.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri)
- ),
+ },
),
- DESCRIPTOR=_SEARCHURISRESPONSE,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""
+ "DESCRIPTOR": _SEARCHURISRESPONSE,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """
Attributes:
threat:
The threat list matches. This may be empty if the URI is on no
list.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.SearchUrisResponse)
- ),
+ },
)
_sym_db.RegisterMessage(SearchUrisResponse)
_sym_db.RegisterMessage(SearchUrisResponse.ThreatUri)
@@ -1341,11 +1334,10 @@
SearchHashesRequest = _reflection.GeneratedProtocolMessageType(
"SearchHashesRequest",
(_message.Message,),
- dict(
- DESCRIPTOR=_SEARCHHASHESREQUEST,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""Request to return full hashes matched by the provided hash
- prefixes.
+ {
+ "DESCRIPTOR": _SEARCHHASHESREQUEST,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """Request to return full hashes matched by the provided hash prefixes.
Attributes:
@@ -1357,21 +1349,21 @@
Required. The ThreatLists to search in.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.SearchHashesRequest)
- ),
+ },
)
_sym_db.RegisterMessage(SearchHashesRequest)
SearchHashesResponse = _reflection.GeneratedProtocolMessageType(
"SearchHashesResponse",
(_message.Message,),
- dict(
- ThreatHash=_reflection.GeneratedProtocolMessageType(
+ {
+ "ThreatHash": _reflection.GeneratedProtocolMessageType(
"ThreatHash",
(_message.Message,),
- dict(
- DESCRIPTOR=_SEARCHHASHESRESPONSE_THREATHASH,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""Contains threat information on a matching hash.
+ {
+ "DESCRIPTOR": _SEARCHHASHESRESPONSE_THREATHASH,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """Contains threat information on a matching hash.
Attributes:
@@ -1387,11 +1379,11 @@
positives.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.SearchHashesResponse.ThreatHash)
- ),
+ },
),
- DESCRIPTOR=_SEARCHHASHESRESPONSE,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""
+ "DESCRIPTOR": _SEARCHHASHESRESPONSE,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """
Attributes:
threats:
The full hashes that matched the requested prefixes. The hash
@@ -1401,7 +1393,7 @@
long to cache the response until.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.SearchHashesResponse)
- ),
+ },
)
_sym_db.RegisterMessage(SearchHashesResponse)
_sym_db.RegisterMessage(SearchHashesResponse.ThreatHash)
@@ -1409,10 +1401,10 @@
ThreatEntryAdditions = _reflection.GeneratedProtocolMessageType(
"ThreatEntryAdditions",
(_message.Message,),
- dict(
- DESCRIPTOR=_THREATENTRYADDITIONS,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""Contains the set of entries to add to a local database.
+ {
+ "DESCRIPTOR": _THREATENTRYADDITIONS,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """Contains the set of entries to add to a local database.
May contain a combination of compressed and raw data in a single
response.
@@ -1425,20 +1417,21 @@
The encoded 4-byte prefixes of SHA256-formatted entries, using
a Golomb-Rice encoding. The hashes are converted to uint32,
sorted in ascending order, then delta encoded and stored as
- encoded\_data.
+ encoded_data.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.ThreatEntryAdditions)
- ),
+ },
)
_sym_db.RegisterMessage(ThreatEntryAdditions)
ThreatEntryRemovals = _reflection.GeneratedProtocolMessageType(
"ThreatEntryRemovals",
(_message.Message,),
- dict(
- DESCRIPTOR=_THREATENTRYREMOVALS,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""Contains the set of entries to remove from a local database.
+ {
+ "DESCRIPTOR": _THREATENTRYREMOVALS,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """Contains the set of entries to remove from a local
+ database.
Attributes:
@@ -1449,20 +1442,20 @@
using a Golomb-Rice encoding. Used for sending compressed
removal indices. The removal indices (uint32) are sorted in
ascending order, then delta encoded and stored as
- encoded\_data.
+ encoded_data.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.ThreatEntryRemovals)
- ),
+ },
)
_sym_db.RegisterMessage(ThreatEntryRemovals)
RawIndices = _reflection.GeneratedProtocolMessageType(
"RawIndices",
(_message.Message,),
- dict(
- DESCRIPTOR=_RAWINDICES,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""A set of raw indices to remove from a local list.
+ {
+ "DESCRIPTOR": _RAWINDICES,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """A set of raw indices to remove from a local list.
Attributes:
@@ -1471,17 +1464,17 @@
list.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.RawIndices)
- ),
+ },
)
_sym_db.RegisterMessage(RawIndices)
RawHashes = _reflection.GeneratedProtocolMessageType(
"RawHashes",
(_message.Message,),
- dict(
- DESCRIPTOR=_RAWHASHES,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""The uncompressed threat entries in hash format. Hashes can
+ {
+ "DESCRIPTOR": _RAWHASHES,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """The uncompressed threat entries in hash format. Hashes can
be anywhere from 4 to 32 bytes in size. A large majority are 4 bytes,
but some hashes are lengthened if they collide with the hash of a
popular URI.
@@ -1502,24 +1495,24 @@
users, hashes are base64-encoded.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.RawHashes)
- ),
+ },
)
_sym_db.RegisterMessage(RawHashes)
RiceDeltaEncoding = _reflection.GeneratedProtocolMessageType(
"RiceDeltaEncoding",
(_message.Message,),
- dict(
- DESCRIPTOR=_RICEDELTAENCODING,
- __module__="google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
- __doc__="""The Rice-Golomb encoded data. Used for sending compressed
+ {
+ "DESCRIPTOR": _RICEDELTAENCODING,
+ "__module__": "google.cloud.webrisk_v1beta1.proto.webrisk_pb2",
+ "__doc__": """The Rice-Golomb encoded data. Used for sending compressed
4-byte hashes or compressed removal indices.
Attributes:
first_value:
The offset of the first entry in the encoded data, or, if only
- a single integer was encoded, that single integer's value. If
+ a single integer was encoded, that single integer’s value. If
the field is empty or missing, assume zero.
rice_parameter:
The Golomb-Rice parameter, which is a number between 2 and 28.
@@ -1534,7 +1527,7 @@
coder.
""",
# @@protoc_insertion_point(class_scope:google.cloud.webrisk.v1beta1.RiceDeltaEncoding)
- ),
+ },
)
_sym_db.RegisterMessage(RiceDeltaEncoding)
@@ -1551,9 +1544,7 @@
full_name="google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1",
file=DESCRIPTOR,
index=0,
- serialized_options=_b(
- "\312A\026webrisk.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform"
- ),
+ serialized_options=b"\312A\026webrisk.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform",
serialized_start=2552,
serialized_end=3222,
methods=[
@@ -1564,9 +1555,7 @@
containing_service=None,
input_type=_COMPUTETHREATLISTDIFFREQUEST,
output_type=_COMPUTETHREATLISTDIFFRESPONSE,
- serialized_options=_b(
- '\202\323\344\223\002"\022 /v1beta1/threatLists:computeDiff\332A%threat_type,version_token,constraints'
- ),
+ serialized_options=b'\202\323\344\223\002"\022 /v1beta1/threatLists:computeDiff\332A%threat_type,version_token,constraints',
),
_descriptor.MethodDescriptor(
name="SearchUris",
@@ -1575,9 +1564,7 @@
containing_service=None,
input_type=_SEARCHURISREQUEST,
output_type=_SEARCHURISRESPONSE,
- serialized_options=_b(
- "\202\323\344\223\002\026\022\024/v1beta1/uris:search\332A\020uri,threat_types"
- ),
+ serialized_options=b"\202\323\344\223\002\026\022\024/v1beta1/uris:search\332A\020uri,threat_types",
),
_descriptor.MethodDescriptor(
name="SearchHashes",
@@ -1586,9 +1573,7 @@
containing_service=None,
input_type=_SEARCHHASHESREQUEST,
output_type=_SEARCHHASHESRESPONSE,
- serialized_options=_b(
- "\202\323\344\223\002\030\022\026/v1beta1/hashes:search\332A\030hash_prefix,threat_types"
- ),
+ serialized_options=b"\202\323\344\223\002\030\022\026/v1beta1/hashes:search\332A\030hash_prefix,threat_types",
),
],
)
diff --git a/synth.metadata b/synth.metadata
index 2ab5b50..49f8dd2 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -1,20 +1,19 @@
{
- "updateTime": "2020-03-04T13:30:31.232611Z",
+ "updateTime": "2020-03-17T23:36:24.812263Z",
"sources": [
{
- "generator": {
- "name": "artman",
- "version": "1.0.0",
- "dockerImage": "googleapis/artman@sha256:f37f2464788cb551299209b4fcab4eb323533154488c2ef9ec0c75d7c2b4b482"
+ "git": {
+ "name": ".",
+ "remote": "git@github.com:googleapis/python-webrisk",
+ "sha": "951a39687a44692e27b01f461b1496126c774f84"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "541b1ded4abadcc38e8178680b0677f65594ea6f",
- "internalRef": "298686266",
- "log": "541b1ded4abadcc38e8178680b0677f65594ea6f\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 298686266\n\nc0d171acecb4f5b0bfd2c4ca34fc54716574e300\n Updated to include the Notification v1 API.\n\nPiperOrigin-RevId: 298652775\n\n2346a9186c0bff2c9cc439f2459d558068637e05\nAdd Service Directory v1beta1 protos and configs\n\nPiperOrigin-RevId: 298625638\n\na78ed801b82a5c6d9c5368e24b1412212e541bb7\nPublishing v3 protos and configs.\n\nPiperOrigin-RevId: 298607357\n\n4a180bfff8a21645b3a935c2756e8d6ab18a74e0\nautoml/v1beta1 publish proto updates\n\nPiperOrigin-RevId: 298484782\n\n6de6e938b7df1cd62396563a067334abeedb9676\nchore: use the latest gapic-generator and protoc-java-resource-name-plugin in Bazel workspace.\n\nPiperOrigin-RevId: 298474513\n\n244ab2b83a82076a1fa7be63b7e0671af73f5c02\nAdds service config definition for bigqueryreservation v1\n\nPiperOrigin-RevId: 298455048\n\n83c6f84035ee0f80eaa44d8b688a010461cc4080\nUpdate google/api/auth.proto to make AuthProvider to have JwtLocation\n\nPiperOrigin-RevId: 297918498\n\ne9e90a787703ec5d388902e2cb796aaed3a385b4\nDialogflow weekly v2/v2beta1 library update:\n - adding get validation result\n - adding field mask override control for output audio config\nImportant updates are also posted at:\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 297671458\n\n1a2b05cc3541a5f7714529c665aecc3ea042c646\nAdding .yaml and .json config files.\n\nPiperOrigin-RevId: 297570622\n\ndfe1cf7be44dee31d78f78e485d8c95430981d6e\nPublish `QueryOptions` proto.\n\nIntroduced a `query_options` input in `ExecuteSqlRequest`.\n\nPiperOrigin-RevId: 297497710\n\ndafc905f71e5d46f500b41ed715aad585be062c3\npubsub: revert pull init_rpc_timeout & max_rpc_timeout back to 25 seconds and reset multiplier to 1.0\n\nPiperOrigin-RevId: 297486523\n\nf077632ba7fee588922d9e8717ee272039be126d\nfirestore: add update_transform\n\nPiperOrigin-RevId: 297405063\n\n0aba1900ffef672ec5f0da677cf590ee5686e13b\ncluster: use square brace for cross-reference\n\nPiperOrigin-RevId: 297204568\n\n5dac2da18f6325cbaed54603c43f0667ecd50247\nRestore retry params in gapic config because securitycenter has non-standard default retry params.\nRestore a few retry codes for some idempotent methods.\n\nPiperOrigin-RevId: 297196720\n\n1eb61455530252bba8b2c8d4bc9832960e5a56f6\npubsub: v1 replace IAM HTTP rules\n\nPiperOrigin-RevId: 297188590\n\n80b2d25f8d43d9d47024ff06ead7f7166548a7ba\nDialogflow weekly v2/v2beta1 library update:\n - updates to mega agent api\n - adding field mask override control for output audio config\nImportant updates are also posted at:\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 297187629\n\n0b1876b35e98f560f9c9ca9797955f020238a092\nUse an older version of protoc-docs-plugin that is compatible with the specified gapic-generator and protobuf versions.\n\nprotoc-docs-plugin >=0.4.0 (see commit https://github.com/googleapis/protoc-docs-plugin/commit/979f03ede6678c487337f3d7e88bae58df5207af) is incompatible with protobuf 3.9.1.\n\nPiperOrigin-RevId: 296986742\n\n1e47e676cddbbd8d93f19ba0665af15b5532417e\nFix: Restore a method signature for UpdateCluster\n\nPiperOrigin-RevId: 296901854\n\n7f910bcc4fc4704947ccfd3ceed015d16b9e00c2\nUpdate Dataproc v1beta2 client.\n\nPiperOrigin-RevId: 296451205\n\nde287524405a3dce124d301634731584fc0432d7\nFix: Reinstate method signatures that had been missed off some RPCs\nFix: Correct resource types for two fields\n\nPiperOrigin-RevId: 296435091\n\ne5bc9566ae057fb4c92f8b7e047f1c8958235b53\nDeprecate the endpoint_uris field, as it is unused.\n\nPiperOrigin-RevId: 296357191\n\n8c12e2b4dca94e12bff9f538bdac29524ff7ef7a\nUpdate Dataproc v1 client.\n\nPiperOrigin-RevId: 296336662\n\n17567c4a1ef0a9b50faa87024d66f8acbb561089\nRemoving erroneous comment, a la https://github.com/googleapis/java-speech/pull/103\n\nPiperOrigin-RevId: 296332968\n\n"
+ "sha": "5058c1c96d0ece7f5301a154cf5a07b2ad03a571",
+ "internalRef": "301443847"
}
},
{
@@ -32,8 +31,16 @@
"apiName": "webrisk",
"apiVersion": "v1beta1",
"language": "python",
- "generator": "gapic",
- "config": "google/cloud/webrisk/artman_webrisk_v1beta1.yaml"
+ "generator": "bazel"
+ }
+ },
+ {
+ "client": {
+ "source": "googleapis",
+ "apiName": "webrisk",
+ "apiVersion": "v1",
+ "language": "python",
+ "generator": "bazel"
}
}
]
diff --git a/synth.py b/synth.py
index 6832e39..a564e33 100644
--- a/synth.py
+++ b/synth.py
@@ -19,23 +19,23 @@
import synthtool as s
from synthtool import gcp
-gapic = gcp.GAPICGenerator()
+gapic = gcp.GAPICBazel()
common = gcp.CommonTemplates()
-versions = ["v1beta1"]
+versions = ["v1beta1", "v1"]
# ----------------------------------------------------------------------------
# Generate webrisk GAPIC layer
# ----------------------------------------------------------------------------
for version in versions:
- library = gapic.py_library("webrisk", version, include_protos=True)
+ library = gapic.py_library("webrisk", version)
s.copy(library, excludes=["docs/index.rst", "nox.py", "README.rst", "setup.py"])
# Fix docstring issue for classes with no summary line
s.replace(
"google/cloud/**/proto/webrisk_pb2.py",
- '''__doc__ = """Attributes:''',
- '''__doc__ = """
+ ''''__doc__': """Attributes:''',
+ ''''__doc__': """
Attributes:''',
)
diff --git a/tests/unit/gapic/v1/test_web_risk_service_client_v1.py b/tests/unit/gapic/v1/test_web_risk_service_client_v1.py
new file mode 100644
index 0000000..4b45a55
--- /dev/null
+++ b/tests/unit/gapic/v1/test_web_risk_service_client_v1.py
@@ -0,0 +1,226 @@
+# -*- coding: utf-8 -*-
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+"""Unit tests."""
+
+import mock
+import pytest
+
+from google.cloud import webrisk_v1
+from google.cloud.webrisk_v1 import enums
+from google.cloud.webrisk_v1.proto import webrisk_pb2
+
+
+class MultiCallableStub(object):
+ """Stub for the grpc.UnaryUnaryMultiCallable interface."""
+
+ def __init__(self, method, channel_stub):
+ self.method = method
+ self.channel_stub = channel_stub
+
+ def __call__(self, request, timeout=None, metadata=None, credentials=None):
+ self.channel_stub.requests.append((self.method, request))
+
+ response = None
+ if self.channel_stub.responses:
+ response = self.channel_stub.responses.pop()
+
+ if isinstance(response, Exception):
+ raise response
+
+ if response:
+ return response
+
+
+class ChannelStub(object):
+ """Stub for the grpc.Channel interface."""
+
+ def __init__(self, responses=[]):
+ self.responses = responses
+ self.requests = []
+
+ def unary_unary(self, method, request_serializer=None, response_deserializer=None):
+ return MultiCallableStub(method, self)
+
+
+class CustomException(Exception):
+ pass
+
+
+class TestWebRiskServiceClient(object):
+ def test_compute_threat_list_diff(self):
+ # Setup Expected Response
+ new_version_token = b"115"
+ expected_response = {"new_version_token": new_version_token}
+ expected_response = webrisk_pb2.ComputeThreatListDiffResponse(
+ **expected_response
+ )
+
+ # Mock the API response
+ channel = ChannelStub(responses=[expected_response])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup Request
+ threat_type = enums.ThreatType.THREAT_TYPE_UNSPECIFIED
+ constraints = {}
+
+ response = client.compute_threat_list_diff(threat_type, constraints)
+ assert expected_response == response
+
+ assert len(channel.requests) == 1
+ expected_request = webrisk_pb2.ComputeThreatListDiffRequest(
+ threat_type=threat_type, constraints=constraints
+ )
+ actual_request = channel.requests[0][1]
+ assert expected_request == actual_request
+
+ def test_compute_threat_list_diff_exception(self):
+ # Mock the API response
+ channel = ChannelStub(responses=[CustomException()])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup request
+ threat_type = enums.ThreatType.THREAT_TYPE_UNSPECIFIED
+ constraints = {}
+
+ with pytest.raises(CustomException):
+ client.compute_threat_list_diff(threat_type, constraints)
+
+ def test_search_uris(self):
+ # Setup Expected Response
+ expected_response = {}
+ expected_response = webrisk_pb2.SearchUrisResponse(**expected_response)
+
+ # Mock the API response
+ channel = ChannelStub(responses=[expected_response])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup Request
+ uri = "uri116076"
+ threat_types = []
+
+ response = client.search_uris(uri, threat_types)
+ assert expected_response == response
+
+ assert len(channel.requests) == 1
+ expected_request = webrisk_pb2.SearchUrisRequest(
+ uri=uri, threat_types=threat_types
+ )
+ actual_request = channel.requests[0][1]
+ assert expected_request == actual_request
+
+ def test_search_uris_exception(self):
+ # Mock the API response
+ channel = ChannelStub(responses=[CustomException()])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup request
+ uri = "uri116076"
+ threat_types = []
+
+ with pytest.raises(CustomException):
+ client.search_uris(uri, threat_types)
+
+ def test_search_hashes(self):
+ # Setup Expected Response
+ expected_response = {}
+ expected_response = webrisk_pb2.SearchHashesResponse(**expected_response)
+
+ # Mock the API response
+ channel = ChannelStub(responses=[expected_response])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup Request
+ threat_types = []
+
+ response = client.search_hashes(threat_types)
+ assert expected_response == response
+
+ assert len(channel.requests) == 1
+ expected_request = webrisk_pb2.SearchHashesRequest(threat_types=threat_types)
+ actual_request = channel.requests[0][1]
+ assert expected_request == actual_request
+
+ def test_search_hashes_exception(self):
+ # Mock the API response
+ channel = ChannelStub(responses=[CustomException()])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup request
+ threat_types = []
+
+ with pytest.raises(CustomException):
+ client.search_hashes(threat_types)
+
+ def test_create_submission(self):
+ # Setup Expected Response
+ uri = "uri116076"
+ expected_response = {"uri": uri}
+ expected_response = webrisk_pb2.Submission(**expected_response)
+
+ # Mock the API response
+ channel = ChannelStub(responses=[expected_response])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup Request
+ parent = client.project_path("[PROJECT]")
+ submission = {}
+
+ response = client.create_submission(parent, submission)
+ assert expected_response == response
+
+ assert len(channel.requests) == 1
+ expected_request = webrisk_pb2.CreateSubmissionRequest(
+ parent=parent, submission=submission
+ )
+ actual_request = channel.requests[0][1]
+ assert expected_request == actual_request
+
+ def test_create_submission_exception(self):
+ # Mock the API response
+ channel = ChannelStub(responses=[CustomException()])
+ patch = mock.patch("google.api_core.grpc_helpers.create_channel")
+ with patch as create_channel:
+ create_channel.return_value = channel
+ client = webrisk_v1.WebRiskServiceClient()
+
+ # Setup request
+ parent = client.project_path("[PROJECT]")
+ submission = {}
+
+ with pytest.raises(CustomException):
+ client.create_submission(parent, submission)