storage

package
v0.0.0-...-10e3efe Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// constants relating to table structure
	GlobalSecondaryIndex1 = "GSI_1"
	PartitionKeyName      = "PartitionKey"
	SortKeyName           = "SortKey"
	DataKeyName           = "Data"
	JsonKeyName           = "Json"
	PaginationString      = "&"
)

Variables

This section is empty.

Functions

func DynamodbStorageTypeProvider

func DynamodbStorageTypeProvider(storageType string, storageConfig *grafeasConfig.StorageConfiguration) (*storage.Storage, error)

Types

type DataItem

type DataItem struct {
	PartitionKey string
	SortKey      string
	Data         string
	NoteName     string
	Json         string
}

type DynamoDb

type DynamoDb struct {
	*dynamodb.DynamoDB
	TableName string
}

func NewDynamoDbStore

func NewDynamoDbStore(config *config.DynamoDbConfig) *DynamoDb

func (*DynamoDb) BatchCreateNotes

func (db *DynamoDb) BatchCreateNotes(ctx context.Context, projectId string, userID string, notes map[string]*pb.Note) ([]*pb.Note, []error)

BatchCreateNotes batch creates the specified notes in storage.

func (*DynamoDb) BatchCreateOccurrences

func (db *DynamoDb) BatchCreateOccurrences(ctx context.Context, projectId string, userID string, occs []*pb.Occurrence) ([]*pb.Occurrence, []error)

BatchCreateOccurrences batch creates the specified occurrences in storage.

func (*DynamoDb) CreateNote

func (db *DynamoDb) CreateNote(ctx context.Context, projectId, nID string, userID string, n *pb.Note) (*pb.Note, error)

CreateNote creates the specified note in storage.

func (*DynamoDb) CreateOccurrence

func (db *DynamoDb) CreateOccurrence(ctx context.Context, projectId, userID string, o *pb.Occurrence) (*pb.Occurrence, error)

CreateOccurrence creates the specified occurrence in storage.

func (*DynamoDb) CreateProject

func (db *DynamoDb) CreateProject(ctx context.Context, pID string, p *prpb.Project) (*prpb.Project, error)

CreateProject creates the specified project in the storage.

func (*DynamoDb) DeleteNote

func (db *DynamoDb) DeleteNote(ctx context.Context, projectId, nID string) error

DeleteNote deletes the specified note in storage.

func (*DynamoDb) DeleteOccurrence

func (db *DynamoDb) DeleteOccurrence(ctx context.Context, projectId, occId string) error

DeleteOccurrence deletes the specified occurrence in storage.

func (*DynamoDb) DeleteProject

func (db *DynamoDb) DeleteProject(ctx context.Context, pID string) error

DeleteProject deletes the specified project from the storage.

func (*DynamoDb) GetNote

func (db *DynamoDb) GetNote(ctx context.Context, projectId, nID string) (*pb.Note, error)

GetNote gets the specified note from storage.

func (*DynamoDb) GetOccurrence

func (db *DynamoDb) GetOccurrence(ctx context.Context, projectId, occId string) (*pb.Occurrence, error)

GetOccurrence gets the specified occurrence from storage.

func (*DynamoDb) GetOccurrenceNote

func (db *DynamoDb) GetOccurrenceNote(ctx context.Context, projectId, oID string) (*pb.Note, error)

GetOccurrenceNote gets the note for the specified occurrence from storage.

func (*DynamoDb) GetProject

func (db *DynamoDb) GetProject(ctx context.Context, pID string) (*prpb.Project, error)

GetProject gets the specified project from the storage.

func (*DynamoDb) GetVulnerabilityOccurrencesSummary

func (db *DynamoDb) GetVulnerabilityOccurrencesSummary(ctx context.Context, projectId, filter string) (*pb.VulnerabilityOccurrencesSummary, error)

GetVulnerabilityOccurrencesSummary gets a summary of vulnerability occurrences from storage.

func (*DynamoDb) ListNoteOccurrences

func (db *DynamoDb) ListNoteOccurrences(ctx context.Context, nPID, nID, filter, pageToken string, pageSize int32) ([]*pb.Occurrence, string, error)

ListNoteOccurrences lists all occurrences across all projects for the specified note from storage.

func (*DynamoDb) ListNotes

func (db *DynamoDb) ListNotes(ctx context.Context, projectId, filter, pageToken string, pageSize int32) ([]*pb.Note, string, error)

ListNotes lists notes for the specified project from storage.

func (*DynamoDb) ListOccurrences

func (db *DynamoDb) ListOccurrences(ctx context.Context, projectId, filter, pageToken string, pageSize int32) ([]*pb.Occurrence, string, error)

ListOccurrences lists occurrences for the specified project from storage.

func (*DynamoDb) ListProjects

func (db *DynamoDb) ListProjects(ctx context.Context, filter string, pageSize int, pageToken string) ([]*prpb.Project, string, error)

ListProjects returns projects in the storage.

func (*DynamoDb) UpdateNote

func (db *DynamoDb) UpdateNote(ctx context.Context, projectId, nID string, n *pb.Note, mask *fieldmaskpb.FieldMask) (*pb.Note, error)

UpdateNote updates the specified note in storage.

func (*DynamoDb) UpdateOccurrence

func (db *DynamoDb) UpdateOccurrence(ctx context.Context, projectId, occId string, o *pb.Occurrence, mask *fieldmaskpb.FieldMask) (*pb.Occurrence, error)

UpdateOccurrence updates the specified occurrence in storage.

Jump to

Keyboard shortcuts

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