Package cloudsecuritycompliance is an auto-generated package for the Cloud Security Compliance API.
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/cloudsecuritycompliance/apiv1@latest ctx := context . Background () // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c , err := cloudsecuritycompliance . NewAuditClient ( 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 := & cloudsecuritycompliancepb . CreateFrameworkAuditRequest { // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#CreateFrameworkAuditRequest. } op , err := c . CreateFrameworkAudit ( ctx , req ) if err != nil { // TODO: Handle error. } resp , err := op . Wait ( ctx ) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewAuditClient 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.
AuditCallOptions
type
AuditCallOptions
struct
{
GenerateFrameworkAuditScopeReport
[]
gax
.
CallOption
CreateFrameworkAudit
[]
gax
.
CallOption
ListFrameworkAudits
[]
gax
.
CallOption
GetFrameworkAudit
[]
gax
.
CallOption
GetLocation
[]
gax
.
CallOption
ListLocations
[]
gax
.
CallOption
CancelOperation
[]
gax
.
CallOption
DeleteOperation
[]
gax
.
CallOption
GetOperation
[]
gax
.
CallOption
ListOperations
[]
gax
.
CallOption
}
AuditCallOptions contains the retry settings for each method of AuditClient.
AuditClient
type
AuditClient
struct
{
// The call options for this service.
CallOptions
*
AuditCallOptions
// 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
}
AuditClient is a client for interacting with Cloud Security Compliance API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service describing handlers for resources
func NewAuditClient
func
NewAuditClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
AuditClient
,
error
)
NewAuditClient creates a new audit client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service describing handlers for resources
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewAuditClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func NewAuditRESTClient
func
NewAuditRESTClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
AuditClient
,
error
)
NewAuditRESTClient creates a new audit rest client.
Service describing handlers for resources
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewAuditRESTClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func (*AuditClient) CancelOperation
func
(
c
*
AuditClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
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 (*AuditClient) Close
func
(
c
*
AuditClient
)
Close
()
error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*AuditClient) Connection (deprecated)
func
(
c
*
AuditClient
)
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 (*AuditClient) CreateFrameworkAudit
func
(
c
*
AuditClient
)
CreateFrameworkAudit
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
CreateFrameworkAuditRequest
,
opts
...
gax
.
CallOption
)
(
*
CreateFrameworkAuditOperation
,
error
)
CreateFrameworkAudit creates an audit scope report for a framework.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
CreateFrameworkAuditRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#CreateFrameworkAuditRequest.
}
op
,
err
:=
c
.
CreateFrameworkAudit
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
resp
,
err
:=
op
.
Wait
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*AuditClient) CreateFrameworkAuditOperation
func
(
c
*
AuditClient
)
CreateFrameworkAuditOperation
(
name
string
)
*
CreateFrameworkAuditOperation
CreateFrameworkAuditOperation returns a new CreateFrameworkAuditOperation from a given name. The name must be that of a previously created CreateFrameworkAuditOperation, possibly from a different process.
func (*AuditClient) DeleteOperation
func
(
c
*
AuditClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
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 (*AuditClient) GenerateFrameworkAuditScopeReport
func
(
c
*
AuditClient
)
GenerateFrameworkAuditScopeReport
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
GenerateFrameworkAuditScopeReportRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
GenerateFrameworkAuditScopeReportResponse
,
error
)
GenerateFrameworkAuditScopeReport generates an audit scope report for a framework.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
GenerateFrameworkAuditScopeReportRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#GenerateFrameworkAuditScopeReportRequest.
}
resp
,
err
:=
c
.
GenerateFrameworkAuditScopeReport
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*AuditClient) GetFrameworkAudit
func
(
c
*
AuditClient
)
GetFrameworkAudit
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
GetFrameworkAuditRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
FrameworkAudit
,
error
)
GetFrameworkAudit gets the details for a framework audit.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
GetFrameworkAuditRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#GetFrameworkAuditRequest.
}
resp
,
err
:=
c
.
GetFrameworkAudit
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*AuditClient) GetLocation
func
(
c
*
AuditClient
)
GetLocation
(
ctx
context
.
Context
,
req
*
locationpb
.
GetLocationRequest
,
opts
...
gax
.
CallOption
)
(
*
locationpb
.
Location
,
error
)
GetLocation gets information about a location.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
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 (*AuditClient) GetOperation
func
(
c
*
AuditClient
)
GetOperation
(
ctx
context
.
Context
,
req
*
longrunningpb
.
GetOperationRequest
,
opts
...
gax
.
CallOption
)
(
*
longrunningpb
.
Operation
,
error
)
GetOperation is a utility method from google.longrunning.Operations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
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 (*AuditClient) ListFrameworkAudits
func
(
c
*
AuditClient
)
ListFrameworkAudits
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListFrameworkAuditsRequest
,
opts
...
gax
.
CallOption
)
*
FrameworkAuditIterator
ListFrameworkAudits lists the framework audits for a given organization, folder, or project.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewAuditClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworkAuditsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworkAuditsRequest.
}
it
:=
c
.
ListFrameworkAudits
(
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
.(
*
cloudsecuritycompliancepb
.
ListFrameworkAuditsResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworkAuditsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworkAuditsRequest.
}
for
resp
,
err
:=
range
c
.
ListFrameworkAudits
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*AuditClient) ListLocations
func
(
c
*
AuditClient
)
ListLocations
(
ctx
context
.
Context
,
req
*
locationpb
.
ListLocationsRequest
,
opts
...
gax
.
CallOption
)
*
LocationIterator
ListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name )] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
"google.golang.org/api/iterator"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListLocations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*AuditClient) ListOperations
func
(
c
*
AuditClient
)
ListOperations
(
ctx
context
.
Context
,
req
*
longrunningpb
.
ListOperationsRequest
,
opts
...
gax
.
CallOption
)
*
OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewAuditClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewAuditClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListOperations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
CloudControlDeploymentIterator
type
CloudControlDeploymentIterator
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
[]
*
cloudsecuritycompliancepb
.
CloudControlDeployment
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
CloudControlDeploymentIterator manages a stream of *cloudsecuritycompliancepb.CloudControlDeployment.
func (*CloudControlDeploymentIterator) All
func
(
it
*
CloudControlDeploymentIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
CloudControlDeployment
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*CloudControlDeploymentIterator) Next
func
(
it
*
CloudControlDeploymentIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
CloudControlDeployment
,
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 (*CloudControlDeploymentIterator) PageInfo
func
(
it
*
CloudControlDeploymentIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CloudControlIterator
type
CloudControlIterator
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
[]
*
cloudsecuritycompliancepb
.
CloudControl
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
CloudControlIterator manages a stream of *cloudsecuritycompliancepb.CloudControl.
func (*CloudControlIterator) All
func
(
it
*
CloudControlIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
CloudControl
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*CloudControlIterator) Next
func
(
it
*
CloudControlIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
CloudControl
,
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 (*CloudControlIterator) PageInfo
func
(
it
*
CloudControlIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CmEnrollmentCallOptions
type
CmEnrollmentCallOptions
struct
{
UpdateCmEnrollment
[]
gax
.
CallOption
CalculateEffectiveCmEnrollment
[]
gax
.
CallOption
GetLocation
[]
gax
.
CallOption
ListLocations
[]
gax
.
CallOption
CancelOperation
[]
gax
.
CallOption
DeleteOperation
[]
gax
.
CallOption
GetOperation
[]
gax
.
CallOption
ListOperations
[]
gax
.
CallOption
}
CmEnrollmentCallOptions contains the retry settings for each method of CmEnrollmentClient.
CmEnrollmentClient
type
CmEnrollmentClient
struct
{
// The call options for this service.
CallOptions
*
CmEnrollmentCallOptions
// contains filtered or unexported fields
}
CmEnrollmentClient is a client for interacting with Cloud Security Compliance API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service describing CmEnrollment related RPCs for complianceManager.
func NewCmEnrollmentClient
func
NewCmEnrollmentClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
CmEnrollmentClient
,
error
)
NewCmEnrollmentClient creates a new cm enrollment service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service describing CmEnrollment related RPCs for complianceManager.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func NewCmEnrollmentRESTClient
func
NewCmEnrollmentRESTClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
CmEnrollmentClient
,
error
)
NewCmEnrollmentRESTClient creates a new cm enrollment service rest client.
Service describing CmEnrollment related RPCs for complianceManager.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewCmEnrollmentRESTClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func (*CmEnrollmentClient) CalculateEffectiveCmEnrollment
func
(
c
*
CmEnrollmentClient
)
CalculateEffectiveCmEnrollment
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
CalculateEffectiveCmEnrollmentRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
CalculateEffectiveCmEnrollmentResponse
,
error
)
CalculateEffectiveCmEnrollment calculates the effective Compliance Manager enrollment for a resource. An effective enrollment is either a direct enrollment of a resource (if it exists), or an enrollment of the closest parent of a resource that’s enrolled in Compliance Manager.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
CalculateEffectiveCmEnrollmentRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#CalculateEffectiveCmEnrollmentRequest.
}
resp
,
err
:=
c
.
CalculateEffectiveCmEnrollment
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*CmEnrollmentClient) CancelOperation
func
(
c
*
CmEnrollmentClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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 (*CmEnrollmentClient) Close
func
(
c
*
CmEnrollmentClient
)
Close
()
error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CmEnrollmentClient) Connection (deprecated)
func
(
c
*
CmEnrollmentClient
)
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 (*CmEnrollmentClient) DeleteOperation
func
(
c
*
CmEnrollmentClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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 (*CmEnrollmentClient) GetLocation
func
(
c
*
CmEnrollmentClient
)
GetLocation
(
ctx
context
.
Context
,
req
*
locationpb
.
GetLocationRequest
,
opts
...
gax
.
CallOption
)
(
*
locationpb
.
Location
,
error
)
GetLocation gets information about a location.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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 (*CmEnrollmentClient) GetOperation
func
(
c
*
CmEnrollmentClient
)
GetOperation
(
ctx
context
.
Context
,
req
*
longrunningpb
.
GetOperationRequest
,
opts
...
gax
.
CallOption
)
(
*
longrunningpb
.
Operation
,
error
)
GetOperation is a utility method from google.longrunning.Operations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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 (*CmEnrollmentClient) ListLocations
func
(
c
*
CmEnrollmentClient
)
ListLocations
(
ctx
context
.
Context
,
req
*
locationpb
.
ListLocationsRequest
,
opts
...
gax
.
CallOption
)
*
LocationIterator
ListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name )] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
"google.golang.org/api/iterator"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListLocations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*CmEnrollmentClient) ListOperations
func
(
c
*
CmEnrollmentClient
)
ListOperations
(
ctx
context
.
Context
,
req
*
longrunningpb
.
ListOperationsRequest
,
opts
...
gax
.
CallOption
)
*
OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListOperations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*CmEnrollmentClient) UpdateCmEnrollment
func
(
c
*
CmEnrollmentClient
)
UpdateCmEnrollment
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
UpdateCmEnrollmentRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
CmEnrollment
,
error
)
UpdateCmEnrollment updates the Compliance Manager enrollment for a resource to facilitate an audit. Use this method to enroll a resource in Compliance Manager or to create or update feature-specific configurations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewCmEnrollmentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
UpdateCmEnrollmentRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#UpdateCmEnrollmentRequest.
}
resp
,
err
:=
c
.
UpdateCmEnrollment
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
ConfigCallOptions
type
ConfigCallOptions
struct
{
ListFrameworks
[]
gax
.
CallOption
GetFramework
[]
gax
.
CallOption
CreateFramework
[]
gax
.
CallOption
UpdateFramework
[]
gax
.
CallOption
DeleteFramework
[]
gax
.
CallOption
ListCloudControls
[]
gax
.
CallOption
GetCloudControl
[]
gax
.
CallOption
CreateCloudControl
[]
gax
.
CallOption
UpdateCloudControl
[]
gax
.
CallOption
DeleteCloudControl
[]
gax
.
CallOption
GetLocation
[]
gax
.
CallOption
ListLocations
[]
gax
.
CallOption
CancelOperation
[]
gax
.
CallOption
DeleteOperation
[]
gax
.
CallOption
GetOperation
[]
gax
.
CallOption
ListOperations
[]
gax
.
CallOption
}
ConfigCallOptions contains the retry settings for each method of ConfigClient.
ConfigClient
type
ConfigClient
struct
{
// The call options for this service.
CallOptions
*
ConfigCallOptions
// contains filtered or unexported fields
}
ConfigClient is a client for interacting with Cloud Security Compliance API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Config Service manages compliance frameworks, cloud controls, and their configurations.
func NewConfigClient
func
NewConfigClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
ConfigClient
,
error
)
NewConfigClient creates a new config client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Config Service manages compliance frameworks, cloud controls, and their configurations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func NewConfigRESTClient
func
NewConfigRESTClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
ConfigClient
,
error
)
NewConfigRESTClient creates a new config rest client.
Config Service manages compliance frameworks, cloud controls, and their configurations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewConfigRESTClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func (*ConfigClient) CancelOperation
func
(
c
*
ConfigClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
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 (*ConfigClient) Close
func
(
c
*
ConfigClient
)
Close
()
error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConfigClient) Connection (deprecated)
func
(
c
*
ConfigClient
)
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 (*ConfigClient) CreateCloudControl
func
(
c
*
ConfigClient
)
CreateCloudControl
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
CreateCloudControlRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
CloudControl
,
error
)
CreateCloudControl creates a custom cloud control in a given parent resource. You can’t create built-in cloud controls because those are managed by Google.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
CreateCloudControlRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#CreateCloudControlRequest.
}
resp
,
err
:=
c
.
CreateCloudControl
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*ConfigClient) CreateFramework
func
(
c
*
ConfigClient
)
CreateFramework
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
CreateFrameworkRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
Framework
,
error
)
CreateFramework creates a custom framework in a given parent resource. You can’t create built-in frameworks because those are managed by Google.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
CreateFrameworkRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#CreateFrameworkRequest.
}
resp
,
err
:=
c
.
CreateFramework
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*ConfigClient) DeleteCloudControl
func
(
c
*
ConfigClient
)
DeleteCloudControl
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
DeleteCloudControlRequest
,
opts
...
gax
.
CallOption
)
error
DeleteCloudControl deletes a custom cloud control, including all its major and minor revisions. Consider the following:
You can’t delete built-in cloud controls. You can only delete cloud
controls with type CUSTOM.
You can’t delete cloud controls if any of the versions are referenced
by a framework.
You can’t restore a deleted cloud control. This action is permanent.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
DeleteCloudControlRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#DeleteCloudControlRequest.
}
err
=
c
.
DeleteCloudControl
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
}
func (*ConfigClient) DeleteFramework
func
(
c
*
ConfigClient
)
DeleteFramework
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
DeleteFrameworkRequest
,
opts
...
gax
.
CallOption
)
error
DeleteFramework deletes a custom framework, including all its major and minor revisions. Consider the following:
You can’t delete built-in frameworks. You can only delete frameworks
with type CUSTOM.
You can’t delete frameworks that are deployed to a resource.
You can’t restore a deleted framework. This action is permanent.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
DeleteFrameworkRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#DeleteFrameworkRequest.
}
err
=
c
.
DeleteFramework
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
}
func (*ConfigClient) DeleteOperation
func
(
c
*
ConfigClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
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 (*ConfigClient) GetCloudControl
func
(
c
*
ConfigClient
)
GetCloudControl
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
GetCloudControlRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
CloudControl
,
error
)
GetCloudControl gets details about a cloud control. This method retrieves the latest major version of a cloud control that you identify by name.
By default, the latest major version of the cloud control is returned. To retrieve a specific major version, include major_revision_id in the request.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
GetCloudControlRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#GetCloudControlRequest.
}
resp
,
err
:=
c
.
GetCloudControl
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*ConfigClient) GetFramework
func
(
c
*
ConfigClient
)
GetFramework
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
GetFrameworkRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
Framework
,
error
)
GetFramework gets details about a framework. This method retrieves the latest major version of the framework.
To retrieve a specific major version, include major_revision_id in the request.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
GetFrameworkRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#GetFrameworkRequest.
}
resp
,
err
:=
c
.
GetFramework
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*ConfigClient) GetLocation
func
(
c
*
ConfigClient
)
GetLocation
(
ctx
context
.
Context
,
req
*
locationpb
.
GetLocationRequest
,
opts
...
gax
.
CallOption
)
(
*
locationpb
.
Location
,
error
)
GetLocation gets information about a location.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
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 (*ConfigClient) GetOperation
func
(
c
*
ConfigClient
)
GetOperation
(
ctx
context
.
Context
,
req
*
longrunningpb
.
GetOperationRequest
,
opts
...
gax
.
CallOption
)
(
*
longrunningpb
.
Operation
,
error
)
GetOperation is a utility method from google.longrunning.Operations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
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 (*ConfigClient) ListCloudControls
func
(
c
*
ConfigClient
)
ListCloudControls
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListCloudControlsRequest
,
opts
...
gax
.
CallOption
)
*
CloudControlIterator
ListCloudControls lists the cloud controls (both built-in and custom) that are available in a given parent resource. The latest major version of each cloud control is returned. This method supports pagination.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListCloudControlsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListCloudControlsRequest.
}
it
:=
c
.
ListCloudControls
(
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
.(
*
cloudsecuritycompliancepb
.
ListCloudControlsResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListCloudControlsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListCloudControlsRequest.
}
for
resp
,
err
:=
range
c
.
ListCloudControls
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*ConfigClient) ListFrameworks
func
(
c
*
ConfigClient
)
ListFrameworks
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListFrameworksRequest
,
opts
...
gax
.
CallOption
)
*
FrameworkIterator
ListFrameworks lists the frameworks (both built-in and custom) that are available within the parent resource. The latest major version of each framework is returned. This method supports pagination.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworksRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworksRequest.
}
it
:=
c
.
ListFrameworks
(
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
.(
*
cloudsecuritycompliancepb
.
ListFrameworksResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworksRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworksRequest.
}
for
resp
,
err
:=
range
c
.
ListFrameworks
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*ConfigClient) ListLocations
func
(
c
*
ConfigClient
)
ListLocations
(
ctx
context
.
Context
,
req
*
locationpb
.
ListLocationsRequest
,
opts
...
gax
.
CallOption
)
*
LocationIterator
ListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name )] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
"google.golang.org/api/iterator"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListLocations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*ConfigClient) ListOperations
func
(
c
*
ConfigClient
)
ListOperations
(
ctx
context
.
Context
,
req
*
longrunningpb
.
ListOperationsRequest
,
opts
...
gax
.
CallOption
)
*
OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewConfigClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListOperations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*ConfigClient) UpdateCloudControl
func
(
c
*
ConfigClient
)
UpdateCloudControl
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
UpdateCloudControlRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
CloudControl
,
error
)
UpdateCloudControl updates a custom cloud control. This method allows for partial updates of a cloud control. Use the update_mask to specify which fields to update. Consider the following:
If you provide an update_mask, only the fields that are specified
in the mask are updated.
If you don’t provide an update_mask, all the fields that are present
in the request’s cloud_control body are used to overwrite the existing
resource.
You can only update cloud controls with the CUSTOM type. A successful update creates a new version of the cloud control.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
UpdateCloudControlRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#UpdateCloudControlRequest.
}
resp
,
err
:=
c
.
UpdateCloudControl
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*ConfigClient) UpdateFramework
func
(
c
*
ConfigClient
)
UpdateFramework
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
UpdateFrameworkRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
Framework
,
error
)
UpdateFramework updates a custom framework. This method allows for partial updates of a framework. Use the update_mask to specify which fields to update. Consider the following:
If you provide an update_mask, only the fields that are specified
in the mask are updated.
If you don’t provide an update_mask, all the fields that are present
in the request’s framework body are used to overwrite the existing
resource.
You can only update frameworks with the CUSTOM type. A successful update creates a new version of the framework.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewConfigClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
UpdateFrameworkRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#UpdateFrameworkRequest.
}
resp
,
err
:=
c
.
UpdateFramework
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
ControlComplianceSummaryIterator
type
ControlComplianceSummaryIterator
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
[]
*
cloudsecuritycompliancepb
.
ControlComplianceSummary
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
ControlComplianceSummaryIterator manages a stream of *cloudsecuritycompliancepb.ControlComplianceSummary.
func (*ControlComplianceSummaryIterator) All
func
(
it
*
ControlComplianceSummaryIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
ControlComplianceSummary
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ControlComplianceSummaryIterator) Next
func
(
it
*
ControlComplianceSummaryIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
ControlComplianceSummary
,
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 (*ControlComplianceSummaryIterator) PageInfo
func
(
it
*
ControlComplianceSummaryIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CreateFrameworkAuditOperation
type
CreateFrameworkAuditOperation
struct
{
// contains filtered or unexported fields
}
CreateFrameworkAuditOperation manages a long-running operation from CreateFrameworkAudit.
func (*CreateFrameworkAuditOperation) Done
func
(
op
*
CreateFrameworkAuditOperation
)
Done
()
bool
Done reports whether the long-running operation has completed.
func (*CreateFrameworkAuditOperation) Metadata
func
(
op
*
CreateFrameworkAuditOperation
)
Metadata
()
(
*
cloudsecuritycompliancepb
.
OperationMetadata
,
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 (*CreateFrameworkAuditOperation) Name
func
(
op
*
CreateFrameworkAuditOperation
)
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 (*CreateFrameworkAuditOperation) Poll
func
(
op
*
CreateFrameworkAuditOperation
)
Poll
(
ctx
context
.
Context
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
FrameworkAudit
,
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 (*CreateFrameworkAuditOperation) Wait
func
(
op
*
CreateFrameworkAuditOperation
)
Wait
(
ctx
context
.
Context
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
FrameworkAudit
,
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.
CreateFrameworkDeploymentOperation
type
CreateFrameworkDeploymentOperation
struct
{
// contains filtered or unexported fields
}
CreateFrameworkDeploymentOperation manages a long-running operation from CreateFrameworkDeployment.
func (*CreateFrameworkDeploymentOperation) Done
func
(
op
*
CreateFrameworkDeploymentOperation
)
Done
()
bool
Done reports whether the long-running operation has completed.
func (*CreateFrameworkDeploymentOperation) Metadata
func
(
op
*
CreateFrameworkDeploymentOperation
)
Metadata
()
(
*
cloudsecuritycompliancepb
.
OperationMetadata
,
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 (*CreateFrameworkDeploymentOperation) Name
func
(
op
*
CreateFrameworkDeploymentOperation
)
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 (*CreateFrameworkDeploymentOperation) Poll
func
(
op
*
CreateFrameworkDeploymentOperation
)
Poll
(
ctx
context
.
Context
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
FrameworkDeployment
,
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 (*CreateFrameworkDeploymentOperation) Wait
func
(
op
*
CreateFrameworkDeploymentOperation
)
Wait
(
ctx
context
.
Context
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
FrameworkDeployment
,
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.
DeleteFrameworkDeploymentOperation
type
DeleteFrameworkDeploymentOperation
struct
{
// contains filtered or unexported fields
}
DeleteFrameworkDeploymentOperation manages a long-running operation from DeleteFrameworkDeployment.
func (*DeleteFrameworkDeploymentOperation) Done
func
(
op
*
DeleteFrameworkDeploymentOperation
)
Done
()
bool
Done reports whether the long-running operation has completed.
func (*DeleteFrameworkDeploymentOperation) Metadata
func
(
op
*
DeleteFrameworkDeploymentOperation
)
Metadata
()
(
*
cloudsecuritycompliancepb
.
OperationMetadata
,
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 (*DeleteFrameworkDeploymentOperation) Name
func
(
op
*
DeleteFrameworkDeploymentOperation
)
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 (*DeleteFrameworkDeploymentOperation) Poll
func
(
op
*
DeleteFrameworkDeploymentOperation
)
Poll
(
ctx
context
.
Context
,
opts
...
gax
.
CallOption
)
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 (*DeleteFrameworkDeploymentOperation) Wait
func
(
op
*
DeleteFrameworkDeploymentOperation
)
Wait
(
ctx
context
.
Context
,
opts
...
gax
.
CallOption
)
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.
DeploymentCallOptions
type
DeploymentCallOptions
struct
{
CreateFrameworkDeployment
[]
gax
.
CallOption
DeleteFrameworkDeployment
[]
gax
.
CallOption
GetFrameworkDeployment
[]
gax
.
CallOption
ListFrameworkDeployments
[]
gax
.
CallOption
GetCloudControlDeployment
[]
gax
.
CallOption
ListCloudControlDeployments
[]
gax
.
CallOption
GetLocation
[]
gax
.
CallOption
ListLocations
[]
gax
.
CallOption
CancelOperation
[]
gax
.
CallOption
DeleteOperation
[]
gax
.
CallOption
GetOperation
[]
gax
.
CallOption
ListOperations
[]
gax
.
CallOption
}
DeploymentCallOptions contains the retry settings for each method of DeploymentClient.
DeploymentClient
type
DeploymentClient
struct
{
// The call options for this service.
CallOptions
*
DeploymentCallOptions
// 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
}
DeploymentClient is a client for interacting with Cloud Security Compliance API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Deployment service allows users to manage deployments of Frameworks and Cloud Controls on a target resource.
func NewDeploymentClient
func
NewDeploymentClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
DeploymentClient
,
error
)
NewDeploymentClient creates a new deployment client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Deployment service allows users to manage deployments of Frameworks and Cloud Controls on a target resource.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func NewDeploymentRESTClient
func
NewDeploymentRESTClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
DeploymentClient
,
error
)
NewDeploymentRESTClient creates a new deployment rest client.
Deployment service allows users to manage deployments of Frameworks and Cloud Controls on a target resource.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewDeploymentRESTClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func (*DeploymentClient) CancelOperation
func
(
c
*
DeploymentClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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 (*DeploymentClient) Close
func
(
c
*
DeploymentClient
)
Close
()
error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DeploymentClient) Connection (deprecated)
func
(
c
*
DeploymentClient
)
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 (*DeploymentClient) CreateFrameworkDeployment
func
(
c
*
DeploymentClient
)
CreateFrameworkDeployment
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
CreateFrameworkDeploymentRequest
,
opts
...
gax
.
CallOption
)
(
*
CreateFrameworkDeploymentOperation
,
error
)
CreateFrameworkDeployment creates a framework deployment in a given parent resource. A framework deployment lets you assign a particular framework version to an organization, folder, or project so that you can control and monitor those resources using the framework’s cloud controls.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
CreateFrameworkDeploymentRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#CreateFrameworkDeploymentRequest.
}
op
,
err
:=
c
.
CreateFrameworkDeployment
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
resp
,
err
:=
op
.
Wait
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*DeploymentClient) CreateFrameworkDeploymentOperation
func
(
c
*
DeploymentClient
)
CreateFrameworkDeploymentOperation
(
name
string
)
*
CreateFrameworkDeploymentOperation
CreateFrameworkDeploymentOperation returns a new CreateFrameworkDeploymentOperation from a given name. The name must be that of a previously created CreateFrameworkDeploymentOperation, possibly from a different process.
func (*DeploymentClient) DeleteFrameworkDeployment
func
(
c
*
DeploymentClient
)
DeleteFrameworkDeployment
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
DeleteFrameworkDeploymentRequest
,
opts
...
gax
.
CallOption
)
(
*
DeleteFrameworkDeploymentOperation
,
error
)
DeleteFrameworkDeployment deletes a framework deployment.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
DeleteFrameworkDeploymentRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#DeleteFrameworkDeploymentRequest.
}
op
,
err
:=
c
.
DeleteFrameworkDeployment
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
err
=
op
.
Wait
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
}
func (*DeploymentClient) DeleteFrameworkDeploymentOperation
func
(
c
*
DeploymentClient
)
DeleteFrameworkDeploymentOperation
(
name
string
)
*
DeleteFrameworkDeploymentOperation
DeleteFrameworkDeploymentOperation returns a new DeleteFrameworkDeploymentOperation from a given name. The name must be that of a previously created DeleteFrameworkDeploymentOperation, possibly from a different process.
func (*DeploymentClient) DeleteOperation
func
(
c
*
DeploymentClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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 (*DeploymentClient) GetCloudControlDeployment
func
(
c
*
DeploymentClient
)
GetCloudControlDeployment
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
GetCloudControlDeploymentRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
CloudControlDeployment
,
error
)
GetCloudControlDeployment gets details about a cloud control deployment.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
GetCloudControlDeploymentRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#GetCloudControlDeploymentRequest.
}
resp
,
err
:=
c
.
GetCloudControlDeployment
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*DeploymentClient) GetFrameworkDeployment
func
(
c
*
DeploymentClient
)
GetFrameworkDeployment
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
GetFrameworkDeploymentRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
FrameworkDeployment
,
error
)
GetFrameworkDeployment gets details about a framework deployment.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
GetFrameworkDeploymentRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#GetFrameworkDeploymentRequest.
}
resp
,
err
:=
c
.
GetFrameworkDeployment
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*DeploymentClient) GetLocation
func
(
c
*
DeploymentClient
)
GetLocation
(
ctx
context
.
Context
,
req
*
locationpb
.
GetLocationRequest
,
opts
...
gax
.
CallOption
)
(
*
locationpb
.
Location
,
error
)
GetLocation gets information about a location.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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 (*DeploymentClient) GetOperation
func
(
c
*
DeploymentClient
)
GetOperation
(
ctx
context
.
Context
,
req
*
longrunningpb
.
GetOperationRequest
,
opts
...
gax
.
CallOption
)
(
*
longrunningpb
.
Operation
,
error
)
GetOperation is a utility method from google.longrunning.Operations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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 (*DeploymentClient) ListCloudControlDeployments
func
(
c
*
DeploymentClient
)
ListCloudControlDeployments
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListCloudControlDeploymentsRequest
,
opts
...
gax
.
CallOption
)
*
CloudControlDeploymentIterator
ListCloudControlDeployments lists the cloud conrol deployments in a given parent resource.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListCloudControlDeploymentsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListCloudControlDeploymentsRequest.
}
it
:=
c
.
ListCloudControlDeployments
(
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
.(
*
cloudsecuritycompliancepb
.
ListCloudControlDeploymentsResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListCloudControlDeploymentsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListCloudControlDeploymentsRequest.
}
for
resp
,
err
:=
range
c
.
ListCloudControlDeployments
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*DeploymentClient) ListFrameworkDeployments
func
(
c
*
DeploymentClient
)
ListFrameworkDeployments
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListFrameworkDeploymentsRequest
,
opts
...
gax
.
CallOption
)
*
FrameworkDeploymentIterator
ListFrameworkDeployments lists the framework deployments in a given parent resource.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworkDeploymentsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworkDeploymentsRequest.
}
it
:=
c
.
ListFrameworkDeployments
(
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
.(
*
cloudsecuritycompliancepb
.
ListFrameworkDeploymentsResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworkDeploymentsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworkDeploymentsRequest.
}
for
resp
,
err
:=
range
c
.
ListFrameworkDeployments
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*DeploymentClient) ListLocations
func
(
c
*
DeploymentClient
)
ListLocations
(
ctx
context
.
Context
,
req
*
locationpb
.
ListLocationsRequest
,
opts
...
gax
.
CallOption
)
*
LocationIterator
ListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name )] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
"google.golang.org/api/iterator"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListLocations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*DeploymentClient) ListOperations
func
(
c
*
DeploymentClient
)
ListOperations
(
ctx
context
.
Context
,
req
*
longrunningpb
.
ListOperationsRequest
,
opts
...
gax
.
CallOption
)
*
OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewDeploymentClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListOperations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
FindingSummaryIterator
type
FindingSummaryIterator
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
[]
*
cloudsecuritycompliancepb
.
FindingSummary
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
FindingSummaryIterator manages a stream of *cloudsecuritycompliancepb.FindingSummary.
func (*FindingSummaryIterator) All
func
(
it
*
FindingSummaryIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
FindingSummary
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*FindingSummaryIterator) Next
func
(
it
*
FindingSummaryIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
FindingSummary
,
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 (*FindingSummaryIterator) PageInfo
func
(
it
*
FindingSummaryIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FrameworkAuditIterator
type
FrameworkAuditIterator
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
[]
*
cloudsecuritycompliancepb
.
FrameworkAudit
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
FrameworkAuditIterator manages a stream of *cloudsecuritycompliancepb.FrameworkAudit.
func (*FrameworkAuditIterator) All
func
(
it
*
FrameworkAuditIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
FrameworkAudit
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*FrameworkAuditIterator) Next
func
(
it
*
FrameworkAuditIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
FrameworkAudit
,
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 (*FrameworkAuditIterator) PageInfo
func
(
it
*
FrameworkAuditIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FrameworkComplianceSummaryIterator
type
FrameworkComplianceSummaryIterator
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
[]
*
cloudsecuritycompliancepb
.
FrameworkComplianceSummary
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
FrameworkComplianceSummaryIterator manages a stream of *cloudsecuritycompliancepb.FrameworkComplianceSummary.
func (*FrameworkComplianceSummaryIterator) All
func
(
it
*
FrameworkComplianceSummaryIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
FrameworkComplianceSummary
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*FrameworkComplianceSummaryIterator) Next
func
(
it
*
FrameworkComplianceSummaryIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
FrameworkComplianceSummary
,
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 (*FrameworkComplianceSummaryIterator) PageInfo
func
(
it
*
FrameworkComplianceSummaryIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FrameworkDeploymentIterator
type
FrameworkDeploymentIterator
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
[]
*
cloudsecuritycompliancepb
.
FrameworkDeployment
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
FrameworkDeploymentIterator manages a stream of *cloudsecuritycompliancepb.FrameworkDeployment.
func (*FrameworkDeploymentIterator) All
func
(
it
*
FrameworkDeploymentIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
FrameworkDeployment
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*FrameworkDeploymentIterator) Next
func
(
it
*
FrameworkDeploymentIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
FrameworkDeployment
,
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 (*FrameworkDeploymentIterator) PageInfo
func
(
it
*
FrameworkDeploymentIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FrameworkIterator
type
FrameworkIterator
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
[]
*
cloudsecuritycompliancepb
.
Framework
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
FrameworkIterator manages a stream of *cloudsecuritycompliancepb.Framework.
func (*FrameworkIterator) All
func
(
it
*
FrameworkIterator
)
All
()
iter
.
Seq2
[
*
cloudsecuritycompliancepb
.
Framework
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*FrameworkIterator) Next
func
(
it
*
FrameworkIterator
)
Next
()
(
*
cloudsecuritycompliancepb
.
Framework
,
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 (*FrameworkIterator) PageInfo
func
(
it
*
FrameworkIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
LocationIterator
type
LocationIterator
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
[]
*
locationpb
.
Location
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All
func
(
it
*
LocationIterator
)
All
()
iter
.
Seq2
[
*
locationpb
.
Location
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next
func
(
it
*
LocationIterator
)
Next
()
(
*
locationpb
.
Location
,
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 (*LocationIterator) PageInfo
func
(
it
*
LocationIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
MonitoringCallOptions
type
MonitoringCallOptions
struct
{
ListFrameworkComplianceSummaries
[]
gax
.
CallOption
ListFindingSummaries
[]
gax
.
CallOption
FetchFrameworkComplianceReport
[]
gax
.
CallOption
ListControlComplianceSummaries
[]
gax
.
CallOption
AggregateFrameworkComplianceReport
[]
gax
.
CallOption
GetLocation
[]
gax
.
CallOption
ListLocations
[]
gax
.
CallOption
CancelOperation
[]
gax
.
CallOption
DeleteOperation
[]
gax
.
CallOption
GetOperation
[]
gax
.
CallOption
ListOperations
[]
gax
.
CallOption
}
MonitoringCallOptions contains the retry settings for each method of MonitoringClient.
MonitoringClient
type
MonitoringClient
struct
{
// The call options for this service.
CallOptions
*
MonitoringCallOptions
// contains filtered or unexported fields
}
MonitoringClient is a client for interacting with Cloud Security Compliance API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service describing handlers for resources
func NewMonitoringClient
func
NewMonitoringClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
MonitoringClient
,
error
)
NewMonitoringClient creates a new monitoring client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service describing handlers for resources
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func NewMonitoringRESTClient
func
NewMonitoringRESTClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
MonitoringClient
,
error
)
NewMonitoringRESTClient creates a new monitoring rest client.
Service describing handlers for resources
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewMonitoringRESTClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func (*MonitoringClient) AggregateFrameworkComplianceReport
func
(
c
*
MonitoringClient
)
AggregateFrameworkComplianceReport
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
AggregateFrameworkComplianceReportRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
AggregateFrameworkComplianceReportResponse
,
error
)
AggregateFrameworkComplianceReport gets the aggregated compliance report over time for a given scope.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
AggregateFrameworkComplianceReportRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#AggregateFrameworkComplianceReportRequest.
}
resp
,
err
:=
c
.
AggregateFrameworkComplianceReport
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*MonitoringClient) CancelOperation
func
(
c
*
MonitoringClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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 (*MonitoringClient) Close
func
(
c
*
MonitoringClient
)
Close
()
error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*MonitoringClient) Connection (deprecated)
func
(
c
*
MonitoringClient
)
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 (*MonitoringClient) DeleteOperation
func
(
c
*
MonitoringClient
)
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"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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 (*MonitoringClient) FetchFrameworkComplianceReport
func
(
c
*
MonitoringClient
)
FetchFrameworkComplianceReport
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
FetchFrameworkComplianceReportRequest
,
opts
...
gax
.
CallOption
)
(
*
cloudsecuritycompliancepb
.
FrameworkComplianceReport
,
error
)
FetchFrameworkComplianceReport fetches the framework compliance report for a given scope.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
FetchFrameworkComplianceReportRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#FetchFrameworkComplianceReportRequest.
}
resp
,
err
:=
c
.
FetchFrameworkComplianceReport
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*MonitoringClient) GetLocation
func
(
c
*
MonitoringClient
)
GetLocation
(
ctx
context
.
Context
,
req
*
locationpb
.
GetLocationRequest
,
opts
...
gax
.
CallOption
)
(
*
locationpb
.
Location
,
error
)
GetLocation gets information about a location.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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 (*MonitoringClient) GetOperation
func
(
c
*
MonitoringClient
)
GetOperation
(
ctx
context
.
Context
,
req
*
longrunningpb
.
GetOperationRequest
,
opts
...
gax
.
CallOption
)
(
*
longrunningpb
.
Operation
,
error
)
GetOperation is a utility method from google.longrunning.Operations.
Example
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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 (*MonitoringClient) ListControlComplianceSummaries
func
(
c
*
MonitoringClient
)
ListControlComplianceSummaries
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListControlComplianceSummariesRequest
,
opts
...
gax
.
CallOption
)
*
ControlComplianceSummaryIterator
ListControlComplianceSummaries lists the control compliance summary for a given scope.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListControlComplianceSummariesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListControlComplianceSummariesRequest.
}
it
:=
c
.
ListControlComplianceSummaries
(
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
.(
*
cloudsecuritycompliancepb
.
ListControlComplianceSummariesResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListControlComplianceSummariesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListControlComplianceSummariesRequest.
}
for
resp
,
err
:=
range
c
.
ListControlComplianceSummaries
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*MonitoringClient) ListFindingSummaries
func
(
c
*
MonitoringClient
)
ListFindingSummaries
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListFindingSummariesRequest
,
opts
...
gax
.
CallOption
)
*
FindingSummaryIterator
ListFindingSummaries lists the finding summary by category for a given scope.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFindingSummariesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFindingSummariesRequest.
}
it
:=
c
.
ListFindingSummaries
(
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
.(
*
cloudsecuritycompliancepb
.
ListFindingSummariesResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFindingSummariesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFindingSummariesRequest.
}
for
resp
,
err
:=
range
c
.
ListFindingSummaries
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*MonitoringClient) ListFrameworkComplianceSummaries
func
(
c
*
MonitoringClient
)
ListFrameworkComplianceSummaries
(
ctx
context
.
Context
,
req
*
cloudsecuritycompliancepb
.
ListFrameworkComplianceSummariesRequest
,
opts
...
gax
.
CallOption
)
*
FrameworkComplianceSummaryIterator
ListFrameworkComplianceSummaries lists the framework compliance summary for a given scope.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworkComplianceSummariesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworkComplianceSummariesRequest.
}
it
:=
c
.
ListFrameworkComplianceSummaries
(
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
.(
*
cloudsecuritycompliancepb
.
ListFrameworkComplianceSummariesResponse
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
cloudsecuritycompliancepb
"cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& cloudsecuritycompliancepb
.
ListFrameworkComplianceSummariesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudsecuritycompliance/apiv1/cloudsecuritycompliancepb#ListFrameworkComplianceSummariesRequest.
}
for
resp
,
err
:=
range
c
.
ListFrameworkComplianceSummaries
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*MonitoringClient) ListLocations
func
(
c
*
MonitoringClient
)
ListLocations
(
ctx
context
.
Context
,
req
*
locationpb
.
ListLocationsRequest
,
opts
...
gax
.
CallOption
)
*
LocationIterator
ListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name )] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
"google.golang.org/api/iterator"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
locationpb
"google.golang.org/genproto/googleapis/cloud/location"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListLocations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*MonitoringClient) ListOperations
func
(
c
*
MonitoringClient
)
ListOperations
(
ctx
context
.
Context
,
req
*
longrunningpb
.
ListOperationsRequest
,
opts
...
gax
.
CallOption
)
*
OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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
)
}
}
all
package
main
import
(
"context"
cloudsecuritycompliance
"cloud.google.com/go/cloudsecuritycompliance/apiv1"
longrunningpb
"cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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
:=
cloudsecuritycompliance
.
NewMonitoringClient
(
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.
}
for
resp
,
err
:=
range
c
.
ListOperations
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
OperationIterator
type
OperationIterator
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
[]
*
longrunningpb
.
Operation
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func
(
it
*
OperationIterator
)
All
()
iter
.
Seq2
[
*
longrunningpb
.
Operation
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next
func
(
it
*
OperationIterator
)
Next
()
(
*
longrunningpb
.
Operation
,
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 (*OperationIterator) PageInfo
func
(
it
*
OperationIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.

