Documentation
¶
Overview ¶
Package grafeas is an implementation of the v1beta1 https://github.com/grafeas/grafeas/ API.
Index ¶
- Constants
- type API
- func (g *API) BatchCreateNotes(ctx context.Context, req *gpb.BatchCreateNotesRequest) (*gpb.BatchCreateNotesResponse, error)
- func (g *API) BatchCreateOccurrences(ctx context.Context, req *gpb.BatchCreateOccurrencesRequest) (*gpb.BatchCreateOccurrencesResponse, error)
- func (g *API) CreateNote(ctx context.Context, req *gpb.CreateNoteRequest) (*gpb.Note, error)
- func (g *API) CreateOccurrence(ctx context.Context, req *gpb.CreateOccurrenceRequest) (*gpb.Occurrence, error)
- func (g *API) DeleteNote(ctx context.Context, req *gpb.DeleteNoteRequest) (*emptypb.Empty, error)
- func (g *API) DeleteOccurrence(ctx context.Context, req *gpb.DeleteOccurrenceRequest) (*emptypb.Empty, error)
- func (g *API) GetNote(ctx context.Context, req *gpb.GetNoteRequest) (*gpb.Note, error)
- func (g *API) GetOccurrence(ctx context.Context, req *gpb.GetOccurrenceRequest) (*gpb.Occurrence, error)
- func (g *API) GetOccurrenceNote(ctx context.Context, req *gpb.GetOccurrenceNoteRequest) (*gpb.Note, error)
- func (g *API) GetVulnerabilityOccurrencesSummary(ctx context.Context, req *gpb.GetVulnerabilityOccurrencesSummaryRequest) (*gpb.VulnerabilityOccurrencesSummary, error)
- func (g *API) ListNoteOccurrences(ctx context.Context, req *gpb.ListNoteOccurrencesRequest) (*gpb.ListNoteOccurrencesResponse, error)
- func (g *API) ListNotes(ctx context.Context, req *gpb.ListNotesRequest) (*gpb.ListNotesResponse, error)
- func (g *API) ListOccurrences(ctx context.Context, req *gpb.ListOccurrencesRequest) (*gpb.ListOccurrencesResponse, error)
- func (g *API) UpdateNote(ctx context.Context, req *gpb.UpdateNoteRequest) (*gpb.Note, error)
- func (g *API) UpdateOccurrence(ctx context.Context, req *gpb.UpdateOccurrenceRequest) (*gpb.Occurrence, error)
- type Auth
- type Filter
- type Logger
- type NoOpAuth
- type NoOpFilter
- type NoOpLogger
- func (NoOpLogger) Error(ctx context.Context, args ...interface{})
- func (NoOpLogger) Errorf(ctx context.Context, format string, args ...interface{})
- func (NoOpLogger) Info(ctx context.Context, args ...interface{})
- func (NoOpLogger) Infof(ctx context.Context, format string, args ...interface{})
- func (NoOpLogger) PrepareCtx(ctx context.Context, projectID string) context.Context
- func (NoOpLogger) Warning(ctx context.Context, args ...interface{})
- func (NoOpLogger) Warningf(ctx context.Context, format string, args ...interface{})
- type Storage
Constants ¶
const ( // NotesGet is the permission to get a note. NotesGet = iam.Permission("notes.get") // NotesList is the permission to list notes. NotesList = iam.Permission("notes.list") // NotesCreate is the permission to create a note. NotesCreate = iam.Permission("notes.create") // NotesUpdate is the permission to update a note. NotesUpdate = iam.Permission("notes.update") // NotesDelete is the permission to delete a note. NotesDelete = iam.Permission("notes.delete") // OccurrencesGet is the permission to get an occurrence. OccurrencesGet = iam.Permission("occurrences.get") // OccurrencesList is the permission to list occurrences. OccurrencesList = iam.Permission("occurrences.list") // OccurrencesCreate is the permission to create an occurrence. OccurrencesCreate = iam.Permission("occurrences.create") // OccurrencesUpdate is the permission to update an occurrence. OccurrencesUpdate = iam.Permission("occurrences.update") // OccurrencesDelete is the permission to delete an occurrence. OccurrencesDelete = iam.Permission("occurrences.delete") // NotesListOccurrences is the permission to list occurrences associated for a note you own. NotesListOccurrences = iam.Permission("notes.listOccurrences") // NotesAttachOccurrence is the permission to attach occurrences for a note you own. NotesAttachOccurrence = iam.Permission("notes.attachOccurrence") // Notes is the resource type for notes. Notes = iam.Resource("notes") // Occurrences is the resource type for occurrences. Occurrences = iam.Resource("occurrences") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
API implements the methods in the v1beta1 Grafeas API.
func (*API) BatchCreateNotes ¶
func (g *API) BatchCreateNotes(ctx context.Context, req *gpb.BatchCreateNotesRequest) (*gpb.BatchCreateNotesResponse, error)
BatchCreateNotes batch creates the specified notes.
func (*API) BatchCreateOccurrences ¶
func (g *API) BatchCreateOccurrences(ctx context.Context, req *gpb.BatchCreateOccurrencesRequest) (*gpb.BatchCreateOccurrencesResponse, error)
BatchCreateOccurrences batch creates the specified occurrences.
func (*API) CreateNote ¶
CreateNote creates the specified note.
func (*API) CreateOccurrence ¶
func (g *API) CreateOccurrence(ctx context.Context, req *gpb.CreateOccurrenceRequest) (*gpb.Occurrence, error)
CreateOccurrence creates the specified occurrence.
func (*API) DeleteNote ¶
DeleteNote deletes the specified note.
func (*API) DeleteOccurrence ¶
func (g *API) DeleteOccurrence(ctx context.Context, req *gpb.DeleteOccurrenceRequest) (*emptypb.Empty, error)
DeleteOccurrence deletes the specified occurrence.
func (*API) GetOccurrence ¶
func (g *API) GetOccurrence(ctx context.Context, req *gpb.GetOccurrenceRequest) (*gpb.Occurrence, error)
GetOccurrence gets the specified occurrence.
func (*API) GetOccurrenceNote ¶
func (g *API) GetOccurrenceNote(ctx context.Context, req *gpb.GetOccurrenceNoteRequest) (*gpb.Note, error)
GetOccurrenceNote gets the note for the specified occurrence.
func (*API) GetVulnerabilityOccurrencesSummary ¶
func (g *API) GetVulnerabilityOccurrencesSummary(ctx context.Context, req *gpb.GetVulnerabilityOccurrencesSummaryRequest) (*gpb.VulnerabilityOccurrencesSummary, error)
GetVulnerabilityOccurrencesSummary produces a summary of vulnerability occurrences grouped by severity that match the specified filter.
func (*API) ListNoteOccurrences ¶
func (g *API) ListNoteOccurrences(ctx context.Context, req *gpb.ListNoteOccurrencesRequest) (*gpb.ListNoteOccurrencesResponse, error)
ListNoteOccurrences lists occurrences for the specified note.
func (*API) ListNotes ¶
func (g *API) ListNotes(ctx context.Context, req *gpb.ListNotesRequest) (*gpb.ListNotesResponse, error)
ListNotes lists notes for the specified project.
func (*API) ListOccurrences ¶
func (g *API) ListOccurrences(ctx context.Context, req *gpb.ListOccurrencesRequest) (*gpb.ListOccurrencesResponse, error)
ListOccurrences lists occurrences for the specified project.
func (*API) UpdateNote ¶
UpdateNote updates the specified note.
func (*API) UpdateOccurrence ¶
func (g *API) UpdateOccurrence(ctx context.Context, req *gpb.UpdateOccurrenceRequest) (*gpb.Occurrence, error)
UpdateOccurrence updates the specified occurrence.
type Auth ¶
type Auth interface {
// CheckAccessAndProject checks to see whether an API call is allowed. It can check things like
// whether the project and entity exists, and whether the user has access to the project and the
// entity, This method should generally be the first thing an API method calls before taking any
// action. To prevent leaking information, the only kind of error this should return is a
// permission denied error.
CheckAccessAndProject(ctx context.Context, projectID string, entityID string, p iam.Permission) error
// EndUserID returns the ID of the user making an API call.
EndUserID(ctx context.Context) (string, error)
// PurgePolicy purges any auth policies that may have been set on the specified entity if using an
// IAM service.
PurgePolicy(ctx context.Context, projectID string, entityID string, r iam.Resource) error
}
Auth provides authorization functions for this API.
type Filter ¶
type Filter interface {
// Validate determines whether the specified filter string is a valid filter.
Validate(f string) error
}
Filter provides functions for parsing filter strings.
type Logger ¶
type Logger interface {
// PrepareCtx adds values to the context for logging if necessary.
PrepareCtx(ctx context.Context, projectID string) context.Context
Info(ctx context.Context, args ...interface{})
Infof(ctx context.Context, format string, args ...interface{})
Warning(ctx context.Context, args ...interface{})
Warningf(ctx context.Context, format string, args ...interface{})
Error(ctx context.Context, args ...interface{})
Errorf(ctx context.Context, format string, args ...interface{})
}
Logger provides functions for logging at various levels.
type NoOpAuth ¶
type NoOpAuth struct{}
NoOpAuth does nothing.
func (*NoOpAuth) CheckAccessAndProject ¶
type NoOpFilter ¶
type NoOpFilter struct{}
NoOpFilter does nothing.
func (*NoOpFilter) Validate ¶
func (f *NoOpFilter) Validate(filter string) error
type NoOpLogger ¶
type NoOpLogger struct{}
NoOpLogger does nothing.
func (NoOpLogger) Error ¶
func (NoOpLogger) Error(ctx context.Context, args ...interface{})
func (NoOpLogger) Errorf ¶
func (NoOpLogger) Errorf(ctx context.Context, format string, args ...interface{})
func (NoOpLogger) Info ¶
func (NoOpLogger) Info(ctx context.Context, args ...interface{})
func (NoOpLogger) Infof ¶
func (NoOpLogger) Infof(ctx context.Context, format string, args ...interface{})
func (NoOpLogger) PrepareCtx ¶
func (NoOpLogger) Warning ¶
func (NoOpLogger) Warning(ctx context.Context, args ...interface{})
type Storage ¶
type Storage interface {
// GetOccurrence gets the specified occurrence from storage.
GetOccurrence(ctx context.Context, projectID, occID string) (*gpb.Occurrence, error)
// ListOccurrences lists occurrences for the specified project from storage.
ListOccurrences(ctx context.Context, projectID, filter, pageToken string, pageSize int32) ([]*gpb.Occurrence, string, error)
// CreateOccurrence creates the specified occurrence in storage.
CreateOccurrence(ctx context.Context, projectID, userID string, o *gpb.Occurrence) (*gpb.Occurrence, error)
// BatchCreateOccurrences batch creates the specified occurrences in storage.
BatchCreateOccurrences(ctx context.Context, projectID string, userID string, occs []*gpb.Occurrence) ([]*gpb.Occurrence, []error)
// UpdateOccurrence updates the specified occurrence in storage.
UpdateOccurrence(ctx context.Context, projectID, occID string, o *gpb.Occurrence, mask *fieldmaskpb.FieldMask) (*gpb.Occurrence, error)
// DeleteOccurrence deletes the specified occurrence in storage.
DeleteOccurrence(ctx context.Context, projectID, occID string) error
// GetNote gets the specified note from storage.
GetNote(ctx context.Context, projectID, nID string) (*gpb.Note, error)
// ListNotes lists notes for the specified project from storage.
ListNotes(ctx context.Context, projectID, filter, pageToken string, pageSize int32) ([]*gpb.Note, string, error)
// CreateNote creates the specified note in storage.
CreateNote(ctx context.Context, projectID, nID string, userID string, n *gpb.Note) (*gpb.Note, error)
// BatchCreateNotes batch creates the specified notes in storage.
BatchCreateNotes(ctx context.Context, projectID string, userID string, notes map[string]*gpb.Note) ([]*gpb.Note, []error)
// UpdateNote updates the specified note in storage.
UpdateNote(ctx context.Context, projectID, nID string, n *gpb.Note, mask *fieldmaskpb.FieldMask) (*gpb.Note, error)
// DeleteNote deletes the specified note in storage.
DeleteNote(ctx context.Context, projectID, nID string) error
// GetOccurrenceNote gets the note for the specified occurrence from storage.
GetOccurrenceNote(ctx context.Context, projectID, oID string) (*gpb.Note, error)
// ListNoteOccurrences lists occurrences for the specified note from storage.
ListNoteOccurrences(ctx context.Context, projectID, nID, filter, pageToken string, pageSize int32) ([]*gpb.Occurrence, string, error)
// GetVulnerabilityOccurrencesSummary gets a summary of vulnerability occurrences from storage.
GetVulnerabilityOccurrencesSummary(ctx context.Context, projectID, filter string) (*gpb.VulnerabilityOccurrencesSummary, error)
}
Storage provides storage functions for this API.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
validators
|
|
|
attestation
Package attestation implements functions to validate that the fields of attestation entities being passed into the API meet our requirements.
|
Package attestation implements functions to validate that the fields of attestation entities being passed into the API meet our requirements. |
|
build
Package build implements functions to validate that the fields of build entities being passed into the API meet our requirements.
|
Package build implements functions to validate that the fields of build entities being passed into the API meet our requirements. |
|
deployment
Package deployment implements functions to validate that the fields of deployment entities being passed into the API meet our requirements.
|
Package deployment implements functions to validate that the fields of deployment entities being passed into the API meet our requirements. |
|
discovery
Package discovery implements functions to validate that the fields of discovery entities being passed into the API meet our requirements.
|
Package discovery implements functions to validate that the fields of discovery entities being passed into the API meet our requirements. |
|
grafeas
Package grafeas implements functions to validate that the fields of Grafeas entities being passed into the API meet our requirements.
|
Package grafeas implements functions to validate that the fields of Grafeas entities being passed into the API meet our requirements. |
|
image
Package image implements functions to validate that the fields of image entities being passed into the API meet our requirements.
|
Package image implements functions to validate that the fields of image entities being passed into the API meet our requirements. |
|
package
Package pkg implements functions to validate that the fields of package entities being passed into the API meet our requirements.
|
Package pkg implements functions to validate that the fields of package entities being passed into the API meet our requirements. |
|
provenance
Package provenance implements functions to validate that the fields of provenance entities being passed into the API meet our requirements.
|
Package provenance implements functions to validate that the fields of provenance entities being passed into the API meet our requirements. |
|
vulnerability
Package vulnerability implements functions to validate that the fields of vulnerability entities being passed into the API meet our requirements.
|
Package vulnerability implements functions to validate that the fields of vulnerability entities being passed into the API meet our requirements. |