package websecurityscanner
import "cloud.google.com/go/websecurityscanner/apiv1"
Package websecurityscanner is an auto-generated package for the Web Security Scanner API.
Scans your Compute and App Engine apps for common web vulnerabilities.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/websecurityscanner/apiv1@latest ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 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, mentioned above.
req := &websecurityscannerpb.CreateScanConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#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.
Index ¶
- func DefaultAuthScopes() []string
- type CallOptions
- type Client
- func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)
- func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConn
- func (c *Client) CreateScanConfig(ctx context.Context, req *websecurityscannerpb.CreateScanConfigRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanConfig, error)
- func (c *Client) DeleteScanConfig(ctx context.Context, req *websecurityscannerpb.DeleteScanConfigRequest, opts ...gax.CallOption) error
- func (c *Client) GetFinding(ctx context.Context, req *websecurityscannerpb.GetFindingRequest, opts ...gax.CallOption) (*websecurityscannerpb.Finding, error)
- func (c *Client) GetScanConfig(ctx context.Context, req *websecurityscannerpb.GetScanConfigRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanConfig, error)
- func (c *Client) GetScanRun(ctx context.Context, req *websecurityscannerpb.GetScanRunRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanRun, error)
- func (c *Client) ListCrawledUrls(ctx context.Context, req *websecurityscannerpb.ListCrawledUrlsRequest, opts ...gax.CallOption) *CrawledUrlIterator
- func (c *Client) ListFindingTypeStats(ctx context.Context, req *websecurityscannerpb.ListFindingTypeStatsRequest, opts ...gax.CallOption) (*websecurityscannerpb.ListFindingTypeStatsResponse, error)
- func (c *Client) ListFindings(ctx context.Context, req *websecurityscannerpb.ListFindingsRequest, opts ...gax.CallOption) *FindingIterator
- func (c *Client) ListScanConfigs(ctx context.Context, req *websecurityscannerpb.ListScanConfigsRequest, opts ...gax.CallOption) *ScanConfigIterator
- func (c *Client) ListScanRuns(ctx context.Context, req *websecurityscannerpb.ListScanRunsRequest, opts ...gax.CallOption) *ScanRunIterator
- func (c *Client) StartScanRun(ctx context.Context, req *websecurityscannerpb.StartScanRunRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanRun, error)
- func (c *Client) StopScanRun(ctx context.Context, req *websecurityscannerpb.StopScanRunRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanRun, error)
- func (c *Client) UpdateScanConfig(ctx context.Context, req *websecurityscannerpb.UpdateScanConfigRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanConfig, error)
- type CrawledUrlIterator
- func (it *CrawledUrlIterator) All() iter.Seq2[*websecurityscannerpb.CrawledUrl, error]
- func (it *CrawledUrlIterator) Next() (*websecurityscannerpb.CrawledUrl, error)
- func (it *CrawledUrlIterator) PageInfo() *iterator.PageInfo
- type FindingIterator
- func (it *FindingIterator) All() iter.Seq2[*websecurityscannerpb.Finding, error]
- func (it *FindingIterator) Next() (*websecurityscannerpb.Finding, error)
- func (it *FindingIterator) PageInfo() *iterator.PageInfo
- type ScanConfigIterator
- func (it *ScanConfigIterator) All() iter.Seq2[*websecurityscannerpb.ScanConfig, error]
- func (it *ScanConfigIterator) Next() (*websecurityscannerpb.ScanConfig, error)
- func (it *ScanConfigIterator) PageInfo() *iterator.PageInfo
- type ScanRunIterator
Examples ¶
- Client.CreateScanConfig
- Client.DeleteScanConfig
- Client.GetFinding
- Client.GetScanConfig
- Client.GetScanRun
- Client.ListCrawledUrls
- Client.ListCrawledUrls (All)
- Client.ListFindingTypeStats
- Client.ListFindings
- Client.ListFindings (All)
- Client.ListScanConfigs
- Client.ListScanConfigs (All)
- Client.ListScanRuns
- Client.ListScanRuns (All)
- Client.StartScanRun
- Client.StopScanRun
- Client.UpdateScanConfig
- NewClient
- NewRESTClient
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 ¶
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.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := websecurityscanner.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRESTClient ¶
NewRESTClient creates a new web security scanner rest client.
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.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := websecurityscanner.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*Client) Close ¶
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: Connections are now pooled so this method does not always return the same resource.
func (*Client) CreateScanConfig ¶
func (c *Client) CreateScanConfig(ctx context.Context, req *websecurityscannerpb.CreateScanConfigRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanConfig, error)
CreateScanConfig creates a new ScanConfig.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#CreateScanConfigRequest.
}
resp, err := c.CreateScanConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#DeleteScanConfigRequest.
}
err = c.DeleteScanConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) GetFinding ¶
func (c *Client) GetFinding(ctx context.Context, req *websecurityscannerpb.GetFindingRequest, opts ...gax.CallOption) (*websecurityscannerpb.Finding, error)
GetFinding gets a Finding.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#GetFindingRequest.
}
resp, err := c.GetFinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetScanConfig ¶
func (c *Client) GetScanConfig(ctx context.Context, req *websecurityscannerpb.GetScanConfigRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanConfig, error)
GetScanConfig gets a ScanConfig.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#GetScanConfigRequest.
}
resp, err := c.GetScanConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetScanRun ¶
func (c *Client) GetScanRun(ctx context.Context, req *websecurityscannerpb.GetScanRunRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanRun, error)
GetScanRun gets a ScanRun.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#GetScanRunRequest.
}
resp, err := c.GetScanRun(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListCrawledUrls ¶
func (c *Client) ListCrawledUrls(ctx context.Context, req *websecurityscannerpb.ListCrawledUrlsRequest, opts ...gax.CallOption) *CrawledUrlIterator
ListCrawledUrls list CrawledUrls under a given ScanRun.
Code:play
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*websecurityscannerpb.ListCrawledUrlsResponse)
}
}
Example (All)¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#ListCrawledUrlsRequest.
}
for resp, err := range c.ListCrawledUrls(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListFindingTypeStats ¶
func (c *Client) ListFindingTypeStats(ctx context.Context, req *websecurityscannerpb.ListFindingTypeStatsRequest, opts ...gax.CallOption) (*websecurityscannerpb.ListFindingTypeStatsResponse, error)
ListFindingTypeStats list all FindingTypeStats under a given ScanRun.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#ListFindingTypeStatsRequest.
}
resp, err := c.ListFindingTypeStats(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListFindings ¶
func (c *Client) ListFindings(ctx context.Context, req *websecurityscannerpb.ListFindingsRequest, opts ...gax.CallOption) *FindingIterator
ListFindings list Findings under a given ScanRun.
Code:play
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*websecurityscannerpb.ListFindingsResponse)
}
}
Example (All)¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#ListFindingsRequest.
}
for resp, err := range c.ListFindings(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListScanConfigs ¶
func (c *Client) ListScanConfigs(ctx context.Context, req *websecurityscannerpb.ListScanConfigsRequest, opts ...gax.CallOption) *ScanConfigIterator
ListScanConfigs lists ScanConfigs under a given project.
Code:play
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*websecurityscannerpb.ListScanConfigsResponse)
}
}
Example (All)¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#ListScanConfigsRequest.
}
for resp, err := range c.ListScanConfigs(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListScanRuns ¶
func (c *Client) ListScanRuns(ctx context.Context, req *websecurityscannerpb.ListScanRunsRequest, opts ...gax.CallOption) *ScanRunIterator
ListScanRuns lists ScanRuns under a given ScanConfig, in descending order of ScanRun
stop time.
Code:play
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*websecurityscannerpb.ListScanRunsResponse)
}
}
Example (All)¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#ListScanRunsRequest.
}
for resp, err := range c.ListScanRuns(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) StartScanRun ¶
func (c *Client) StartScanRun(ctx context.Context, req *websecurityscannerpb.StartScanRunRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanRun, error)
StartScanRun start a ScanRun according to the given ScanConfig.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#StartScanRunRequest.
}
resp, err := c.StartScanRun(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) StopScanRun ¶
func (c *Client) StopScanRun(ctx context.Context, req *websecurityscannerpb.StopScanRunRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanRun, error)
StopScanRun stops a ScanRun. The stopped ScanRun is returned.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#StopScanRunRequest.
}
resp, err := c.StopScanRun(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateScanConfig ¶
func (c *Client) UpdateScanConfig(ctx context.Context, req *websecurityscannerpb.UpdateScanConfigRequest, opts ...gax.CallOption) (*websecurityscannerpb.ScanConfig, error)
UpdateScanConfig updates a ScanConfig. This method support partial update of a ScanConfig.
Code:play
Example¶
package main
import (
"context"
websecurityscanner "cloud.google.com/go/websecurityscanner/apiv1"
websecurityscannerpb "cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
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/cloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb#UpdateScanConfigRequest.
}
resp, err := c.UpdateScanConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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) All ¶
func (it *CrawledUrlIterator) All() iter.Seq2[*websecurityscannerpb.CrawledUrl, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*CrawledUrlIterator) Next ¶
func (it *CrawledUrlIterator) Next() (*websecurityscannerpb.CrawledUrl, error)
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) All ¶
func (it *FindingIterator) All() iter.Seq2[*websecurityscannerpb.Finding, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*FindingIterator) Next ¶
func (it *FindingIterator) Next() (*websecurityscannerpb.Finding, error)
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) All ¶
func (it *ScanConfigIterator) All() iter.Seq2[*websecurityscannerpb.ScanConfig, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ScanConfigIterator) Next ¶
func (it *ScanConfigIterator) Next() (*websecurityscannerpb.ScanConfig, error)
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) All ¶
func (it *ScanRunIterator) All() iter.Seq2[*websecurityscannerpb.ScanRun, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ScanRunIterator) Next ¶
func (it *ScanRunIterator) Next() (*websecurityscannerpb.ScanRun, error)
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.
Source Files ¶
auxiliary.go auxiliary_go123.go doc.go helpers.go version.go web_security_scanner_client.go
Directories ¶
Path | Synopsis |
---|---|
apiv1/websecurityscannerpb |
- Version
- v1.7.3 (latest)
- Published
- Jan 2, 2025
- Platform
- linux/amd64
- Imports
- 26 packages
- Last checked
- 6 days ago –
Tools for package owners.