Documentation ¶
Overview ¶
Package securitycenter is an auto-generated package for the Security Command Center API.
Security Command Center API provides access to temporal views of assets and findings within an organization.
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 CallOptions
- type Client
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConn
- func (c *Client) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest, ...) (*securitycenterpb.Finding, error)
- func (c *Client) CreateNotificationConfig(ctx context.Context, req *securitycenterpb.CreateNotificationConfigRequest, ...) (*securitycenterpb.NotificationConfig, error)
- func (c *Client) CreateSource(ctx context.Context, req *securitycenterpb.CreateSourceRequest, ...) (*securitycenterpb.Source, error)
- func (c *Client) DeleteNotificationConfig(ctx context.Context, req *securitycenterpb.DeleteNotificationConfigRequest, ...) error
- func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *Client) GetNotificationConfig(ctx context.Context, req *securitycenterpb.GetNotificationConfigRequest, ...) (*securitycenterpb.NotificationConfig, error)
- func (c *Client) GetOrganizationSettings(ctx context.Context, req *securitycenterpb.GetOrganizationSettingsRequest, ...) (*securitycenterpb.OrganizationSettings, error)
- func (c *Client) GetSource(ctx context.Context, req *securitycenterpb.GetSourceRequest, ...) (*securitycenterpb.Source, error)
- func (c *Client) GroupAssets(ctx context.Context, req *securitycenterpb.GroupAssetsRequest, ...) *GroupResultIterator
- func (c *Client) GroupFindings(ctx context.Context, req *securitycenterpb.GroupFindingsRequest, ...) *GroupResultIterator
- func (c *Client) ListAssets(ctx context.Context, req *securitycenterpb.ListAssetsRequest, ...) *ListAssetsResponse_ListAssetsResultIterator
- func (c *Client) ListFindings(ctx context.Context, req *securitycenterpb.ListFindingsRequest, ...) *ListFindingsResponse_ListFindingsResultIterator
- func (c *Client) ListNotificationConfigs(ctx context.Context, req *securitycenterpb.ListNotificationConfigsRequest, ...) *NotificationConfigIterator
- func (c *Client) ListSources(ctx context.Context, req *securitycenterpb.ListSourcesRequest, ...) *SourceIterator
- func (c *Client) RunAssetDiscovery(ctx context.Context, req *securitycenterpb.RunAssetDiscoveryRequest, ...) (*RunAssetDiscoveryOperation, error)
- func (c *Client) RunAssetDiscoveryOperation(name string) *RunAssetDiscoveryOperation
- func (c *Client) SetFindingState(ctx context.Context, req *securitycenterpb.SetFindingStateRequest, ...) (*securitycenterpb.Finding, error)
- func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, ...) (*iampb.TestIamPermissionsResponse, error)
- func (c *Client) UpdateFinding(ctx context.Context, req *securitycenterpb.UpdateFindingRequest, ...) (*securitycenterpb.Finding, error)
- func (c *Client) UpdateNotificationConfig(ctx context.Context, req *securitycenterpb.UpdateNotificationConfigRequest, ...) (*securitycenterpb.NotificationConfig, error)
- func (c *Client) UpdateOrganizationSettings(ctx context.Context, req *securitycenterpb.UpdateOrganizationSettingsRequest, ...) (*securitycenterpb.OrganizationSettings, error)
- func (c *Client) UpdateSecurityMarks(ctx context.Context, req *securitycenterpb.UpdateSecurityMarksRequest, ...) (*securitycenterpb.SecurityMarks, error)
- func (c *Client) UpdateSource(ctx context.Context, req *securitycenterpb.UpdateSourceRequest, ...) (*securitycenterpb.Source, error)
- type GroupResultIterator
- type ListAssetsResponse_ListAssetsResultIterator
- type ListFindingsResponse_ListFindingsResultIterator
- type NotificationConfigIterator
- type RunAssetDiscoveryOperation
- func (op *RunAssetDiscoveryOperation) Done() bool
- func (op *RunAssetDiscoveryOperation) Metadata() (*emptypb.Empty, error)
- func (op *RunAssetDiscoveryOperation) Name() string
- func (op *RunAssetDiscoveryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.RunAssetDiscoveryResponse, error)
- func (op *RunAssetDiscoveryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.RunAssetDiscoveryResponse, error)
- type SourceIterator
Examples ¶
- Client.CreateFinding
- Client.CreateNotificationConfig
- Client.CreateSource
- Client.DeleteNotificationConfig
- Client.GetIamPolicy
- Client.GetNotificationConfig
- Client.GetOrganizationSettings
- Client.GetSource
- Client.GroupAssets
- Client.GroupFindings
- Client.ListAssets
- Client.ListFindings
- Client.ListNotificationConfigs
- Client.ListSources
- Client.RunAssetDiscovery
- Client.SetFindingState
- Client.SetIamPolicy
- Client.TestIamPermissions
- Client.UpdateFinding
- Client.UpdateNotificationConfig
- Client.UpdateOrganizationSettings
- Client.UpdateSecurityMarks
- Client.UpdateSource
- NewClient
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 CallOptions ¶
type CallOptions struct { CreateSource []gax.CallOption CreateFinding []gax.CallOption CreateNotificationConfig []gax.CallOption DeleteNotificationConfig []gax.CallOption GetIamPolicy []gax.CallOption GetNotificationConfig []gax.CallOption GetOrganizationSettings []gax.CallOption GetSource []gax.CallOption GroupAssets []gax.CallOption GroupFindings []gax.CallOption ListAssets []gax.CallOption ListFindings []gax.CallOption ListNotificationConfigs []gax.CallOption ListSources []gax.CallOption RunAssetDiscovery []gax.CallOption SetFindingState []gax.CallOption SetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption UpdateFinding []gax.CallOption UpdateNotificationConfig []gax.CallOption UpdateOrganizationSettings []gax.CallOption UpdateSource []gax.CallOption UpdateSecurityMarks []gax.CallOption }
CallOptions contains the retry settings for each method of Client.
type Client ¶
type Client struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *CallOptions // contains filtered or unexported fields }
Client is a client for interacting with Security Command Center API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewClient ¶
NewClient creates a new security center client.
V1p1Beta1 APIs for Security Center service.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" ) func main() { ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection ¶
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*Client) CreateFinding ¶
func (c *Client) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error)
CreateFinding creates a finding. The corresponding source must exist for finding creation to succeed.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.CreateFindingRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateFinding(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) CreateNotificationConfig ¶
func (c *Client) CreateNotificationConfig(ctx context.Context, req *securitycenterpb.CreateNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, error)
CreateNotificationConfig creates a notification config.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.CreateNotificationConfigRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateNotificationConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) CreateSource ¶
func (c *Client) CreateSource(ctx context.Context, req *securitycenterpb.CreateSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error)
CreateSource creates a source.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.CreateSourceRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateSource(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) DeleteNotificationConfig ¶
func (c *Client) DeleteNotificationConfig(ctx context.Context, req *securitycenterpb.DeleteNotificationConfigRequest, opts ...gax.CallOption) error
DeleteNotificationConfig deletes a notification config.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.DeleteNotificationConfigRequest{ // TODO: Fill request struct fields. } err = c.DeleteNotificationConfig(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) GetIamPolicy ¶
func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the access control policy on the specified Source.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" iampb "google.golang.org/genproto/googleapis/iam/v1" ) func main() { // import iampb "google.golang.org/genproto/googleapis/iam/v1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &iampb.GetIamPolicyRequest{ // TODO: Fill request struct fields. } resp, err := c.GetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetNotificationConfig ¶
func (c *Client) GetNotificationConfig(ctx context.Context, req *securitycenterpb.GetNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, error)
GetNotificationConfig gets a notification config.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.GetNotificationConfigRequest{ // TODO: Fill request struct fields. } resp, err := c.GetNotificationConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetOrganizationSettings ¶
func (c *Client) GetOrganizationSettings(ctx context.Context, req *securitycenterpb.GetOrganizationSettingsRequest, opts ...gax.CallOption) (*securitycenterpb.OrganizationSettings, error)
GetOrganizationSettings gets the settings for an organization.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.GetOrganizationSettingsRequest{ // TODO: Fill request struct fields. } resp, err := c.GetOrganizationSettings(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetSource ¶
func (c *Client) GetSource(ctx context.Context, req *securitycenterpb.GetSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error)
GetSource gets a source.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.GetSourceRequest{ // TODO: Fill request struct fields. } resp, err := c.GetSource(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GroupAssets ¶
func (c *Client) GroupAssets(ctx context.Context, req *securitycenterpb.GroupAssetsRequest, opts ...gax.CallOption) *GroupResultIterator
GroupAssets filters an organization’s assets and groups them by their specified properties.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" "google.golang.org/api/iterator" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.GroupAssetsRequest{ // TODO: Fill request struct fields. } it := c.GroupAssets(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) GroupFindings ¶
func (c *Client) GroupFindings(ctx context.Context, req *securitycenterpb.GroupFindingsRequest, opts ...gax.CallOption) *GroupResultIterator
GroupFindings filters an organization or source’s findings and groups them by their specified properties.
To group across all sources provide a - as the source id. Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" "google.golang.org/api/iterator" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.GroupFindingsRequest{ // TODO: Fill request struct fields. } it := c.GroupFindings(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListAssets ¶
func (c *Client) ListAssets(ctx context.Context, req *securitycenterpb.ListAssetsRequest, opts ...gax.CallOption) *ListAssetsResponse_ListAssetsResultIterator
ListAssets lists an organization’s assets.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" "google.golang.org/api/iterator" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.ListAssetsRequest{ // TODO: Fill request struct fields. } it := c.ListAssets(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListFindings ¶
func (c *Client) ListFindings(ctx context.Context, req *securitycenterpb.ListFindingsRequest, opts ...gax.CallOption) *ListFindingsResponse_ListFindingsResultIterator
ListFindings lists an organization or source’s findings.
To list across all sources provide a - as the source id. Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" "google.golang.org/api/iterator" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.ListFindingsRequest{ // TODO: Fill request struct fields. } it := c.ListFindings(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListNotificationConfigs ¶
func (c *Client) ListNotificationConfigs(ctx context.Context, req *securitycenterpb.ListNotificationConfigsRequest, opts ...gax.CallOption) *NotificationConfigIterator
ListNotificationConfigs lists notification configs.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" "google.golang.org/api/iterator" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.ListNotificationConfigsRequest{ // TODO: Fill request struct fields. } it := c.ListNotificationConfigs(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListSources ¶
func (c *Client) ListSources(ctx context.Context, req *securitycenterpb.ListSourcesRequest, opts ...gax.CallOption) *SourceIterator
ListSources lists all sources belonging to an organization.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" "google.golang.org/api/iterator" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.ListSourcesRequest{ // TODO: Fill request struct fields. } it := c.ListSources(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) RunAssetDiscovery ¶
func (c *Client) RunAssetDiscovery(ctx context.Context, req *securitycenterpb.RunAssetDiscoveryRequest, opts ...gax.CallOption) (*RunAssetDiscoveryOperation, error)
RunAssetDiscovery runs asset discovery. The discovery is tracked with a long-running operation.
This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.RunAssetDiscoveryRequest{ // TODO: Fill request struct fields. } op, err := c.RunAssetDiscovery(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) RunAssetDiscoveryOperation ¶
func (c *Client) RunAssetDiscoveryOperation(name string) *RunAssetDiscoveryOperation
RunAssetDiscoveryOperation returns a new RunAssetDiscoveryOperation from a given name. The name must be that of a previously created RunAssetDiscoveryOperation, possibly from a different process.
func (*Client) SetFindingState ¶
func (c *Client) SetFindingState(ctx context.Context, req *securitycenterpb.SetFindingStateRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error)
SetFindingState updates the state of a finding.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.SetFindingStateRequest{ // TODO: Fill request struct fields. } resp, err := c.SetFindingState(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) SetIamPolicy ¶
func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the access control policy on the specified Source.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" iampb "google.golang.org/genproto/googleapis/iam/v1" ) func main() { // import iampb "google.golang.org/genproto/googleapis/iam/v1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &iampb.SetIamPolicyRequest{ // TODO: Fill request struct fields. } resp, err := c.SetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) TestIamPermissions ¶
func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions returns the permissions that a caller has on the specified source.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" iampb "google.golang.org/genproto/googleapis/iam/v1" ) func main() { // import iampb "google.golang.org/genproto/googleapis/iam/v1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &iampb.TestIamPermissionsRequest{ // TODO: Fill request struct fields. } resp, err := c.TestIamPermissions(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UpdateFinding ¶
func (c *Client) UpdateFinding(ctx context.Context, req *securitycenterpb.UpdateFindingRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error)
UpdateFinding creates or updates a finding. The corresponding source must exist for a finding creation to succeed.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.UpdateFindingRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateFinding(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UpdateNotificationConfig ¶
func (c *Client) UpdateNotificationConfig(ctx context.Context, req *securitycenterpb.UpdateNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, error)
UpdateNotificationConfig updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.UpdateNotificationConfigRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateNotificationConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UpdateOrganizationSettings ¶
func (c *Client) UpdateOrganizationSettings(ctx context.Context, req *securitycenterpb.UpdateOrganizationSettingsRequest, opts ...gax.CallOption) (*securitycenterpb.OrganizationSettings, error)
UpdateOrganizationSettings updates an organization’s settings.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.UpdateOrganizationSettingsRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateOrganizationSettings(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UpdateSecurityMarks ¶
func (c *Client) UpdateSecurityMarks(ctx context.Context, req *securitycenterpb.UpdateSecurityMarksRequest, opts ...gax.CallOption) (*securitycenterpb.SecurityMarks, error)
UpdateSecurityMarks updates security marks.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.UpdateSecurityMarksRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateSecurityMarks(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UpdateSource ¶
func (c *Client) UpdateSource(ctx context.Context, req *securitycenterpb.UpdateSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error)
UpdateSource updates a source.
Example ¶
package main import ( "context" securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1" securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ) func main() { // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1" ctx := context.Background() c, err := securitycenter.NewClient(ctx) if err != nil { // TODO: Handle error. } req := &securitycenterpb.UpdateSourceRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateSource(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type GroupResultIterator ¶
type GroupResultIterator 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 []*securitycenterpb.GroupResult, nextPageToken string, err error) // contains filtered or unexported fields }
GroupResultIterator manages a stream of *securitycenterpb.GroupResult.
func (*GroupResultIterator) Next ¶
func (it *GroupResultIterator) Next() (*securitycenterpb.GroupResult, 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 (*GroupResultIterator) PageInfo ¶
func (it *GroupResultIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ListAssetsResponse_ListAssetsResultIterator ¶
type ListAssetsResponse_ListAssetsResultIterator 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 []*securitycenterpb.ListAssetsResponse_ListAssetsResult, nextPageToken string, err error) // contains filtered or unexported fields }
ListAssetsResponse_ListAssetsResultIterator manages a stream of *securitycenterpb.ListAssetsResponse_ListAssetsResult.
func (*ListAssetsResponse_ListAssetsResultIterator) Next ¶
func (it *ListAssetsResponse_ListAssetsResultIterator) Next() (*securitycenterpb.ListAssetsResponse_ListAssetsResult, 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 (*ListAssetsResponse_ListAssetsResultIterator) PageInfo ¶
func (it *ListAssetsResponse_ListAssetsResultIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ListFindingsResponse_ListFindingsResultIterator ¶
type ListFindingsResponse_ListFindingsResultIterator 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 []*securitycenterpb.ListFindingsResponse_ListFindingsResult, nextPageToken string, err error) // contains filtered or unexported fields }
ListFindingsResponse_ListFindingsResultIterator manages a stream of *securitycenterpb.ListFindingsResponse_ListFindingsResult.
func (*ListFindingsResponse_ListFindingsResultIterator) Next ¶
func (it *ListFindingsResponse_ListFindingsResultIterator) Next() (*securitycenterpb.ListFindingsResponse_ListFindingsResult, 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 (*ListFindingsResponse_ListFindingsResultIterator) PageInfo ¶
func (it *ListFindingsResponse_ListFindingsResultIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type NotificationConfigIterator ¶
type NotificationConfigIterator 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 []*securitycenterpb.NotificationConfig, nextPageToken string, err error) // contains filtered or unexported fields }
NotificationConfigIterator manages a stream of *securitycenterpb.NotificationConfig.
func (*NotificationConfigIterator) Next ¶
func (it *NotificationConfigIterator) Next() (*securitycenterpb.NotificationConfig, 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 (*NotificationConfigIterator) PageInfo ¶
func (it *NotificationConfigIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type RunAssetDiscoveryOperation ¶
type RunAssetDiscoveryOperation struct {
// contains filtered or unexported fields
}
RunAssetDiscoveryOperation manages a long-running operation from RunAssetDiscovery.
func (*RunAssetDiscoveryOperation) Done ¶
func (op *RunAssetDiscoveryOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RunAssetDiscoveryOperation) Metadata ¶
func (op *RunAssetDiscoveryOperation) Metadata() (*emptypb.Empty, 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 (*RunAssetDiscoveryOperation) Name ¶
func (op *RunAssetDiscoveryOperation) 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 (*RunAssetDiscoveryOperation) Poll ¶
func (op *RunAssetDiscoveryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.RunAssetDiscoveryResponse, 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 (*RunAssetDiscoveryOperation) Wait ¶
func (op *RunAssetDiscoveryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.RunAssetDiscoveryResponse, 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.
type SourceIterator ¶
type SourceIterator 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 []*securitycenterpb.Source, nextPageToken string, err error) // contains filtered or unexported fields }
SourceIterator manages a stream of *securitycenterpb.Source.
func (*SourceIterator) Next ¶
func (it *SourceIterator) Next() (*securitycenterpb.Source, 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 (*SourceIterator) PageInfo ¶
func (it *SourceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.