Documentation
¶
Index ¶
- type Backend
- func (backend *Backend) CloseClient() error
- func (backend *Backend) FindDocumentIDsByHash(ctx context.Context, algorithm sbom.HashAlgorithm, value string) ([]string, error)
- func (backend *Backend) FindDocumentIDsByIdentifier(ctx context.Context, value string) ([]string, error)
- func (backend *Backend) FindDocumentIDsByName(ctx context.Context, name string) ([]string, error)
- func (backend *Backend) InitClient() error
- func (backend *Backend) Retrieve(id string, _ *storage.RetrieveOptions) (*sbom.Document, error)
- func (backend *Backend) Store(doc *sbom.Document, opts *storage.StoreOptions) error
- type BackendOptions
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// Options is the set of options for the GCS Backend.
Options *BackendOptions
// contains filtered or unexported fields
}
Backend implements the protobom/storage.Backend interface backed by Google Cloud Storage. It adapts a GCS bucket to the shared objectstore.Backend.
func NewBackend ¶
NewBackend creates a new GCS Backend, applying the given options on top of the defaults.
func (*Backend) CloseClient ¶
CloseClient closes the underlying storage client.
func (*Backend) FindDocumentIDsByHash ¶
func (backend *Backend) FindDocumentIDsByHash( ctx context.Context, algorithm sbom.HashAlgorithm, value string, ) ([]string, error)
FindDocumentIDsByHash returns the ids of stored documents that contain a node with the given hash.
func (*Backend) FindDocumentIDsByIdentifier ¶
func (backend *Backend) FindDocumentIDsByIdentifier(ctx context.Context, value string) ([]string, error)
FindDocumentIDsByIdentifier returns the ids of stored documents that contain a node with the given software identifier (purl, cpe or gitoid).
func (*Backend) FindDocumentIDsByName ¶
FindDocumentIDsByName returns the ids of stored documents that contain a node with the given name (matched case-insensitively).
func (*Backend) InitClient ¶
InitClient connects to Google Cloud Storage, optionally creates the target bucket and wires up the shared object-store backend.
type BackendOptions ¶
type BackendOptions struct {
// Bucket is the name of the GCS bucket that holds the objects.
Bucket string
// Prefix is an optional object-key prefix applied to every key.
Prefix string
// ProjectID is the GCP project used when CreateBucket is set.
ProjectID string
// ClientOptions are passed through to the underlying storage client
// (credentials, endpoints, ...). Leave empty to use default credentials.
ClientOptions []option.ClientOption
// CreateBucket creates the bucket on InitClient if it does not exist.
CreateBucket bool
}
BackendOptions contains options specific to the protobom GCS backend. Field order is chosen to satisfy the fieldalignment linter.
func NewBackendOptions ¶
func NewBackendOptions() *BackendOptions
NewBackendOptions creates a new, empty BackendOptions.
type Option ¶
type Option func(*Backend)
Option represents a single configuration option for the GCS backend.
func WithBucket ¶
WithBucket sets the GCS bucket that holds the objects.
func WithClientOptions ¶
func WithClientOptions(opts ...option.ClientOption) Option
WithClientOptions sets the options passed to the underlying storage client.
func WithCreateBucket ¶
WithCreateBucket configures whether InitClient creates the bucket if missing.
func WithPrefix ¶
WithPrefix sets an object-key prefix applied to every stored key.
func WithProjectID ¶
WithProjectID sets the GCP project used when creating the bucket.