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 ¶
- func DefaultAuthScopes() []string
- type DetectorIterator
- type SecurityCenterSettingsCallOptions
- type SecurityCenterSettingsClient
- func (c *SecurityCenterSettingsClient) BatchCalculateEffectiveSettings(ctx context.Context, req *settingspb.BatchCalculateEffectiveSettingsRequest, ...) (*settingspb.BatchCalculateEffectiveSettingsResponse, error)
- func (c *SecurityCenterSettingsClient) BatchGetSettings(ctx context.Context, req *settingspb.BatchGetSettingsRequest, ...) (*settingspb.BatchGetSettingsResponse, error)
- func (c *SecurityCenterSettingsClient) CalculateEffectiveComponentSettings(ctx context.Context, ...) (*settingspb.ComponentSettings, error)
- func (c *SecurityCenterSettingsClient) CalculateEffectiveSettings(ctx context.Context, req *settingspb.CalculateEffectiveSettingsRequest, ...) (*settingspb.Settings, error)
- func (c *SecurityCenterSettingsClient) Close() error
- func (c *SecurityCenterSettingsClient) Connection() *grpc.ClientConn
- func (c *SecurityCenterSettingsClient) GetComponentSettings(ctx context.Context, req *settingspb.GetComponentSettingsRequest, ...) (*settingspb.ComponentSettings, error)
- func (c *SecurityCenterSettingsClient) GetServiceAccount(ctx context.Context, req *settingspb.GetServiceAccountRequest, ...) (*settingspb.ServiceAccount, error)
- func (c *SecurityCenterSettingsClient) GetSettings(ctx context.Context, req *settingspb.GetSettingsRequest, ...) (*settingspb.Settings, error)
- func (c *SecurityCenterSettingsClient) ListComponents(ctx context.Context, req *settingspb.ListComponentsRequest, ...) *StringIterator
- func (c *SecurityCenterSettingsClient) ListDetectors(ctx context.Context, req *settingspb.ListDetectorsRequest, ...) *DetectorIterator
- func (c *SecurityCenterSettingsClient) ResetComponentSettings(ctx context.Context, req *settingspb.ResetComponentSettingsRequest, ...) error
- func (c *SecurityCenterSettingsClient) ResetSettings(ctx context.Context, req *settingspb.ResetSettingsRequest, ...) error
- func (c *SecurityCenterSettingsClient) UpdateComponentSettings(ctx context.Context, req *settingspb.UpdateComponentSettingsRequest, ...) (*settingspb.ComponentSettings, error)
- func (c *SecurityCenterSettingsClient) UpdateSettings(ctx context.Context, req *settingspb.UpdateSettingsRequest, ...) (*settingspb.Settings, error)
- type StringIterator
Examples ¶
- NewSecurityCenterSettingsClient
- SecurityCenterSettingsClient.BatchCalculateEffectiveSettings
- SecurityCenterSettingsClient.BatchGetSettings
- SecurityCenterSettingsClient.CalculateEffectiveComponentSettings
- SecurityCenterSettingsClient.CalculateEffectiveSettings
- SecurityCenterSettingsClient.GetComponentSettings
- SecurityCenterSettingsClient.GetServiceAccount
- SecurityCenterSettingsClient.GetSettings
- SecurityCenterSettingsClient.ListComponents
- SecurityCenterSettingsClient.ListDetectors
- SecurityCenterSettingsClient.ResetComponentSettings
- SecurityCenterSettingsClient.ResetSettings
- SecurityCenterSettingsClient.UpdateComponentSettings
- SecurityCenterSettingsClient.UpdateSettings
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 ¶
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 }
Output:
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 }
Output:
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 }
Output:
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 }
Output:
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 }
Output:
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 }
Output:
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 }
Output:
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 } }
Output:
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 } }
Output:
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. } }
Output:
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. } }
Output:
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 }
Output:
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 }
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.