websecurityscanner

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Overview

Package websecurityscanner is an auto-generated package for the Web Security Scanner API.

Scans your Compute and App Engine apps for common web vulnerabilities.

Example usage

To get started with this package, create a client.

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

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

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

req := &websecurityscannerpb.CreateScanConfigRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#CreateScanConfigRequest.
}
resp, err := c.CreateScanConfig(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

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 https://pkg.go.dev/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 {
	CreateScanConfig     []gax.CallOption
	DeleteScanConfig     []gax.CallOption
	GetScanConfig        []gax.CallOption
	ListScanConfigs      []gax.CallOption
	UpdateScanConfig     []gax.CallOption
	StartScanRun         []gax.CallOption
	GetScanRun           []gax.CallOption
	ListScanRuns         []gax.CallOption
	StopScanRun          []gax.CallOption
	ListCrawledUrls      []gax.CallOption
	GetFinding           []gax.CallOption
	ListFindings         []gax.CallOption
	ListFindingTypeStats []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 Security Scanner API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Web Security Scanner Service identifies security vulnerabilities in web applications hosted on Google Cloud. It crawls your application, and attempts to exercise as many user inputs and event handlers as possible.

func NewClient

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

NewClient creates a new web security scanner client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Web Security Scanner Service identifies security vulnerabilities in web applications hosted on Google Cloud. It crawls your application, and attempts to exercise as many user inputs and event handlers as possible.

Example
package main

import (
	"context"

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

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// 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) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*Client) CreateScanConfig

CreateScanConfig creates a new ScanConfig.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.CreateScanConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#CreateScanConfigRequest.
	}
	resp, err := c.CreateScanConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) DeleteScanConfig

func (c *Client) DeleteScanConfig(ctx context.Context, req *websecurityscannerpb.DeleteScanConfigRequest, opts ...gax.CallOption) error

DeleteScanConfig deletes an existing ScanConfig and its child resources.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.DeleteScanConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#DeleteScanConfigRequest.
	}
	err = c.DeleteScanConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*Client) GetFinding

GetFinding gets a Finding.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.GetFindingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#GetFindingRequest.
	}
	resp, err := c.GetFinding(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) GetScanConfig

GetScanConfig gets a ScanConfig.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.GetScanConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#GetScanConfigRequest.
	}
	resp, err := c.GetScanConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) GetScanRun

GetScanRun gets a ScanRun.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.GetScanRunRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#GetScanRunRequest.
	}
	resp, err := c.GetScanRun(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) ListCrawledUrls

ListCrawledUrls list CrawledUrls under a given ScanRun.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
	"google.golang.org/api/iterator"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.ListCrawledUrlsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#ListCrawledUrlsRequest.
	}
	it := c.ListCrawledUrls(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*Client) ListFindingTypeStats

ListFindingTypeStats list all FindingTypeStats under a given ScanRun.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.ListFindingTypeStatsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#ListFindingTypeStatsRequest.
	}
	resp, err := c.ListFindingTypeStats(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) ListFindings

ListFindings list Findings under a given ScanRun.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
	"google.golang.org/api/iterator"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.ListFindingsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#ListFindingsRequest.
	}
	it := c.ListFindings(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*Client) ListScanConfigs

ListScanConfigs lists ScanConfigs under a given project.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
	"google.golang.org/api/iterator"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.ListScanConfigsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#ListScanConfigsRequest.
	}
	it := c.ListScanConfigs(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*Client) ListScanRuns

ListScanRuns lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
	"google.golang.org/api/iterator"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.ListScanRunsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#ListScanRunsRequest.
	}
	it := c.ListScanRuns(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*Client) StartScanRun

StartScanRun start a ScanRun according to the given ScanConfig.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.StartScanRunRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#StartScanRunRequest.
	}
	resp, err := c.StartScanRun(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) StopScanRun

StopScanRun stops a ScanRun. The stopped ScanRun is returned.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.StopScanRunRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#StopScanRunRequest.
	}
	resp, err := c.StopScanRun(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) UpdateScanConfig

UpdateScanConfig updates a ScanConfig. This method support partial update of a ScanConfig.

Example
package main

import (
	"context"

	websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"

	websecurityscannerpb "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1"
)

func main() {
	ctx := context.Background()
	c, err := websecurityscanner.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &websecurityscannerpb.UpdateScanConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#UpdateScanConfigRequest.
	}
	resp, err := c.UpdateScanConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type CrawledUrlIterator

type CrawledUrlIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*websecurityscannerpb.CrawledUrl, nextPageToken string, err error)
	// contains filtered or unexported fields
}

CrawledUrlIterator manages a stream of *websecurityscannerpb.CrawledUrl.

func (*CrawledUrlIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*CrawledUrlIterator) PageInfo

func (it *CrawledUrlIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type FindingIterator

type FindingIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*websecurityscannerpb.Finding, nextPageToken string, err error)
	// contains filtered or unexported fields
}

FindingIterator manages a stream of *websecurityscannerpb.Finding.

func (*FindingIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*FindingIterator) PageInfo

func (it *FindingIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type ScanConfigIterator

type ScanConfigIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*websecurityscannerpb.ScanConfig, nextPageToken string, err error)
	// contains filtered or unexported fields
}

ScanConfigIterator manages a stream of *websecurityscannerpb.ScanConfig.

func (*ScanConfigIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*ScanConfigIterator) PageInfo

func (it *ScanConfigIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type ScanRunIterator

type ScanRunIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*websecurityscannerpb.ScanRun, nextPageToken string, err error)
	// contains filtered or unexported fields
}

ScanRunIterator manages a stream of *websecurityscannerpb.ScanRun.

func (*ScanRunIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*ScanRunIterator) PageInfo

func (it *ScanRunIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Jump to

Keyboard shortcuts

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