settings

package
v0.61.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

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 godoc.org/cloud.google.com/go.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type 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.

type 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.

type 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
}
Output:

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() {
	// 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
}
Output:

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() {
	// 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
}
Output:

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() {
	// 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
}
Output:

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() {
	// 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
}
Output:

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() {
	// 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
}
Output:

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() {
	// 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
}
Output:

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() {
	// 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
}
Output:

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() {
	// 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
	}
}
Output:

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() {
	// 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
	}
}
Output:

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.
	}

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

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.
	}

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

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() {
	// 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
}
Output:

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() {
	// 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
}
Output:

type 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL