blob: e25241e03ee5fed1c1ee4f23d5a44c8d4ca4c9b1 [file] [log] [blame]
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
package securitycenter_test
import (
"context"
iampb "cloud.google.com/go/iam/apiv1/iampb"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
securitycenter "cloud.google.com/go/securitycenter/apiv1"
securitycenterpb "cloud.google.com/go/securitycenter/apiv1/securitycenterpb"
"google.golang.org/api/iterator"
)
func ExampleNewClient() {
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 ExampleNewRESTClient() {
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 ExampleClient_BulkMuteFindings() {
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/apiv1/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 ExampleClient_CreateBigQueryExport() {
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/apiv1/securitycenterpb#CreateBigQueryExportRequest.
}
resp, err := c.CreateBigQueryExport(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateFinding() {
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/apiv1/securitycenterpb#CreateFindingRequest.
}
resp, err := c.CreateFinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateMuteConfig() {
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/apiv1/securitycenterpb#CreateMuteConfigRequest.
}
resp, err := c.CreateMuteConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateNotificationConfig() {
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/apiv1/securitycenterpb#CreateNotificationConfigRequest.
}
resp, err := c.CreateNotificationConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateSecurityHealthAnalyticsCustomModule() {
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.CreateSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#CreateSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.CreateSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateSource() {
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/apiv1/securitycenterpb#CreateSourceRequest.
}
resp, err := c.CreateSource(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_DeleteBigQueryExport() {
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/apiv1/securitycenterpb#DeleteBigQueryExportRequest.
}
err = c.DeleteBigQueryExport(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_DeleteMuteConfig() {
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/apiv1/securitycenterpb#DeleteMuteConfigRequest.
}
err = c.DeleteMuteConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_DeleteNotificationConfig() {
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/apiv1/securitycenterpb#DeleteNotificationConfigRequest.
}
err = c.DeleteNotificationConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_DeleteSecurityHealthAnalyticsCustomModule() {
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.DeleteSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#DeleteSecurityHealthAnalyticsCustomModuleRequest.
}
err = c.DeleteSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_GetBigQueryExport() {
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/apiv1/securitycenterpb#GetBigQueryExportRequest.
}
resp, err := c.GetBigQueryExport(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetEffectiveSecurityHealthAnalyticsCustomModule() {
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.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#GetEffectiveSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.GetEffectiveSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetIamPolicy() {
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 ExampleClient_GetMuteConfig() {
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/apiv1/securitycenterpb#GetMuteConfigRequest.
}
resp, err := c.GetMuteConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetNotificationConfig() {
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.GetNotificationConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#GetNotificationConfigRequest.
}
resp, err := c.GetNotificationConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetOrganizationSettings() {
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.GetOrganizationSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#GetOrganizationSettingsRequest.
}
resp, err := c.GetOrganizationSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetSecurityHealthAnalyticsCustomModule() {
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.GetSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#GetSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.GetSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetSource() {
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.GetSourceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#GetSourceRequest.
}
resp, err := c.GetSource(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GroupAssets() {
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.GroupAssetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#GroupAssetsRequest.
}
it := c.GroupAssets(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.(*securitycenterpb.GroupAssetsResponse)
}
}
func ExampleClient_GroupFindings() {
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.GroupFindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#GroupFindingsRequest.
}
it := c.GroupFindings(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.(*securitycenterpb.GroupFindingsResponse)
}
}
func ExampleClient_ListAssets() {
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.ListAssetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListAssetsRequest.
}
it := c.ListAssets(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.(*securitycenterpb.ListAssetsResponse)
}
}
func ExampleClient_ListBigQueryExports() {
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.ListBigQueryExportsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListBigQueryExportsRequest.
}
it := c.ListBigQueryExports(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.(*securitycenterpb.ListBigQueryExportsResponse)
}
}
func ExampleClient_ListDescendantSecurityHealthAnalyticsCustomModules() {
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.ListDescendantSecurityHealthAnalyticsCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListDescendantSecurityHealthAnalyticsCustomModulesRequest.
}
it := c.ListDescendantSecurityHealthAnalyticsCustomModules(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.(*securitycenterpb.ListDescendantSecurityHealthAnalyticsCustomModulesResponse)
}
}
func ExampleClient_ListEffectiveSecurityHealthAnalyticsCustomModules() {
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.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListEffectiveSecurityHealthAnalyticsCustomModulesRequest.
}
it := c.ListEffectiveSecurityHealthAnalyticsCustomModules(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.(*securitycenterpb.ListEffectiveSecurityHealthAnalyticsCustomModulesResponse)
}
}
func ExampleClient_ListFindings() {
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.ListFindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#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.(*securitycenterpb.ListFindingsResponse)
}
}
func ExampleClient_ListMuteConfigs() {
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.ListMuteConfigsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListMuteConfigsRequest.
}
it := c.ListMuteConfigs(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.(*securitycenterpb.ListMuteConfigsResponse)
}
}
func ExampleClient_ListNotificationConfigs() {
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.ListNotificationConfigsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListNotificationConfigsRequest.
}
it := c.ListNotificationConfigs(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.(*securitycenterpb.ListNotificationConfigsResponse)
}
}
func ExampleClient_ListSecurityHealthAnalyticsCustomModules() {
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.ListSecurityHealthAnalyticsCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListSecurityHealthAnalyticsCustomModulesRequest.
}
it := c.ListSecurityHealthAnalyticsCustomModules(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.(*securitycenterpb.ListSecurityHealthAnalyticsCustomModulesResponse)
}
}
func ExampleClient_ListSources() {
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.ListSourcesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#ListSourcesRequest.
}
it := c.ListSources(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.(*securitycenterpb.ListSourcesResponse)
}
}
func ExampleClient_RunAssetDiscovery() {
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.RunAssetDiscoveryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#RunAssetDiscoveryRequest.
}
op, err := c.RunAssetDiscovery(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_SetFindingState() {
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.SetFindingStateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#SetFindingStateRequest.
}
resp, err := c.SetFindingState(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_SetIamPolicy() {
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.SetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_SetMute() {
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.SetMuteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#SetMuteRequest.
}
resp, err := c.SetMute(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_SimulateSecurityHealthAnalyticsCustomModule() {
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.SimulateSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#SimulateSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.SimulateSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_TestIamPermissions() {
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.TestIamPermissionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
}
resp, err := c.TestIamPermissions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateBigQueryExport() {
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.UpdateBigQueryExportRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateBigQueryExportRequest.
}
resp, err := c.UpdateBigQueryExport(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateExternalSystem() {
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.UpdateExternalSystemRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateExternalSystemRequest.
}
resp, err := c.UpdateExternalSystem(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateFinding() {
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.UpdateFindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateFindingRequest.
}
resp, err := c.UpdateFinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateMuteConfig() {
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.UpdateMuteConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateMuteConfigRequest.
}
resp, err := c.UpdateMuteConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateNotificationConfig() {
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.UpdateNotificationConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateNotificationConfigRequest.
}
resp, err := c.UpdateNotificationConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateOrganizationSettings() {
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.UpdateOrganizationSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateOrganizationSettingsRequest.
}
resp, err := c.UpdateOrganizationSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateSecurityHealthAnalyticsCustomModule() {
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.UpdateSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.UpdateSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateSecurityMarks() {
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.UpdateSecurityMarksRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateSecurityMarksRequest.
}
resp, err := c.UpdateSecurityMarks(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateSource() {
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.UpdateSourceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1/securitycenterpb#UpdateSourceRequest.
}
resp, err := c.UpdateSource(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CancelOperation() {
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 ExampleClient_DeleteOperation() {
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 ExampleClient_GetOperation() {
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.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListOperations() {
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.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(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.(*longrunningpb.ListOperationsResponse)
}
}