google-cloud-webrisk - Class Google::Cloud::Webrisk::V1beta1::WebRiskServiceV1Beta1Client (v0.6.1)

Reference documentation and code samples for the google-cloud-webrisk class Google::Cloud::Webrisk::V1beta1::WebRiskServiceV1Beta1Client.

Web Risk v1beta1 API defines an interface to detect malicious URLs on your website and in client applications.

Inherits

  • Object

Methods

#compute_threat_list_diff

def compute_threat_list_diff(threat_type, constraints, version_token: nil, options: nil, &block) { |result, operation| ... } -> Google::Cloud::Webrisk::V1beta1::ComputeThreatListDiffResponse

Gets the most recent threat list diffs.

Parameters
  • threat_type (Google::Cloud::Webrisk::V1beta1::ThreatType) — The ThreatList to update.
  • constraints (Google::Cloud::Webrisk::V1beta1::ComputeThreatListDiffRequest::Constraints | Hash) — Required. The constraints associated with this request. A hash of the same form as Google::Cloud::Webrisk::V1beta1::ComputeThreatListDiffRequest::Constraints can also be provided.
  • 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).
  • options (Google::Gax::CallOptions) (defaults to: nil) — Overrides the default settings for this call, e.g, timeout, retries, etc.
Yields
  • (result, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (Google::Gax::GaxError) — if the RPC is aborted.
Example
require "google/cloud/webrisk"

web_risk_service_v1_beta1_client = Google::Cloud::Webrisk.new(version: :v1beta1)

# TODO: Initialize `threat_type`:
threat_type = :THREAT_TYPE_UNSPECIFIED

# TODO: Initialize `constraints`:
constraints = {}
response = web_risk_service_v1_beta1_client.compute_threat_list_diff(threat_type, constraints)

#initialize

def initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "") -> WebRiskServiceV1Beta1Client
Parameters
  • credentials (Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc) (defaults to: nil) — Provides the means for authenticating requests made by the client. This parameter can be many types. A Google::Auth::Credentials uses a the properties of its represented keyfile for authenticating requests made by this client. A String will be treated as the path to the keyfile to be used for the construction of credentials for this client. A Hash will be treated as the contents of a keyfile to be used for the construction of credentials for this client. A GRPC::Core::Channel will be used to make calls through. A GRPC::Core::ChannelCredentials for the setting up the RPC client. The channel credentials should already be composed with a GRPC::Core::CallCredentials object. A Proc will be used as an updater_proc for the Grpc channel. The proc transforms the metadata for requests, generally, to give OAuth credentials.
  • scopes (Array<String>) (defaults to: ALL_SCOPES) — The OAuth scopes for this service. This parameter is ignored if an updater_proc is supplied.
  • client_config (Hash) (defaults to: {}) — A Hash for call options for each method. See Google::Gax#construct_settings for the structure of this data. Falls back to the default config if not specified or the specified config is missing data points.
  • timeout (Numeric) (defaults to: DEFAULT_TIMEOUT) — The default timeout, in seconds, for calls made through this client.
  • metadata (Hash) (defaults to: nil) — Default metadata to be sent with each request. This can be overridden on a per call basis.
  • service_address (String) (defaults to: nil) — Override for the service hostname, or nil to leave as the default.
  • service_port (Integer) (defaults to: nil) — Override for the service port, or nil to leave as the default.
  • exception_transformer (Proc) (defaults to: nil) — An optional proc that intercepts any exceptions raised during an API call to inject custom error handling.
Returns

#search_hashes

def search_hashes(threat_types, hash_prefix: nil, options: nil, &block) { |result, operation| ... } -> Google::Cloud::Webrisk::V1beta1::SearchHashesResponse

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
  • threat_types (Array<Google::Cloud::Webrisk::V1beta1::ThreatType>) — Required. The ThreatLists to search in.
  • 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.
  • options (Google::Gax::CallOptions) (defaults to: nil) — Overrides the default settings for this call, e.g, timeout, retries, etc.
Yields
  • (result, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (Google::Gax::GaxError) — if the RPC is aborted.
Example
require "google/cloud/webrisk"

web_risk_service_v1_beta1_client = Google::Cloud::Webrisk.new(version: :v1beta1)

# TODO: Initialize `threat_types`:
threat_types = []
response = web_risk_service_v1_beta1_client.search_hashes(threat_types)

#search_uris

def search_uris(uri, threat_types, options: nil, &block) { |result, operation| ... } -> Google::Cloud::Webrisk::V1beta1::SearchUrisResponse

This method is used to check whether a URI is on a given threatList.

Parameters
  • uri (String) — Required. The URI to be checked for matches.
  • threat_types (Array<Google::Cloud::Webrisk::V1beta1::ThreatType>) — Required. The ThreatLists to search in.
  • options (Google::Gax::CallOptions) (defaults to: nil) — Overrides the default settings for this call, e.g, timeout, retries, etc.
Yields
  • (result, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (Google::Gax::GaxError) — if the RPC is aborted.
Example
require "google/cloud/webrisk"

web_risk_service_v1_beta1_client = Google::Cloud::Webrisk.new(version: :v1beta1)

# TODO: Initialize `uri`:
uri = ''

# TODO: Initialize `threat_types`:
threat_types = []
response = web_risk_service_v1_beta1_client.search_uris(uri, threat_types)

Constants

SERVICE_ADDRESS

value: "webrisk.googleapis.com".freeze
The default address of the service.

DEFAULT_SERVICE_PORT

value: 443
The default port of the service.

GRPC_INTERCEPTORS

value: []
The default set of gRPC interceptors.

DEFAULT_TIMEOUT

value: 30

ALL_SCOPES

value: [ "https://www.googleapis.com/auth/cloud-platform"; ].freeze
The scopes needed to make gRPC calls to all of the methods defined in this service.