Cloud Security Command Center API v1beta1 - Package cloud.google.com/go/securitycenter/settings/apiv1beta1 (v0.89.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.

NOTE: This package is in beta. It is not stable, and may be subject to changes.

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 https://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.

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.

func NewSecurityCenterSettingsClient

func NewSecurityCenterSettingsClient(ctx context.Context, opts ...option.ClientOption) (*SecurityCenterSettingsClient, error)

NewSecurityCenterSettingsClient creates a new security center settings service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

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.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*SecurityCenterSettingsClient) BatchCalculateEffectiveSettings

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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.
	}
	defer c.Close()

	req := &settingspb.ResetComponentSettingsRequest{
		// TODO: Fill request struct fields.
	}
	err = c.ResetComponentSettings(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*SecurityCenterSettingsClient) ResetSettings

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.
	}
	defer c.Close()

	req := &settingspb.ResetSettingsRequest{
		// TODO: Fill request struct fields.
	}
	err = c.ResetSettings(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*SecurityCenterSettingsClient) UpdateComponentSettings

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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

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() {
	ctx := context.Background()
	c, err := settings.NewSecurityCenterSettingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	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.