Documentation ¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest) error
- func (c *Client) CreateSource(ctx context.Context, organizationID, displayName, description string) (*securitycenterpb.Source, error)
- func (c *Client) GetIamPolicy(ctx context.Context, source string) (*iampb.Policy, error)
- func (c *Client) GetSource(ctx context.Context, source string) (*securitycenterpb.Source, error)
- func (c *Client) GetSourceNameForDisplayName(ctx context.Context, organizationID, displayName string) (string, error)
- func (c *Client) ListSources(ctx context.Context, organizationID string) ([]*securitycenterpb.Source, error)
- func (c *Client) SetIamPolicy(ctx context.Context, source string, policy *iampb.Policy) (*iampb.Policy, error)
- func (c *Client) SetPageSize(pageSize int) error
- func (c *Client) SetTimeout(timeout time.Duration) error
- func (c *Client) SyncFindings(ctx context.Context, source string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for the Security Command Center API v1. Wraps the googleapis client.
func NewClient ¶
func NewClient(ctx context.Context, log logr.Logger, googleServiceAccount string, dryRun bool, opts ...option.ClientOption) (*Client, error)
NewClient creates a Client for the Security Command Center API v1. Remember to `defer Close()` to clean up.
Note: All methods creates child contextx (with timeouts) from the provided context.
Optional arguments: - a logr.Logger. Default to stdr, which is a wrapper of Go's system log package. - a Google Service Account to impersonate. Defaults to no impersonation for empty string. - ClientOptions from the google.golang.org/api/option package
func (*Client) CreateFinding ¶
func (c *Client) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest) error
CreateFinding using the provided CreateFindingRequest Ref: https://cloud.google.com/security-command-center/docs/reference/rest/v1/organizations.sources.findings/create
func (*Client) CreateSource ¶
func (c *Client) CreateSource(ctx context.Context, organizationID, displayName, description string) (*securitycenterpb.Source, error)
CreateSource creates a source. Returns an error if a source exists for the organization with the same displayName. Ref: https://cloud.google.com/security-command-center/docs/reference/rest/v1/organizations.sources/create
func (*Client) GetIamPolicy ¶
GetIamPolicy for the provided source.
The `source` input argument should be in the format `organizations/[organization_id]/sources/[source_id]`
func (*Client) GetSource ¶
GetSource gets a source by its full name in the format `organizations/[organization_id]/sources/[source_id]` Ref: https://cloud.google.com/security-command-center/docs/reference/rest/v1/organizations.sources/get
func (*Client) GetSourceNameForDisplayName ¶
func (c *Client) GetSourceNameForDisplayName(ctx context.Context, organizationID, displayName string) (string, error)
GetSourceNameForDisplayName can be used to check if a source with the same display name already exists for the provided organization (case insensitive match). Returns the full source name of the existing source with the provided display name. If no source exists for the provided display name, this method returns the empty string and nil error. Ref: https://cloud.google.com/security-command-center/docs/reference/rest/v1/organizations.sources
func (*Client) ListSources ¶
func (c *Client) ListSources(ctx context.Context, organizationID string) ([]*securitycenterpb.Source, error)
ListSources retrieves all sources for the provided numeric organization ID. Ref: https://cloud.google.com/security-command-center/docs/reference/rest/v1/organizations.sources/list
func (*Client) SetIamPolicy ¶
func (c *Client) SetIamPolicy(ctx context.Context, source string, policy *iampb.Policy) (*iampb.Policy, error)
SetIamPolicy for the provided source using the provided policy
The `source` input argument should be in the format `organizations/[organization_id]/sources/[source_id]`
func (*Client) SetPageSize ¶
SetPageSize for list calls to the Security Center API
func (*Client) SetTimeout ¶
SetTimeout for calls to the Security Center API
func (*Client) SyncFindings ¶
func (c *Client) SyncFindings(ctx context.Context, source string, findingRequests map[string]*securitycenterpb.CreateFindingRequest) error
SyncFindings synchronizes the findings already in Security Command Center (SCC) with the provided finding requests