google-apis-webrisk_v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module WebriskV1
18
+ # Version of the google-apis-webrisk_v1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.2"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20210220"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,293 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module WebriskV1
24
+
25
+ class GoogleCloudWebriskV1ComputeThreatListDiffResponse
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class GoogleCloudWebriskV1RawHashes
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class GoogleCloudWebriskV1RawIndices
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class GoogleCloudWebriskV1RiceDeltaEncoding
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class GoogleCloudWebriskV1SearchHashesResponse
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class GoogleCloudWebriskV1SearchHashesResponseThreatHash
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class GoogleCloudWebriskV1SearchUrisResponse
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class GoogleCloudWebriskV1SearchUrisResponseThreatUri
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class GoogleCloudWebriskV1Submission
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class GoogleCloudWebriskV1SubmitUriRequest
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class GoogleCloudWebriskV1ThreatEntryAdditions
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class GoogleCloudWebriskV1ThreatEntryRemovals
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class GoogleLongrunningCancelOperationRequest
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class GoogleLongrunningListOperationsResponse
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class GoogleLongrunningOperation
116
+ class Representation < Google::Apis::Core::JsonRepresentation; end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ class GoogleProtobufEmpty
122
+ class Representation < Google::Apis::Core::JsonRepresentation; end
123
+
124
+ include Google::Apis::Core::JsonObjectSupport
125
+ end
126
+
127
+ class GoogleRpcStatus
128
+ class Representation < Google::Apis::Core::JsonRepresentation; end
129
+
130
+ include Google::Apis::Core::JsonObjectSupport
131
+ end
132
+
133
+ class GoogleCloudWebriskV1ComputeThreatListDiffResponse
134
+ # @private
135
+ class Representation < Google::Apis::Core::JsonRepresentation
136
+ property :additions, as: 'additions', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1ThreatEntryAdditions, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1ThreatEntryAdditions::Representation
137
+
138
+ property :checksum, as: 'checksum', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum::Representation
139
+
140
+ property :new_version_token, :base64 => true, as: 'newVersionToken'
141
+ property :recommended_next_diff, as: 'recommendedNextDiff'
142
+ property :removals, as: 'removals', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1ThreatEntryRemovals, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1ThreatEntryRemovals::Representation
143
+
144
+ property :response_type, as: 'responseType'
145
+ end
146
+ end
147
+
148
+ class GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum
149
+ # @private
150
+ class Representation < Google::Apis::Core::JsonRepresentation
151
+ property :sha256, :base64 => true, as: 'sha256'
152
+ end
153
+ end
154
+
155
+ class GoogleCloudWebriskV1RawHashes
156
+ # @private
157
+ class Representation < Google::Apis::Core::JsonRepresentation
158
+ property :prefix_size, as: 'prefixSize'
159
+ property :raw_hashes, :base64 => true, as: 'rawHashes'
160
+ end
161
+ end
162
+
163
+ class GoogleCloudWebriskV1RawIndices
164
+ # @private
165
+ class Representation < Google::Apis::Core::JsonRepresentation
166
+ collection :indices, as: 'indices'
167
+ end
168
+ end
169
+
170
+ class GoogleCloudWebriskV1RiceDeltaEncoding
171
+ # @private
172
+ class Representation < Google::Apis::Core::JsonRepresentation
173
+ property :encoded_data, :base64 => true, as: 'encodedData'
174
+ property :entry_count, as: 'entryCount'
175
+ property :first_value, :numeric_string => true, as: 'firstValue'
176
+ property :rice_parameter, as: 'riceParameter'
177
+ end
178
+ end
179
+
180
+ class GoogleCloudWebriskV1SearchHashesResponse
181
+ # @private
182
+ class Representation < Google::Apis::Core::JsonRepresentation
183
+ property :negative_expire_time, as: 'negativeExpireTime'
184
+ collection :threats, as: 'threats', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponseThreatHash, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponseThreatHash::Representation
185
+
186
+ end
187
+ end
188
+
189
+ class GoogleCloudWebriskV1SearchHashesResponseThreatHash
190
+ # @private
191
+ class Representation < Google::Apis::Core::JsonRepresentation
192
+ property :expire_time, as: 'expireTime'
193
+ property :hash_prop, :base64 => true, as: 'hash'
194
+ collection :threat_types, as: 'threatTypes'
195
+ end
196
+ end
197
+
198
+ class GoogleCloudWebriskV1SearchUrisResponse
199
+ # @private
200
+ class Representation < Google::Apis::Core::JsonRepresentation
201
+ property :threat, as: 'threat', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponseThreatUri, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponseThreatUri::Representation
202
+
203
+ end
204
+ end
205
+
206
+ class GoogleCloudWebriskV1SearchUrisResponseThreatUri
207
+ # @private
208
+ class Representation < Google::Apis::Core::JsonRepresentation
209
+ property :expire_time, as: 'expireTime'
210
+ collection :threat_types, as: 'threatTypes'
211
+ end
212
+ end
213
+
214
+ class GoogleCloudWebriskV1Submission
215
+ # @private
216
+ class Representation < Google::Apis::Core::JsonRepresentation
217
+ collection :threat_types, as: 'threatTypes'
218
+ property :uri, as: 'uri'
219
+ end
220
+ end
221
+
222
+ class GoogleCloudWebriskV1SubmitUriRequest
223
+ # @private
224
+ class Representation < Google::Apis::Core::JsonRepresentation
225
+ property :submission, as: 'submission', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission::Representation
226
+
227
+ end
228
+ end
229
+
230
+ class GoogleCloudWebriskV1ThreatEntryAdditions
231
+ # @private
232
+ class Representation < Google::Apis::Core::JsonRepresentation
233
+ collection :raw_hashes, as: 'rawHashes', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1RawHashes, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1RawHashes::Representation
234
+
235
+ property :rice_hashes, as: 'riceHashes', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1RiceDeltaEncoding, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1RiceDeltaEncoding::Representation
236
+
237
+ end
238
+ end
239
+
240
+ class GoogleCloudWebriskV1ThreatEntryRemovals
241
+ # @private
242
+ class Representation < Google::Apis::Core::JsonRepresentation
243
+ property :raw_indices, as: 'rawIndices', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1RawIndices, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1RawIndices::Representation
244
+
245
+ property :rice_indices, as: 'riceIndices', class: Google::Apis::WebriskV1::GoogleCloudWebriskV1RiceDeltaEncoding, decorator: Google::Apis::WebriskV1::GoogleCloudWebriskV1RiceDeltaEncoding::Representation
246
+
247
+ end
248
+ end
249
+
250
+ class GoogleLongrunningCancelOperationRequest
251
+ # @private
252
+ class Representation < Google::Apis::Core::JsonRepresentation
253
+ end
254
+ end
255
+
256
+ class GoogleLongrunningListOperationsResponse
257
+ # @private
258
+ class Representation < Google::Apis::Core::JsonRepresentation
259
+ property :next_page_token, as: 'nextPageToken'
260
+ collection :operations, as: 'operations', class: Google::Apis::WebriskV1::GoogleLongrunningOperation, decorator: Google::Apis::WebriskV1::GoogleLongrunningOperation::Representation
261
+
262
+ end
263
+ end
264
+
265
+ class GoogleLongrunningOperation
266
+ # @private
267
+ class Representation < Google::Apis::Core::JsonRepresentation
268
+ property :done, as: 'done'
269
+ property :error, as: 'error', class: Google::Apis::WebriskV1::GoogleRpcStatus, decorator: Google::Apis::WebriskV1::GoogleRpcStatus::Representation
270
+
271
+ hash :metadata, as: 'metadata'
272
+ property :name, as: 'name'
273
+ hash :response, as: 'response'
274
+ end
275
+ end
276
+
277
+ class GoogleProtobufEmpty
278
+ # @private
279
+ class Representation < Google::Apis::Core::JsonRepresentation
280
+ end
281
+ end
282
+
283
+ class GoogleRpcStatus
284
+ # @private
285
+ class Representation < Google::Apis::Core::JsonRepresentation
286
+ property :code, as: 'code'
287
+ collection :details, as: 'details'
288
+ property :message, as: 'message'
289
+ end
290
+ end
291
+ end
292
+ end
293
+ end
@@ -0,0 +1,425 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module WebriskV1
23
+ # Web Risk API
24
+ #
25
+ #
26
+ #
27
+ # @example
28
+ # require 'google/apis/webrisk_v1'
29
+ #
30
+ # Webrisk = Google::Apis::WebriskV1 # Alias the module
31
+ # service = Webrisk::WebRiskService.new
32
+ #
33
+ # @see https://cloud.google.com/web-risk/
34
+ class WebRiskService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://webrisk.googleapis.com/', '',
47
+ client_name: 'google-apis-webrisk_v1',
48
+ client_version: Google::Apis::WebriskV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Gets the full hashes that match the requested hash prefix. This is used after
53
+ # a hash prefix is looked up in a threatList and there is a match. The client
54
+ # side threatList only holds partial hashes so the client must query this method
55
+ # to determine if there is a full hash match of a threat.
56
+ # @param [String] hash_prefix
57
+ # A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash.
58
+ # For JSON requests, this field is base64-encoded. Note that if this parameter
59
+ # is provided by a URI, it must be encoded using the web safe base64 variant (
60
+ # RFC 4648).
61
+ # @param [Array<String>, String] threat_types
62
+ # Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
63
+ # @param [String] fields
64
+ # Selector specifying which fields to include in a partial response.
65
+ # @param [String] quota_user
66
+ # Available to use for quota purposes for server-side applications. Can be any
67
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
68
+ # @param [Google::Apis::RequestOptions] options
69
+ # Request-specific options
70
+ #
71
+ # @yield [result, err] Result & error if block supplied
72
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponse] parsed result object
73
+ # @yieldparam err [StandardError] error object if request failed
74
+ #
75
+ # @return [Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponse]
76
+ #
77
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
78
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
79
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
80
+ def search_hashes(hash_prefix: nil, threat_types: nil, fields: nil, quota_user: nil, options: nil, &block)
81
+ command = make_simple_command(:get, 'v1/hashes:search', options)
82
+ command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponse::Representation
83
+ command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponse
84
+ command.query['hashPrefix'] = hash_prefix unless hash_prefix.nil?
85
+ command.query['threatTypes'] = threat_types unless threat_types.nil?
86
+ command.query['fields'] = fields unless fields.nil?
87
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
88
+ execute_or_queue_command(command, &block)
89
+ end
90
+
91
+ # Starts asynchronous cancellation on a long-running operation. The server makes
92
+ # a best effort to cancel the operation, but success is not guaranteed. If the
93
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
94
+ # Clients can use Operations.GetOperation or other methods to check whether the
95
+ # cancellation succeeded or whether the operation completed despite cancellation.
96
+ # On successful cancellation, the operation is not deleted; instead, it becomes
97
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
98
+ # corresponding to `Code.CANCELLED`.
99
+ # @param [String] name
100
+ # The name of the operation resource to be cancelled.
101
+ # @param [Google::Apis::WebriskV1::GoogleLongrunningCancelOperationRequest] google_longrunning_cancel_operation_request_object
102
+ # @param [String] fields
103
+ # Selector specifying which fields to include in a partial response.
104
+ # @param [String] quota_user
105
+ # Available to use for quota purposes for server-side applications. Can be any
106
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
107
+ # @param [Google::Apis::RequestOptions] options
108
+ # Request-specific options
109
+ #
110
+ # @yield [result, err] Result & error if block supplied
111
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleProtobufEmpty] parsed result object
112
+ # @yieldparam err [StandardError] error object if request failed
113
+ #
114
+ # @return [Google::Apis::WebriskV1::GoogleProtobufEmpty]
115
+ #
116
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
117
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
118
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
119
+ def cancel_operation(name, google_longrunning_cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
120
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
121
+ command.request_representation = Google::Apis::WebriskV1::GoogleLongrunningCancelOperationRequest::Representation
122
+ command.request_object = google_longrunning_cancel_operation_request_object
123
+ command.response_representation = Google::Apis::WebriskV1::GoogleProtobufEmpty::Representation
124
+ command.response_class = Google::Apis::WebriskV1::GoogleProtobufEmpty
125
+ command.params['name'] = name unless name.nil?
126
+ command.query['fields'] = fields unless fields.nil?
127
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
128
+ execute_or_queue_command(command, &block)
129
+ end
130
+
131
+ # Deletes a long-running operation. This method indicates that the client is no
132
+ # longer interested in the operation result. It does not cancel the operation.
133
+ # If the server doesn't support this method, it returns `google.rpc.Code.
134
+ # UNIMPLEMENTED`.
135
+ # @param [String] name
136
+ # The name of the operation resource to be deleted.
137
+ # @param [String] fields
138
+ # Selector specifying which fields to include in a partial response.
139
+ # @param [String] quota_user
140
+ # Available to use for quota purposes for server-side applications. Can be any
141
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
142
+ # @param [Google::Apis::RequestOptions] options
143
+ # Request-specific options
144
+ #
145
+ # @yield [result, err] Result & error if block supplied
146
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleProtobufEmpty] parsed result object
147
+ # @yieldparam err [StandardError] error object if request failed
148
+ #
149
+ # @return [Google::Apis::WebriskV1::GoogleProtobufEmpty]
150
+ #
151
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
152
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
153
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
154
+ def delete_operation(name, fields: nil, quota_user: nil, options: nil, &block)
155
+ command = make_simple_command(:delete, 'v1/{+name}', options)
156
+ command.response_representation = Google::Apis::WebriskV1::GoogleProtobufEmpty::Representation
157
+ command.response_class = Google::Apis::WebriskV1::GoogleProtobufEmpty
158
+ command.params['name'] = name unless name.nil?
159
+ command.query['fields'] = fields unless fields.nil?
160
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
161
+ execute_or_queue_command(command, &block)
162
+ end
163
+
164
+ # Gets the latest state of a long-running operation. Clients can use this method
165
+ # to poll the operation result at intervals as recommended by the API service.
166
+ # @param [String] name
167
+ # The name of the operation resource.
168
+ # @param [String] fields
169
+ # Selector specifying which fields to include in a partial response.
170
+ # @param [String] quota_user
171
+ # Available to use for quota purposes for server-side applications. Can be any
172
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
173
+ # @param [Google::Apis::RequestOptions] options
174
+ # Request-specific options
175
+ #
176
+ # @yield [result, err] Result & error if block supplied
177
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleLongrunningOperation] parsed result object
178
+ # @yieldparam err [StandardError] error object if request failed
179
+ #
180
+ # @return [Google::Apis::WebriskV1::GoogleLongrunningOperation]
181
+ #
182
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
183
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
184
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
185
+ def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
186
+ command = make_simple_command(:get, 'v1/{+name}', options)
187
+ command.response_representation = Google::Apis::WebriskV1::GoogleLongrunningOperation::Representation
188
+ command.response_class = Google::Apis::WebriskV1::GoogleLongrunningOperation
189
+ command.params['name'] = name unless name.nil?
190
+ command.query['fields'] = fields unless fields.nil?
191
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
192
+ execute_or_queue_command(command, &block)
193
+ end
194
+
195
+ # Lists operations that match the specified filter in the request. If the server
196
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
197
+ # binding allows API services to override the binding to use different resource
198
+ # name schemes, such as `users/*/operations`. To override the binding, API
199
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
200
+ # service configuration. For backwards compatibility, the default name includes
201
+ # the operations collection id, however overriding users must ensure the name
202
+ # binding is the parent resource, without the operations collection id.
203
+ # @param [String] name
204
+ # The name of the operation's parent resource.
205
+ # @param [String] filter
206
+ # The standard list filter.
207
+ # @param [Fixnum] page_size
208
+ # The standard list page size.
209
+ # @param [String] page_token
210
+ # The standard list page token.
211
+ # @param [String] fields
212
+ # Selector specifying which fields to include in a partial response.
213
+ # @param [String] quota_user
214
+ # Available to use for quota purposes for server-side applications. Can be any
215
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
216
+ # @param [Google::Apis::RequestOptions] options
217
+ # Request-specific options
218
+ #
219
+ # @yield [result, err] Result & error if block supplied
220
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleLongrunningListOperationsResponse] parsed result object
221
+ # @yieldparam err [StandardError] error object if request failed
222
+ #
223
+ # @return [Google::Apis::WebriskV1::GoogleLongrunningListOperationsResponse]
224
+ #
225
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
226
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
227
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
228
+ def list_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
229
+ command = make_simple_command(:get, 'v1/{+name}', options)
230
+ command.response_representation = Google::Apis::WebriskV1::GoogleLongrunningListOperationsResponse::Representation
231
+ command.response_class = Google::Apis::WebriskV1::GoogleLongrunningListOperationsResponse
232
+ command.params['name'] = name unless name.nil?
233
+ command.query['filter'] = filter unless filter.nil?
234
+ command.query['pageSize'] = page_size unless page_size.nil?
235
+ command.query['pageToken'] = page_token unless page_token.nil?
236
+ command.query['fields'] = fields unless fields.nil?
237
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
238
+ execute_or_queue_command(command, &block)
239
+ end
240
+
241
+ # Creates a Submission of a URI suspected of containing phishing content to be
242
+ # reviewed. If the result verifies the existence of malicious phishing content,
243
+ # the site will be added to the [Google's Social Engineering lists](https://
244
+ # support.google.com/webmasters/answer/6350487/) in order to protect users that
245
+ # could get exposed to this threat in the future. Only allowlisted projects can
246
+ # use this method during Early Access. Please reach out to Sales or your
247
+ # customer engineer to obtain access.
248
+ # @param [String] parent
249
+ # Required. The name of the project that is making the submission. This string
250
+ # is in the format "projects/`project_number`".
251
+ # @param [Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission] google_cloud_webrisk_v1_submission_object
252
+ # @param [String] fields
253
+ # Selector specifying which fields to include in a partial response.
254
+ # @param [String] quota_user
255
+ # Available to use for quota purposes for server-side applications. Can be any
256
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
257
+ # @param [Google::Apis::RequestOptions] options
258
+ # Request-specific options
259
+ #
260
+ # @yield [result, err] Result & error if block supplied
261
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission] parsed result object
262
+ # @yieldparam err [StandardError] error object if request failed
263
+ #
264
+ # @return [Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission]
265
+ #
266
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
267
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
268
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
269
+ def create_project_submission(parent, google_cloud_webrisk_v1_submission_object = nil, fields: nil, quota_user: nil, options: nil, &block)
270
+ command = make_simple_command(:post, 'v1/{+parent}/submissions', options)
271
+ command.request_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission::Representation
272
+ command.request_object = google_cloud_webrisk_v1_submission_object
273
+ command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission::Representation
274
+ command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission
275
+ command.params['parent'] = parent unless parent.nil?
276
+ command.query['fields'] = fields unless fields.nil?
277
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
278
+ execute_or_queue_command(command, &block)
279
+ end
280
+
281
+ # Submits a URI suspected of containing malicious content to be reviewed.
282
+ # Returns a google.longrunning.Operation which, once the review is complete, is
283
+ # updated with its result. You can use the [Pub/Sub API] (https://cloud.google.
284
+ # com/pubsub) to receive notifications for the returned Operation. If the result
285
+ # verifies the existence of malicious content, the site will be added to the [
286
+ # Google's Social Engineering lists] (https://support.google.com/webmasters/
287
+ # answer/6350487/) in order to protect users that could get exposed to this
288
+ # threat in the future. Only allowlisted projects can use this method during
289
+ # Early Access. Please reach out to Sales or your customer engineer to obtain
290
+ # access.
291
+ # @param [String] parent
292
+ # Required. The name of the project that is making the submission. This string
293
+ # is in the format "projects/`project_number`".
294
+ # @param [Google::Apis::WebriskV1::GoogleCloudWebriskV1SubmitUriRequest] google_cloud_webrisk_v1_submit_uri_request_object
295
+ # @param [String] fields
296
+ # Selector specifying which fields to include in a partial response.
297
+ # @param [String] quota_user
298
+ # Available to use for quota purposes for server-side applications. Can be any
299
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
300
+ # @param [Google::Apis::RequestOptions] options
301
+ # Request-specific options
302
+ #
303
+ # @yield [result, err] Result & error if block supplied
304
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleLongrunningOperation] parsed result object
305
+ # @yieldparam err [StandardError] error object if request failed
306
+ #
307
+ # @return [Google::Apis::WebriskV1::GoogleLongrunningOperation]
308
+ #
309
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
310
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
311
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
312
+ def submit_project_uri(parent, google_cloud_webrisk_v1_submit_uri_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
313
+ command = make_simple_command(:post, 'v1/{+parent}/uris:submit', options)
314
+ command.request_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1SubmitUriRequest::Representation
315
+ command.request_object = google_cloud_webrisk_v1_submit_uri_request_object
316
+ command.response_representation = Google::Apis::WebriskV1::GoogleLongrunningOperation::Representation
317
+ command.response_class = Google::Apis::WebriskV1::GoogleLongrunningOperation
318
+ command.params['parent'] = parent unless parent.nil?
319
+ command.query['fields'] = fields unless fields.nil?
320
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
321
+ execute_or_queue_command(command, &block)
322
+ end
323
+
324
+ # Gets the most recent threat list diffs. These diffs should be applied to a
325
+ # local database of hashes to keep it up-to-date. If the local database is empty
326
+ # or excessively out-of-date, a complete snapshot of the database will be
327
+ # returned. This Method only updates a single ThreatList at a time. To update
328
+ # multiple ThreatList databases, this method needs to be called once for each
329
+ # list.
330
+ # @param [Fixnum] constraints_max_database_entries
331
+ # Sets the maximum number of entries that the client is willing to have in the
332
+ # local database. This should be a power of 2 between 2**10 and 2**20. If zero,
333
+ # no database size limit is set.
334
+ # @param [Fixnum] constraints_max_diff_entries
335
+ # The maximum size in number of entries. The diff will not contain more entries
336
+ # than this value. This should be a power of 2 between 2**10 and 2**20. If zero,
337
+ # no diff size limit is set.
338
+ # @param [Array<String>, String] constraints_supported_compressions
339
+ # The compression types supported by the client.
340
+ # @param [String] threat_type
341
+ # Required. The threat list to update. Only a single ThreatType should be
342
+ # specified per request. If you want to handle multiple ThreatTypes, you must
343
+ # make one request per ThreatType.
344
+ # @param [String] version_token
345
+ # The current version token of the client for the requested list (the client
346
+ # version that was received from the last successful diff). If the client does
347
+ # not have a version token (this is the first time calling ComputeThreatListDiff)
348
+ # , this may be left empty and a full database snapshot will be returned.
349
+ # @param [String] fields
350
+ # Selector specifying which fields to include in a partial response.
351
+ # @param [String] quota_user
352
+ # Available to use for quota purposes for server-side applications. Can be any
353
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
354
+ # @param [Google::Apis::RequestOptions] options
355
+ # Request-specific options
356
+ #
357
+ # @yield [result, err] Result & error if block supplied
358
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponse] parsed result object
359
+ # @yieldparam err [StandardError] error object if request failed
360
+ #
361
+ # @return [Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponse]
362
+ #
363
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
364
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
365
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
366
+ def compute_threat_list_diff(constraints_max_database_entries: nil, constraints_max_diff_entries: nil, constraints_supported_compressions: nil, threat_type: nil, version_token: nil, fields: nil, quota_user: nil, options: nil, &block)
367
+ command = make_simple_command(:get, 'v1/threatLists:computeDiff', options)
368
+ command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponse::Representation
369
+ command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponse
370
+ command.query['constraints.maxDatabaseEntries'] = constraints_max_database_entries unless constraints_max_database_entries.nil?
371
+ command.query['constraints.maxDiffEntries'] = constraints_max_diff_entries unless constraints_max_diff_entries.nil?
372
+ command.query['constraints.supportedCompressions'] = constraints_supported_compressions unless constraints_supported_compressions.nil?
373
+ command.query['threatType'] = threat_type unless threat_type.nil?
374
+ command.query['versionToken'] = version_token unless version_token.nil?
375
+ command.query['fields'] = fields unless fields.nil?
376
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
377
+ execute_or_queue_command(command, &block)
378
+ end
379
+
380
+ # This method is used to check whether a URI is on a given threatList. Multiple
381
+ # threatLists may be searched in a single query. The response will list all
382
+ # requested threatLists the URI was found to match. If the URI is not found on
383
+ # any of the requested ThreatList an empty response will be returned.
384
+ # @param [Array<String>, String] threat_types
385
+ # Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
386
+ # @param [String] uri
387
+ # Required. The URI to be checked for matches.
388
+ # @param [String] fields
389
+ # Selector specifying which fields to include in a partial response.
390
+ # @param [String] quota_user
391
+ # Available to use for quota purposes for server-side applications. Can be any
392
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
393
+ # @param [Google::Apis::RequestOptions] options
394
+ # Request-specific options
395
+ #
396
+ # @yield [result, err] Result & error if block supplied
397
+ # @yieldparam result [Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponse] parsed result object
398
+ # @yieldparam err [StandardError] error object if request failed
399
+ #
400
+ # @return [Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponse]
401
+ #
402
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
403
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
404
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
405
+ def search_uris(threat_types: nil, uri: nil, fields: nil, quota_user: nil, options: nil, &block)
406
+ command = make_simple_command(:get, 'v1/uris:search', options)
407
+ command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponse::Representation
408
+ command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponse
409
+ command.query['threatTypes'] = threat_types unless threat_types.nil?
410
+ command.query['uri'] = uri unless uri.nil?
411
+ command.query['fields'] = fields unless fields.nil?
412
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
413
+ execute_or_queue_command(command, &block)
414
+ end
415
+
416
+ protected
417
+
418
+ def apply_command_defaults(command)
419
+ command.query['key'] = key unless key.nil?
420
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
421
+ end
422
+ end
423
+ end
424
+ end
425
+ end