Skip to content

Commit aea0ffe

Browse files
yoshi-automationemar-kar
authored andcommitted
Make threat_types a required argument to search_hashes (via synth). (googleapis#9198)
1 parent a0bf8c7 commit aea0ffe

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

webrisk/google/cloud/webrisk_v1beta1/gapic/web_risk_service_v1_beta1_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ def search_uris(
323323

324324
def search_hashes(
325325
self,
326+
threat_types,
326327
hash_prefix=None,
327-
threat_types=None,
328328
retry=google.api_core.gapic_v1.method.DEFAULT,
329329
timeout=google.api_core.gapic_v1.method.DEFAULT,
330330
metadata=None,
@@ -338,15 +338,19 @@ def search_hashes(
338338
339339
Example:
340340
>>> from google.cloud import webrisk_v1beta1
341+
>>> from google.cloud.webrisk_v1beta1 import enums
341342
>>>
342343
>>> client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()
343344
>>>
344-
>>> response = client.search_hashes()
345+
>>> # TODO: Initialize `threat_types`:
346+
>>> threat_types = []
347+
>>>
348+
>>> response = client.search_hashes(threat_types)
345349
346350
Args:
351+
threat_types (list[~google.cloud.webrisk_v1beta1.types.ThreatType]): Required. The ThreatLists to search in.
347352
hash_prefix (bytes): A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
348353
hash. For JSON requests, this field is base64-encoded.
349-
threat_types (list[~google.cloud.webrisk_v1beta1.types.ThreatType]): Required. The ThreatLists to search in.
350354
retry (Optional[google.api_core.retry.Retry]): A retry object used
351355
to retry requests. If ``None`` is specified, requests will
352356
be retried using a default configuration.
@@ -378,7 +382,7 @@ def search_hashes(
378382
)
379383

380384
request = webrisk_pb2.SearchHashesRequest(
381-
hash_prefix=hash_prefix, threat_types=threat_types
385+
threat_types=threat_types, hash_prefix=hash_prefix
382386
)
383387
return self._inner_api_calls["search_hashes"](
384388
request, retry=retry, timeout=timeout, metadata=metadata

webrisk/synth.metadata

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
2-
"updateTime": "2019-08-06T12:51:28.182890Z",
2+
"updateTime": "2019-09-10T12:41:37.939470Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.32.1",
8-
"dockerImage": "googleapis/artman@sha256:a684d40ba9a4e15946f5f2ca6b4bd9fe301192f522e9de4fff622118775f309b"
7+
"version": "0.36.2",
8+
"dockerImage": "googleapis/artman@sha256:0e6f3a668cd68afc768ecbe08817cf6e56a0e64fcbdb1c58c3b97492d12418a1"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "e699b0cba64ffddfae39633417180f1f65875896",
16-
"internalRef": "261759677"
15+
"sha": "26e189ad03ba63591fb26eecb6aaade7ad39f57a"
1716
}
1817
},
1918
{

webrisk/tests/unit/gapic/v1beta1/test_web_risk_service_v1_beta1_client_v1beta1.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,14 @@ def test_search_hashes(self):
158158
create_channel.return_value = channel
159159
client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()
160160

161-
response = client.search_hashes()
161+
# Setup Request
162+
threat_types = []
163+
164+
response = client.search_hashes(threat_types)
162165
assert expected_response == response
163166

164167
assert len(channel.requests) == 1
165-
expected_request = webrisk_pb2.SearchHashesRequest()
168+
expected_request = webrisk_pb2.SearchHashesRequest(threat_types=threat_types)
166169
actual_request = channel.requests[0][1]
167170
assert expected_request == actual_request
168171

@@ -174,5 +177,8 @@ def test_search_hashes_exception(self):
174177
create_channel.return_value = channel
175178
client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()
176179

180+
# Setup request
181+
threat_types = []
182+
177183
with pytest.raises(CustomException):
178-
client.search_hashes()
184+
client.search_hashes(threat_types)

0 commit comments

Comments
 (0)