Class: Google::Apis::WebriskV1::WebRiskService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/webrisk_v1/service.rb

Overview

Web Risk API

Examples:

require 'google/apis/webrisk_v1'

Webrisk = Google::Apis::WebriskV1 # Alias the module
service = Webrisk::WebRiskService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://webrisk.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWebRiskService

Returns a new instance of WebRiskService.



47
48
49
50
51
52
# File 'lib/google/apis/webrisk_v1/service.rb', line 47

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-webrisk_v1',
        client_version: Google::Apis::WebriskV1::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



40
41
42
# File 'lib/google/apis/webrisk_v1/service.rb', line 40

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



45
46
47
# File 'lib/google/apis/webrisk_v1/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#cancel_project_operation(name, google_longrunning_cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleProtobufEmpty

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

Parameters:

  • name (String)

    The name of the operation resource to be cancelled.

  • google_longrunning_cancel_operation_request_object (Google::Apis::WebriskV1::GoogleLongrunningCancelOperationRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



121
122
123
124
125
126
127
128
129
130
131
# File 'lib/google/apis/webrisk_v1/service.rb', line 121

def cancel_project_operation(name, google_longrunning_cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+name}:cancel', options)
  command.request_representation = Google::Apis::WebriskV1::GoogleLongrunningCancelOperationRequest::Representation
  command.request_object = google_longrunning_cancel_operation_request_object
  command.response_representation = Google::Apis::WebriskV1::GoogleProtobufEmpty::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleProtobufEmpty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#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) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponse

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.

Parameters:

  • constraints_max_database_entries (Fixnum) (defaults to: nil)

    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.

  • constraints_max_diff_entries (Fixnum) (defaults to: nil)

    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.

  • constraints_supported_compressions (Array<String>, String) (defaults to: nil)

    The compression types supported by the client.

  • threat_type (String) (defaults to: nil)

    Required. The threat list to update. Only a single ThreatType should be specified per request. If you want to handle multiple ThreatTypes, you must make one request per ThreatType.

  • version_token (String) (defaults to: nil)

    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.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/google/apis/webrisk_v1/service.rb', line 319

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)
  command = make_simple_command(:get, 'v1/threatLists:computeDiff', options)
  command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponse::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1ComputeThreatListDiffResponse
  command.query['constraints.maxDatabaseEntries'] = constraints_max_database_entries unless constraints_max_database_entries.nil?
  command.query['constraints.maxDiffEntries'] = constraints_max_diff_entries unless constraints_max_diff_entries.nil?
  command.query['constraints.supportedCompressions'] = constraints_supported_compressions unless constraints_supported_compressions.nil?
  command.query['threatType'] = threat_type unless threat_type.nil?
  command.query['versionToken'] = version_token unless version_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#create_project_submission(parent, google_cloud_webrisk_v1_submission_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission

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 allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters:

  • parent (String)

    Required. The name of the project that is making the submission. This string is in the format "projects/project_number".

  • google_cloud_webrisk_v1_submission_object (Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



265
266
267
268
269
270
271
272
273
274
275
# File 'lib/google/apis/webrisk_v1/service.rb', line 265

def create_project_submission(parent, google_cloud_webrisk_v1_submission_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/submissions', options)
  command.request_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission::Representation
  command.request_object = google_cloud_webrisk_v1_submission_object
  command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1Submission
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_project_operation(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleProtobufEmpty

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code. UNIMPLEMENTED.

Parameters:

  • name (String)

    The name of the operation resource to be deleted.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



156
157
158
159
160
161
162
163
164
# File 'lib/google/apis/webrisk_v1/service.rb', line 156

def delete_project_operation(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v1/{+name}', options)
  command.response_representation = Google::Apis::WebriskV1::GoogleProtobufEmpty::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleProtobufEmpty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_operation(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleLongrunningOperation

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters:

  • name (String)

    The name of the operation resource.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



187
188
189
190
191
192
193
194
195
# File 'lib/google/apis/webrisk_v1/service.rb', line 187

def get_project_operation(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::WebriskV1::GoogleLongrunningOperation::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleLongrunningOperation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_project_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleLongrunningListOperationsResponse

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.

Parameters:

  • name (String)

    The name of the operation's parent resource.

  • filter (String) (defaults to: nil)

    The standard list filter.

  • page_size (Fixnum) (defaults to: nil)

    The standard list page size.

  • page_token (String) (defaults to: nil)

    The standard list page token.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/google/apis/webrisk_v1/service.rb', line 224

def list_project_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}/operations', options)
  command.response_representation = Google::Apis::WebriskV1::GoogleLongrunningListOperationsResponse::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleLongrunningListOperationsResponse
  command.params['name'] = name unless name.nil?
  command.query['filter'] = filter unless filter.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#search_hashes(hash_prefix: nil, threat_types: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponse

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.

Parameters:

  • hash_prefix (String) (defaults to: nil)

    A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded. Note that if this parameter is provided by a URI, it must be encoded using the web safe base64 variant ( RFC 4648).

  • threat_types (Array<String>, String) (defaults to: nil)

    Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



82
83
84
85
86
87
88
89
90
91
# File 'lib/google/apis/webrisk_v1/service.rb', line 82

def search_hashes(hash_prefix: nil, threat_types: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/hashes:search', options)
  command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponse::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchHashesResponse
  command.query['hashPrefix'] = hash_prefix unless hash_prefix.nil?
  command.query['threatTypes'] = threat_types unless threat_types.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#search_uris(threat_types: nil, uri: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponse

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.

Parameters:

  • threat_types (Array<String>, String) (defaults to: nil)

    Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

  • uri (String) (defaults to: nil)

    Required. The URI to be checked for matches.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



358
359
360
361
362
363
364
365
366
367
# File 'lib/google/apis/webrisk_v1/service.rb', line 358

def search_uris(threat_types: nil, uri: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/uris:search', options)
  command.response_representation = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponse::Representation
  command.response_class = Google::Apis::WebriskV1::GoogleCloudWebriskV1SearchUrisResponse
  command.query['threatTypes'] = threat_types unless threat_types.nil?
  command.query['uri'] = uri unless uri.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end