Package securitycenter is an auto-generated package for the Security Command Center API.
Security Command Center API provides access to temporal views of assets and findings within an organization.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
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/securitycenter/apiv2@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 := securitycenter.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 := &securitycenterpb.BatchCreateResourceValueConfigsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#BatchCreateResourceValueConfigsRequest. } resp, err := c.BatchCreateResourceValueConfigs(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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
AttackPathIterator
type AttackPathIterator 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 []*securitycenterpb.AttackPath, nextPageToken string, err error)
// contains filtered or unexported fields
}
AttackPathIterator manages a stream of *securitycenterpb.AttackPath.
func (*AttackPathIterator) All
func (it *AttackPathIterator) All() iter.Seq2[*securitycenterpb.AttackPath, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AttackPathIterator) Next
func (it *AttackPathIterator) Next() (*securitycenterpb.AttackPath, 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 (*AttackPathIterator) PageInfo
func (it *AttackPathIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
BigQueryExportIterator
type BigQueryExportIterator 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 []*securitycenterpb.BigQueryExport, nextPageToken string, err error)
// contains filtered or unexported fields
}
BigQueryExportIterator manages a stream of *securitycenterpb.BigQueryExport.
func (*BigQueryExportIterator) All
func (it *BigQueryExportIterator) All() iter.Seq2[*securitycenterpb.BigQueryExport, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*BigQueryExportIterator) Next
func (it *BigQueryExportIterator) Next() (*securitycenterpb.BigQueryExport, 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 (*BigQueryExportIterator) PageInfo
func (it *BigQueryExportIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
BulkMuteFindingsOperation
type BulkMuteFindingsOperation struct {
// contains filtered or unexported fields
}
BulkMuteFindingsOperation manages a long-running operation from BulkMuteFindings.
func (*BulkMuteFindingsOperation) Done
func (op *BulkMuteFindingsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BulkMuteFindingsOperation) Metadata
func (op *BulkMuteFindingsOperation) Metadata() (*emptypb.Empty, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BulkMuteFindingsOperation) Name
func (op *BulkMuteFindingsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BulkMuteFindingsOperation) Poll
func (op *BulkMuteFindingsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.BulkMuteFindingsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BulkMuteFindingsOperation) Wait
func (op *BulkMuteFindingsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.BulkMuteFindingsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CallOptions
type CallOptions struct {
BatchCreateResourceValueConfigs []gax.CallOption
BulkMuteFindings []gax.CallOption
CreateBigQueryExport []gax.CallOption
CreateFinding []gax.CallOption
CreateMuteConfig []gax.CallOption
CreateNotificationConfig []gax.CallOption
CreateSource []gax.CallOption
DeleteBigQueryExport []gax.CallOption
DeleteMuteConfig []gax.CallOption
DeleteNotificationConfig []gax.CallOption
DeleteResourceValueConfig []gax.CallOption
GetBigQueryExport []gax.CallOption
GetSimulation []gax.CallOption
GetValuedResource []gax.CallOption
GetIamPolicy []gax.CallOption
GetMuteConfig []gax.CallOption
GetNotificationConfig []gax.CallOption
GetResourceValueConfig []gax.CallOption
GetSource []gax.CallOption
GroupFindings []gax.CallOption
ListAttackPaths []gax.CallOption
ListBigQueryExports []gax.CallOption
ListFindings []gax.CallOption
ListMuteConfigs []gax.CallOption
ListNotificationConfigs []gax.CallOption
ListResourceValueConfigs []gax.CallOption
ListSources []gax.CallOption
ListValuedResources []gax.CallOption
SetFindingState []gax.CallOption
SetIamPolicy []gax.CallOption
SetMute []gax.CallOption
TestIamPermissions []gax.CallOption
UpdateBigQueryExport []gax.CallOption
UpdateExternalSystem []gax.CallOption
UpdateFinding []gax.CallOption
UpdateMuteConfig []gax.CallOption
UpdateNotificationConfig []gax.CallOption
UpdateResourceValueConfig []gax.CallOption
UpdateSecurityMarks []gax.CallOption
UpdateSource []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
CallOptions contains the retry settings for each method of Client.
Client
type Client struct {
// The call options for this service.
CallOptions *CallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
Client is a client for interacting with Security Command Center API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
V2 APIs for Security Center service.
func NewClient
NewClient creates a new security center client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
V2 APIs for Security Center service.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRESTClient
NewRESTClient creates a new security center rest client.
V2 APIs for Security Center service.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
)
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 := securitycenter.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*Client) BatchCreateResourceValueConfigs
func (c *Client) BatchCreateResourceValueConfigs(ctx context.Context, req *securitycenterpb.BatchCreateResourceValueConfigsRequest, opts ...gax.CallOption) (*securitycenterpb.BatchCreateResourceValueConfigsResponse, error)
BatchCreateResourceValueConfigs creates a ResourceValueConfig for an organization. Maps user’s tags to difference resource values for use by the attack path simulation.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.BatchCreateResourceValueConfigsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#BatchCreateResourceValueConfigsRequest.
}
resp, err := c.BatchCreateResourceValueConfigs(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) BulkMuteFindings
func (c *Client) BulkMuteFindings(ctx context.Context, req *securitycenterpb.BulkMuteFindingsRequest, opts ...gax.CallOption) (*BulkMuteFindingsOperation, error)
BulkMuteFindings kicks off an LRO to bulk mute findings for a parent based on a filter. If no location is specified, findings are muted in global. The parent can be either an organization, folder, or project. The findings matched by the filter will be muted after the LRO is done.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.BulkMuteFindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#BulkMuteFindingsRequest.
}
op, err := c.BulkMuteFindings(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) BulkMuteFindingsOperation
func (c *Client) BulkMuteFindingsOperation(name string) *BulkMuteFindingsOperation
BulkMuteFindingsOperation returns a new BulkMuteFindingsOperation from a given name. The name must be that of a previously created BulkMuteFindingsOperation, possibly from a different process.
func (*Client) CancelOperation
func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 (deprecated)
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) CreateBigQueryExport
func (c *Client) CreateBigQueryExport(ctx context.Context, req *securitycenterpb.CreateBigQueryExportRequest, opts ...gax.CallOption) (*securitycenterpb.BigQueryExport, error)
CreateBigQueryExport creates a BigQuery export.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.CreateBigQueryExportRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#CreateBigQueryExportRequest.
}
resp, err := c.CreateBigQueryExport(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateFinding
func (c *Client) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error)
CreateFinding creates a finding in a location. The corresponding source must exist for finding creation to succeed.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.CreateFindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#CreateFindingRequest.
}
resp, err := c.CreateFinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateMuteConfig
func (c *Client) CreateMuteConfig(ctx context.Context, req *securitycenterpb.CreateMuteConfigRequest, opts ...gax.CallOption) (*securitycenterpb.MuteConfig, error)
CreateMuteConfig creates a mute config.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.CreateMuteConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#CreateMuteConfigRequest.
}
resp, err := c.CreateMuteConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateNotificationConfig
func (c *Client) CreateNotificationConfig(ctx context.Context, req *securitycenterpb.CreateNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, error)
CreateNotificationConfig creates a notification config.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.CreateNotificationConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#CreateNotificationConfigRequest.
}
resp, err := c.CreateNotificationConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateSource
func (c *Client) CreateSource(ctx context.Context, req *securitycenterpb.CreateSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error)
CreateSource creates a source.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.CreateSourceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#CreateSourceRequest.
}
resp, err := c.CreateSource(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) DeleteBigQueryExport
func (c *Client) DeleteBigQueryExport(ctx context.Context, req *securitycenterpb.DeleteBigQueryExportRequest, opts ...gax.CallOption) error
DeleteBigQueryExport deletes an existing BigQuery export.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.DeleteBigQueryExportRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#DeleteBigQueryExportRequest.
}
err = c.DeleteBigQueryExport(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteMuteConfig
func (c *Client) DeleteMuteConfig(ctx context.Context, req *securitycenterpb.DeleteMuteConfigRequest, opts ...gax.CallOption) error
DeleteMuteConfig deletes an existing mute config. If no location is specified, default is global.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.DeleteMuteConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#DeleteMuteConfigRequest.
}
err = c.DeleteMuteConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteNotificationConfig
func (c *Client) DeleteNotificationConfig(ctx context.Context, req *securitycenterpb.DeleteNotificationConfigRequest, opts ...gax.CallOption) error
DeleteNotificationConfig deletes a notification config.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.DeleteNotificationConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#DeleteNotificationConfigRequest.
}
err = c.DeleteNotificationConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteOperation
func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteResourceValueConfig
func (c *Client) DeleteResourceValueConfig(ctx context.Context, req *securitycenterpb.DeleteResourceValueConfigRequest, opts ...gax.CallOption) error
DeleteResourceValueConfig deletes a ResourceValueConfig.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.DeleteResourceValueConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#DeleteResourceValueConfigRequest.
}
err = c.DeleteResourceValueConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) GetBigQueryExport
func (c *Client) GetBigQueryExport(ctx context.Context, req *securitycenterpb.GetBigQueryExportRequest, opts ...gax.CallOption) (*securitycenterpb.BigQueryExport, error)
GetBigQueryExport gets a BigQuery export.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.GetBigQueryExportRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#GetBigQueryExportRequest.
}
resp, err := c.GetBigQueryExport(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetIamPolicy
func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the access control policy on the specified Source.
Example
package main
import (
"context"
iampb "cloud.google.com/go/iam/apiv1/iampb"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.GetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
}
resp, err := c.GetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetMuteConfig
func (c *Client) GetMuteConfig(ctx context.Context, req *securitycenterpb.GetMuteConfigRequest, opts ...gax.CallOption) (*securitycenterpb.MuteConfig, error)
GetMuteConfig gets a mute config. If no location is specified, default is global.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycenterpb.GetMuteConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv2/securitycenterpb#GetMuteConfigRequest.
}
resp, err := c.GetMuteConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetNotificationConfig
func (c *Client) GetNotificationConfig(ctx context.Context, req *securitycenterpb.GetNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, error)
GetNotificationConfig gets a notification config.
Example
package main
import (
"context"
securitycenter "cloud.google.com/go/securitycenter/apiv2"
securitycenterpb "cloud.google.com/go/securitycenter/apiv2/securitycenterpb"
)
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 := securitycenter.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.