webrisk

package
v0.59.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package webrisk is an auto-generated package for the Web Risk API.

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit godoc.org/cloud.google.com/go.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type CallOptions

type CallOptions struct {
	ComputeThreatListDiff []gax.CallOption
	SearchUris            []gax.CallOption
	SearchHashes          []gax.CallOption
	CreateSubmission      []gax.CallOption
}

CallOptions contains the retry settings for each method of Client.

type Client

type Client struct {

	// The call options for this service.
	CallOptions *CallOptions
	// contains filtered or unexported fields
}

Client is a client for interacting with Web Risk API.

Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewClient

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

NewClient creates a new web risk service client.

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

Example
package main

import (
	"context"

	webrisk "cloud.google.com/go/webrisk/apiv1"
)

func main() {
	ctx := context.Background()
	c, err := webrisk.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use client.
	_ = c
}
Output:

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) ComputeThreatListDiff

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

Example
package main

import (
	"context"

	webrisk "cloud.google.com/go/webrisk/apiv1"
	webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"
)

func main() {
	// import webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"

	ctx := context.Background()
	c, err := webrisk.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &webriskpb.ComputeThreatListDiffRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.ComputeThreatListDiff(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) Connection

func (c *Client) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*Client) CreateSubmission

func (c *Client) CreateSubmission(ctx context.Context, req *webriskpb.CreateSubmissionRequest, opts ...gax.CallOption) (*webriskpb.Submission, error)

CreateSubmission 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 (at https://support.google.com/webmasters/answer/6350487/) in order to protect users that could get exposed to this threat in the future. Only projects with CREATE_SUBMISSION_USERS visibility can use this method.

Example
package main

import (
	"context"

	webrisk "cloud.google.com/go/webrisk/apiv1"
	webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"
)

func main() {
	// import webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"

	ctx := context.Background()
	c, err := webrisk.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &webriskpb.CreateSubmissionRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateSubmission(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) SearchHashes

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

Example
package main

import (
	"context"

	webrisk "cloud.google.com/go/webrisk/apiv1"
	webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"
)

func main() {
	// import webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"

	ctx := context.Background()
	c, err := webrisk.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &webriskpb.SearchHashesRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.SearchHashes(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) SearchUris

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

Example
package main

import (
	"context"

	webrisk "cloud.google.com/go/webrisk/apiv1"
	webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"
)

func main() {
	// import webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1"

	ctx := context.Background()
	c, err := webrisk.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}

	req := &webriskpb.SearchUrisRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.SearchUris(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL