As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Webrisk v1beta1 API

class google.cloud.webrisk_v1beta1.types.CompressionType(value)[source]

Bases: proto.enums.Enum

The ways in which threat entry sets can be compressed.

Values:
COMPRESSION_TYPE_UNSPECIFIED (0):

Unknown.

RAW (1):

Raw, uncompressed data.

RICE (2):

Rice-Golomb encoded data.

class google.cloud.webrisk_v1beta1.types.ComputeThreatListDiffRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes an API diff request.

threat_type

The ThreatList to update.

Type

google.cloud.webrisk_v1beta1.types.ThreatType

version_token

The current version token of the client for the requested list (the client version that was received from the last successful diff).

Type

bytes

constraints

Required. The constraints associated with this request.

Type

google.cloud.webrisk_v1beta1.types.ComputeThreatListDiffRequest.Constraints

class Constraints(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The constraints for this diff.

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 210 and 220. If zero, no diff size limit is set.

Type

int

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 210 and 220. If zero, no database size limit is set.

Type

int

supported_compressions

The compression types supported by the client.

Type

MutableSequence[google.cloud.webrisk_v1beta1.types.CompressionType]

class google.cloud.webrisk_v1beta1.types.ComputeThreatListDiffResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

response_type

The type of response. This may indicate that an action must be taken by the client when the response is received.

Type

google.cloud.webrisk_v1beta1.types.ComputeThreatListDiffResponse.ResponseType

additions

A set of entries to add to a local threat type’s list.

Type

google.cloud.webrisk_v1beta1.types.ThreatEntryAdditions

removals

A set of entries to remove from a local threat type’s list. This field may be empty.

Type

google.cloud.webrisk_v1beta1.types.ThreatEntryRemovals

new_version_token

The new opaque client version token.

Type

bytes

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 disregard this diff and retry later.

Type

google.cloud.webrisk_v1beta1.types.ComputeThreatListDiffResponse.Checksum

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.

Type

google.protobuf.timestamp_pb2.Timestamp

class Checksum(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The expected state of a client’s local database.

sha256

The SHA256 hash of the client state; that is, of the sorted list of all hashes present in the database.

Type

bytes

class ResponseType(value)[source]

Bases: proto.enums.Enum

The type of response sent to the client.

Values:
RESPONSE_TYPE_UNSPECIFIED (0):

Unknown.

DIFF (1):

Partial updates are applied to the client’s existing local database.

RESET (2):

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.

class google.cloud.webrisk_v1beta1.types.RawHashes(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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.

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).

Type

int

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.

Type

bytes

class google.cloud.webrisk_v1beta1.types.RawIndices(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A set of raw indices to remove from a local list.

indices

The indices to remove from a lexicographically-sorted local list.

Type

MutableSequence[int]

class google.cloud.webrisk_v1beta1.types.RiceDeltaEncoding(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or compressed removal indices.

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.

Type

int

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.

Type

int

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.

Type

int

encoded_data

The encoded deltas that are encoded using the Golomb-Rice coder.

Type

bytes

class google.cloud.webrisk_v1beta1.types.SearchHashesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to return full hashes matched by the provided hash prefixes.

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.

Type

bytes

threat_types

Required. The ThreatLists to search in.

Type

MutableSequence[google.cloud.webrisk_v1beta1.types.ThreatType]

class google.cloud.webrisk_v1beta1.types.SearchHashesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

threats

The full hashes that matched the requested prefixes. The hash will be populated in the key.

Type

MutableSequence[google.cloud.webrisk_v1beta1.types.SearchHashesResponse.ThreatHash]

negative_expire_time

For requested entities that did not match the threat list, how long to cache the response until.

Type

google.protobuf.timestamp_pb2.Timestamp

class ThreatHash(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains threat information on a matching hash.

threat_types

The ThreatList this threat belongs to. This must contain at least one entry.

Type

MutableSequence[google.cloud.webrisk_v1beta1.types.ThreatType]

hash_

A 32 byte SHA256 hash. This field is in binary format. For JSON requests, hashes are base64-encoded.

Type

bytes

expire_time

The cache lifetime for the returned match. Clients must not cache this response past this timestamp to avoid false positives.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.webrisk_v1beta1.types.SearchUrisRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to check URI entries against threatLists.

uri

Required. The URI to be checked for matches.

Type

str

threat_types

Required. The ThreatLists to search in.

Type

MutableSequence[google.cloud.webrisk_v1beta1.types.ThreatType]

class google.cloud.webrisk_v1beta1.types.SearchUrisResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

threat

The threat list matches. This may be empty if the URI is on no list.

Type

google.cloud.webrisk_v1beta1.types.SearchUrisResponse.ThreatUri

class ThreatUri(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains threat information on a matching uri.

threat_types

The ThreatList this threat belongs to.

Type

MutableSequence[google.cloud.webrisk_v1beta1.types.ThreatType]

expire_time

The cache lifetime for the returned match. Clients must not cache this response past this timestamp to avoid false positives.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.webrisk_v1beta1.types.ThreatEntryAdditions(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains the set of entries to add to a local database. May contain a combination of compressed and raw data in a single response.

raw_hashes

The raw SHA256-formatted entries. Repeated to allow returning sets of hashes with different prefix sizes.

Type

MutableSequence[google.cloud.webrisk_v1beta1.types.RawHashes]

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.

Type

google.cloud.webrisk_v1beta1.types.RiceDeltaEncoding

class google.cloud.webrisk_v1beta1.types.ThreatEntryRemovals(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains the set of entries to remove from a local database.

raw_indices

The raw removal indices for a local list.

Type

google.cloud.webrisk_v1beta1.types.RawIndices

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.

Type

google.cloud.webrisk_v1beta1.types.RiceDeltaEncoding

class google.cloud.webrisk_v1beta1.types.ThreatType(value)[source]

Bases: proto.enums.Enum

The type of threat. This maps dirrectly to the threat list a threat may belong to.

Values:
THREAT_TYPE_UNSPECIFIED (0):

Unknown.

MALWARE (1):

Malware targeting any platform.

SOCIAL_ENGINEERING (2):

Social engineering targeting any platform.

UNWANTED_SOFTWARE (3):

Unwanted software targeting any platform.