blob: 12d4bd5ebaa3a93ae9ea5ec803d483a0f1871de0 [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 securitycentermanagement_test
import (
"context"
securitycentermanagement "cloud.google.com/go/securitycentermanagement/apiv1"
securitycentermanagementpb "cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := securitycentermanagement.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 := securitycentermanagement.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func ExampleClient_CreateEventThreatDetectionCustomModule() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.CreateEventThreatDetectionCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#CreateEventThreatDetectionCustomModuleRequest.
}
resp, err := c.CreateEventThreatDetectionCustomModule(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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.CreateSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#CreateSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.CreateSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_DeleteEventThreatDetectionCustomModule() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.DeleteEventThreatDetectionCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#DeleteEventThreatDetectionCustomModuleRequest.
}
err = c.DeleteEventThreatDetectionCustomModule(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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.DeleteSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#DeleteSecurityHealthAnalyticsCustomModuleRequest.
}
err = c.DeleteSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_GetEffectiveEventThreatDetectionCustomModule() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.GetEffectiveEventThreatDetectionCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#GetEffectiveEventThreatDetectionCustomModuleRequest.
}
resp, err := c.GetEffectiveEventThreatDetectionCustomModule(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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#GetEffectiveSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.GetEffectiveSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetEventThreatDetectionCustomModule() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.GetEventThreatDetectionCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#GetEventThreatDetectionCustomModuleRequest.
}
resp, err := c.GetEventThreatDetectionCustomModule(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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.GetSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#GetSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.GetSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListDescendantEventThreatDetectionCustomModules() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.ListDescendantEventThreatDetectionCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#ListDescendantEventThreatDetectionCustomModulesRequest.
}
it := c.ListDescendantEventThreatDetectionCustomModules(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.(*securitycentermanagementpb.ListDescendantEventThreatDetectionCustomModulesResponse)
}
}
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.ListDescendantSecurityHealthAnalyticsCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#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.(*securitycentermanagementpb.ListDescendantSecurityHealthAnalyticsCustomModulesResponse)
}
}
func ExampleClient_ListEffectiveEventThreatDetectionCustomModules() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.ListEffectiveEventThreatDetectionCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#ListEffectiveEventThreatDetectionCustomModulesRequest.
}
it := c.ListEffectiveEventThreatDetectionCustomModules(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.(*securitycentermanagementpb.ListEffectiveEventThreatDetectionCustomModulesResponse)
}
}
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#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.(*securitycentermanagementpb.ListEffectiveSecurityHealthAnalyticsCustomModulesResponse)
}
}
func ExampleClient_ListEventThreatDetectionCustomModules() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.ListEventThreatDetectionCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#ListEventThreatDetectionCustomModulesRequest.
}
it := c.ListEventThreatDetectionCustomModules(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.(*securitycentermanagementpb.ListEventThreatDetectionCustomModulesResponse)
}
}
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.ListSecurityHealthAnalyticsCustomModulesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#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.(*securitycentermanagementpb.ListSecurityHealthAnalyticsCustomModulesResponse)
}
}
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.SimulateSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#SimulateSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.SimulateSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateEventThreatDetectionCustomModule() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.UpdateEventThreatDetectionCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#UpdateEventThreatDetectionCustomModuleRequest.
}
resp, err := c.UpdateEventThreatDetectionCustomModule(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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.UpdateSecurityHealthAnalyticsCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#UpdateSecurityHealthAnalyticsCustomModuleRequest.
}
resp, err := c.UpdateSecurityHealthAnalyticsCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ValidateEventThreatDetectionCustomModule() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &securitycentermanagementpb.ValidateEventThreatDetectionCustomModuleRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/securitycentermanagement/apiv1/securitycentermanagementpb#ValidateEventThreatDetectionCustomModuleRequest.
}
resp, err := c.ValidateEventThreatDetectionCustomModule(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetLocation() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ListLocations() {
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 := securitycentermanagement.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(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.(*locationpb.ListLocationsResponse)
}
}