- 0.116.0 (latest)
- 0.115.1
- 0.114.0
- 0.113.0
- 0.112.2
- 0.111.0
- 0.110.10
- 0.109.0
- 0.108.0
- 0.107.0
- 0.106.0
- 0.105.0
- 0.104.0
- 0.103.0
- 0.102.1
- 0.101.1
- 0.100.2
- 0.99.0
- 0.98.0
- 0.97.0
- 0.96.0
- 0.95.0
- 0.94.1
- 0.93.3
- 0.92.3
- 0.91.1
- 0.90.0
- 0.89.0
- 0.88.0
- 0.87.0
- 0.86.0
- 0.85.0
- 0.84.0
- 0.83.0
- 0.82.0
- 0.81.0
- 0.80.0
- 0.79.0
- 0.78.0
- 0.77.0
- 0.76.0
- 0.75.0
Package settings is an auto-generated package for the Cloud Security Command Center API.
Cloud Security Command Center Settings API provides functionality to retrieve and update configurations.
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit pkg.go.dev/cloud.google.com/go.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
DetectorIterator
type DetectorIterator 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 []*settingspb.Detector, nextPageToken string, err error)
// contains filtered or unexported fields
}
DetectorIterator manages a stream of *settingspb.Detector.
func (*DetectorIterator) Next
func (it *DetectorIterator) Next() (*settingspb.Detector, 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 (*DetectorIterator) PageInfo
func (it *DetectorIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
SecurityCenterSettingsCallOptions
type SecurityCenterSettingsCallOptions struct {
GetServiceAccount []gax.CallOption
GetSettings []gax.CallOption
UpdateSettings []gax.CallOption
ResetSettings []gax.CallOption
BatchGetSettings []gax.CallOption
CalculateEffectiveSettings []gax.CallOption
BatchCalculateEffectiveSettings []gax.CallOption
GetComponentSettings []gax.CallOption
UpdateComponentSettings []gax.CallOption
ResetComponentSettings []gax.CallOption
CalculateEffectiveComponentSettings []gax.CallOption
ListDetectors []gax.CallOption
ListComponents []gax.CallOption
}
SecurityCenterSettingsCallOptions contains the retry settings for each method of SecurityCenterSettingsClient.
SecurityCenterSettingsClient
type SecurityCenterSettingsClient struct {
// The call options for this service.
CallOptions *SecurityCenterSettingsCallOptions
// contains filtered or unexported fields
}
SecurityCenterSettingsClient is a client for interacting with Cloud Security Command Center API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSecurityCenterSettingsClient
func NewSecurityCenterSettingsClient(ctx context.Context, opts ...option.ClientOption) (*SecurityCenterSettingsClient, error)
NewSecurityCenterSettingsClient creates a new security center settings service client.
API OverviewThe SecurityCenterSettingsService is a sub-api of securitycenter.googleapis.com. The service provides methods to manage Security Center Settings, and Component Settings for GCP organizations, folders, projects, and clusters.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
)
func main() {
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use client.
_ = c
}
func (*SecurityCenterSettingsClient) BatchCalculateEffectiveSettings
func (c *SecurityCenterSettingsClient) BatchCalculateEffectiveSettings(ctx context.Context, req *settingspb.BatchCalculateEffectiveSettingsRequest, opts ...gax.CallOption) (*settingspb.BatchCalculateEffectiveSettingsResponse, error)
BatchCalculateEffectiveSettings gets a list of effective settings.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.BatchCalculateEffectiveSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.BatchCalculateEffectiveSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) BatchGetSettings
func (c *SecurityCenterSettingsClient) BatchGetSettings(ctx context.Context, req *settingspb.BatchGetSettingsRequest, opts ...gax.CallOption) (*settingspb.BatchGetSettingsResponse, error)
BatchGetSettings gets a list of settings.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.BatchGetSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.BatchGetSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) CalculateEffectiveComponentSettings
func (c *SecurityCenterSettingsClient) CalculateEffectiveComponentSettings(ctx context.Context, req *settingspb.CalculateEffectiveComponentSettingsRequest, opts ...gax.CallOption) (*settingspb.ComponentSettings, error)
CalculateEffectiveComponentSettings gets the Effective Component Settings.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.CalculateEffectiveComponentSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CalculateEffectiveComponentSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) CalculateEffectiveSettings
func (c *SecurityCenterSettingsClient) CalculateEffectiveSettings(ctx context.Context, req *settingspb.CalculateEffectiveSettingsRequest, opts ...gax.CallOption) (*settingspb.Settings, error)
CalculateEffectiveSettings calculateEffectiveSettings looks up all of the Security Center Settings resources in the GCP resource hierarchy, and calculates the effective settings on that resource by applying the following rules:
Settings provided closer to the target resource take precedence over those further away (e.g. folder will override organization level settings).
Product defaults can be overridden at org, folder, project, and cluster levels.
Detectors will be filtered out if they belong to a billing tier the customer has not configured.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.CalculateEffectiveSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CalculateEffectiveSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) Close
func (c *SecurityCenterSettingsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SecurityCenterSettingsClient) Connection
func (c *SecurityCenterSettingsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*SecurityCenterSettingsClient) GetComponentSettings
func (c *SecurityCenterSettingsClient) GetComponentSettings(ctx context.Context, req *settingspb.GetComponentSettingsRequest, opts ...gax.CallOption) (*settingspb.ComponentSettings, error)
GetComponentSettings gets the Component Settings.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.GetComponentSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetComponentSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) GetServiceAccount
func (c *SecurityCenterSettingsClient) GetServiceAccount(ctx context.Context, req *settingspb.GetServiceAccountRequest, opts ...gax.CallOption) (*settingspb.ServiceAccount, error)
GetServiceAccount retrieves the organizations service account, if it exists, otherwise it creates the organization service account. This API is idempotent and will only create a service account once. On subsequent calls it will return the previously created service account. SHA, SCC and CTD Infra Automation will use this SA. This SA will not have any permissions when created. The UI will provision this via IAM or the user will using their own internal process. This API only creates SAs on the organization. Folders are not supported and projects will use per-project SAs associated with APIs enabled on a project. This API will be called by the UX onboarding workflow.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.GetServiceAccountRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetServiceAccount(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) GetSettings
func (c *SecurityCenterSettingsClient) GetSettings(ctx context.Context, req *settingspb.GetSettingsRequest, opts ...gax.CallOption) (*settingspb.Settings, error)
GetSettings gets the Settings.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.GetSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) ListComponents
func (c *SecurityCenterSettingsClient) ListComponents(ctx context.Context, req *settingspb.ListComponentsRequest, opts ...gax.CallOption) *StringIterator
ListComponents retrieves an unordered list of available SCC components.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
"google.golang.org/api/iterator"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
// import "google.golang.org/api/iterator"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.ListComponentsRequest{
// TODO: Fill request struct fields.
}
it := c.ListComponents(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*SecurityCenterSettingsClient) ListDetectors
func (c *SecurityCenterSettingsClient) ListDetectors(ctx context.Context, req *settingspb.ListDetectorsRequest, opts ...gax.CallOption) *DetectorIterator
ListDetectors retrieves an unordered list of available detectors.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
"google.golang.org/api/iterator"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
// import "google.golang.org/api/iterator"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.ListDetectorsRequest{
// TODO: Fill request struct fields.
}
it := c.ListDetectors(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*SecurityCenterSettingsClient) ResetComponentSettings
func (c *SecurityCenterSettingsClient) ResetComponentSettings(ctx context.Context, req *settingspb.ResetComponentSettingsRequest, opts ...gax.CallOption) error
ResetComponentSettings reset the organization, folder or project’s component settings and return the settings to the default. Settings are present at the organization, folder and project levels. Using Reset for a folder or project will remove the override that was set and result in the organization-level settings being used.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.ResetComponentSettingsRequest{
// TODO: Fill request struct fields.
}
err = c.ResetComponentSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*SecurityCenterSettingsClient) ResetSettings
func (c *SecurityCenterSettingsClient) ResetSettings(ctx context.Context, req *settingspb.ResetSettingsRequest, opts ...gax.CallOption) error
ResetSettings reset the organization, folder or project’s settings and return the settings of just that resource to the default.
Settings are present at the organization, folder, project, and cluster levels. Using Reset on a sub-organization level will remove that resource’s override and result in the parent’s settings being used (eg: if Reset on a cluster, project settings will be used).
Using Reset on organization will remove the override that was set and result in default settings being used.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.ResetSettingsRequest{
// TODO: Fill request struct fields.
}
err = c.ResetSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*SecurityCenterSettingsClient) UpdateComponentSettings
func (c *SecurityCenterSettingsClient) UpdateComponentSettings(ctx context.Context, req *settingspb.UpdateComponentSettingsRequest, opts ...gax.CallOption) (*settingspb.ComponentSettings, error)
UpdateComponentSettings updates the Component Settings.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.UpdateComponentSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateComponentSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SecurityCenterSettingsClient) UpdateSettings
func (c *SecurityCenterSettingsClient) UpdateSettings(ctx context.Context, req *settingspb.UpdateSettingsRequest, opts ...gax.CallOption) (*settingspb.Settings, error)
UpdateSettings updates the Settings.
Example
package main
import (
"context"
settings "cloud.google.com/go/securitycenter/settings/apiv1beta1"
settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
)
func main() {
// import settingspb "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1"
ctx := context.Background()
c, err := settings.NewSecurityCenterSettingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &settingspb.UpdateSettingsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
StringIterator
type StringIterator 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 []string, nextPageToken string, err error)
// contains filtered or unexported fields
}
StringIterator manages a stream of string.
func (*StringIterator) Next
func (it *StringIterator) Next() (string, 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 (*StringIterator) PageInfo
func (it *StringIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.