Documentation ¶
Index ¶
- func NewDB(pDialect, connectionString string, logger log.Logger, logMode bool, ...) (api.VulcanitoStore, error)
- type AssetsReader
- type DefaultEntities
- type Store
- func (db Store) Close() error
- func (db Store) CountAssetsInGroups(teamID string, groupIDs []string) (int, error)
- func (db Store) CreateAsset(a api.Asset, groups []api.Group) (*api.Asset, error)
- func (db Store) CreateAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) ([]*api.AssetAnnotation, error)
- func (db Store) CreateAssets(assets []api.Asset, groups []api.Group) ([]api.Asset, error)
- func (db Store) CreateChecktypeSetting(setting api.ChecktypeSetting) (*api.ChecktypeSetting, error)
- func (db Store) CreateFindingOverwrite(findingOverwrite api.FindingOverwrite) error
- func (db Store) CreateGroup(group api.Group) (*api.Group, error)
- func (db Store) CreatePolicy(policy api.Policy) (*api.Policy, error)
- func (db Store) CreateProgram(program api.Program, teamID string) (*api.Program, error)
- func (db Store) CreateTeam(team api.Team, ownerEmail string) (*api.Team, error)
- func (db Store) CreateTeamMember(teamMember api.UserTeam) (*api.UserTeam, error)
- func (db Store) CreateUser(user api.User) (*api.User, error)
- func (db Store) CreateUserIfNotExists(userData saml.UserData) error
- func (db Store) DeleteAllAssets(teamID string) error
- func (db Store) DeleteAllOutbox() error
- func (db Store) DeleteAsset(asset api.Asset) error
- func (db Store) DeleteAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) error
- func (db Store) DeleteChecktypeSetting(checktypeSettingID string) error
- func (db Store) DeleteGroup(group api.Group) error
- func (db Store) DeletePolicy(policy api.Policy) error
- func (db Store) DeleteProgram(program api.Program, teamID string) error
- func (db Store) DeleteProgramMetadata(program string) error
- func (db Store) DeleteTeam(teamID string) error
- func (db Store) DeleteTeamMember(teamID string, userID string) error
- func (db Store) DeleteUserByID(userID string) error
- func (db Store) DisjoinAssetsInGroups(teamID, inGroupID string, notInGroupIDs []string) ([]*api.Asset, error)
- func (db Store) FindAsset(teamID, assetID string) (*api.Asset, error)
- func (db Store) FindChecktypeSetting(checktypeSettingID string) (*api.ChecktypeSetting, error)
- func (db Store) FindGlobalProgramMetadata(programID string, teamID string) (*api.GlobalProgramsMetadata, error)
- func (db Store) FindGroup(group api.Group) (*api.Group, error)
- func (db Store) FindGroupInfo(group api.Group) (*api.Group, error)
- func (db Store) FindJob(jobID string) (*api.Job, error)
- func (db Store) FindPolicy(policyID string) (*api.Policy, error)
- func (db Store) FindProgram(programID string, teamID string) (*api.Program, error)
- func (db Store) FindTeam(teamID string) (*api.Team, error)
- func (db Store) FindTeamByIDForUser(ID, userID string) (*api.UserTeam, error)
- func (db Store) FindTeamByName(name string) (*api.Team, error)
- func (db Store) FindTeamByProgram(programID string) (*api.Team, error)
- func (db Store) FindTeamByTag(tag string) (*api.Team, error)
- func (db Store) FindTeamMember(teamID string, userID string) (*api.UserTeam, error)
- func (db Store) FindTeamsByTags(tags []string) ([]*api.Team, error)
- func (db Store) FindTeamsByUser(userID string) ([]*api.Team, error)
- func (db Store) FindUserByEmail(email string) (*api.User, error)
- func (db Store) FindUserByID(userID string) (*api.User, error)
- func (db Store) GetAssetType(name string) (*api.AssetType, error)
- func (db Store) GroupAsset(assetsGroup api.AssetGroup, teamID string) (*api.AssetGroup, error)
- func (db Store) Healthcheck() error
- func (db Store) IsDuplicateError(err error) bool
- func (db Store) ListAssetAnnotations(teamID string, assetID string) ([]*api.AssetAnnotation, error)
- func (db Store) ListAssetGroup(assetGroup api.AssetGroup, teamID string) ([]*api.AssetGroup, error)
- func (db Store) ListAssets(teamID string, asset api.Asset) ([]*api.Asset, error)
- func (db Store) ListChecktypeSetting(policyID string) ([]*api.ChecktypeSetting, error)
- func (db Store) ListFindingOverwrites(findingID string) ([]*api.FindingOverwrite, error)
- func (db Store) ListGroups(teamID, groupName string) ([]*api.Group, error)
- func (db Store) ListPolicies(teamID string) ([]*api.Policy, error)
- func (db Store) ListPrograms(teamID string) ([]*api.Program, error)
- func (db Store) ListRecipients(teamID string) ([]*api.Recipient, error)
- func (db Store) ListTeams() ([]*api.Team, error)
- func (db Store) ListUsers() ([]*api.User, error)
- func (db Store) MergeAssets(mergeOps api.AssetMergeOperations) error
- func (db Store) MergeAssetsAsync(teamID string, assets []api.Asset, groupName string) (*api.Job, error)
- func (db Store) NewAssetReader(lock bool, pageSize int) (AssetsReader, error)
- func (db Store) NotFoundError(err error) bool
- func (db Store) PutAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) ([]*api.AssetAnnotation, error)
- func (db Store) UngroupAssets(assetGroup api.AssetGroup, teamID string) error
- func (db Store) UpdateAsset(asset api.Asset) (*api.Asset, error)
- func (db Store) UpdateAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) ([]*api.AssetAnnotation, error)
- func (db Store) UpdateChecktypeSetting(checktypeSetting api.ChecktypeSetting) (*api.ChecktypeSetting, error)
- func (db Store) UpdateGlobalProgramMetadata(metadata api.GlobalProgramsMetadata) error
- func (db Store) UpdateGroup(group api.Group) (*api.Group, error)
- func (db Store) UpdateJob(job api.Job) (*api.Job, error)
- func (db Store) UpdatePolicy(policy api.Policy) (*api.Policy, error)
- func (db Store) UpdateProgram(program api.Program, teamID string) (*api.Program, error)
- func (db Store) UpdateRecipients(teamID string, emails []string) error
- func (db Store) UpdateTeam(team api.Team) (*api.Team, error)
- func (db Store) UpdateTeamMember(teamMember api.UserTeam) (*api.UserTeam, error)
- func (db Store) UpdateUser(user api.User) (*api.User, error)
- func (db Store) UpsertGlobalProgramMetadata(teamID, program string, defaultAutosend bool, defaultDisabled bool, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetsReader ¶ added in v1.1.4
type AssetsReader struct {
// contains filtered or unexported fields
}
AssetsReader reads all the assets stored in Vulcan using pages with a configurable size.
func (*AssetsReader) Assets ¶ added in v1.1.4
func (a *AssetsReader) Assets() []*api.Asset
Assets returns the assets produced by the last call to *AssetsReader.Read.
func (*AssetsReader) Close ¶ added in v1.1.4
func (a *AssetsReader) Close() error
Close closes the reader and unlocks the tables that were locked when it was created.
func (*AssetsReader) Err ¶ added in v1.1.4
func (a *AssetsReader) Err() error
Err returns the error produced by the last call to *AssetsReader.Read, returns nil if the last call didn't produce any error.
func (*AssetsReader) Read ¶ added in v1.1.4
func (a *AssetsReader) Read() bool
Read returns the next page of the assets according to the page size of the *AssetsReader. Returns true if the read operation was successful, in that case the assets can be retrieved by calling *AssetsReader.Assets.
type DefaultEntities ¶
DefaultEntities that may be used accross the API NOTE: This is a map to allow for testing without circular dependencies in the testutils package
type Store ¶ added in v1.1.4
type Store struct {
// contains filtered or unexported fields
}
Store provides access to the storage layer of the Vulcan API.
func NewStore ¶ added in v1.1.4
func NewStore(pDialect, connectionString string, logger log.Logger, logMode bool, defaults map[string][]string) (Store, error)
NewStore returns an initialized Vulcan Store.
func (Store) Close ¶ added in v1.1.4
func (db Store) Close() error
Close close vulcanitoStore db connection
func (Store) CountAssetsInGroups ¶ added in v1.1.4
func (Store) CreateAsset ¶ added in v1.1.4
CreateAsset persists an asset in the database along with its annotations. It receives an asset and an array of groups. The asset will be associated with all groups from that array.
func (Store) CreateAssetAnnotations ¶ added in v1.1.4
func (db Store) CreateAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) ([]*api.AssetAnnotation, error)
CreateAssetAnnotations assign new annotations to a given asset belonging to a given team.
func (Store) CreateAssets ¶ added in v1.1.4
func (Store) CreateChecktypeSetting ¶ added in v1.1.4
func (db Store) CreateChecktypeSetting(setting api.ChecktypeSetting) (*api.ChecktypeSetting, error)
func (Store) CreateFindingOverwrite ¶ added in v1.1.4
func (db Store) CreateFindingOverwrite(findingOverwrite api.FindingOverwrite) error
func (Store) CreateGroup ¶ added in v1.1.4
func (Store) CreatePolicy ¶ added in v1.1.4
func (Store) CreateProgram ¶ added in v1.1.4
func (Store) CreateTeam ¶ added in v1.1.4
CreateTeam inserts a new team in the database and includes the current user as an owner
func (Store) CreateTeamMember ¶ added in v1.1.4
func (Store) CreateUser ¶ added in v1.1.4
CreateUser inserts a new user in the database
func (Store) CreateUserIfNotExists ¶ added in v1.1.4
CreateUserIfNotExists ...
func (Store) DeleteAllAssets ¶ added in v1.1.4
func (Store) DeleteAllOutbox ¶ added in v1.1.4
func (db Store) DeleteAllOutbox() error
CleanOutbox deletes of the records in the outbox table.
func (Store) DeleteAsset ¶ added in v1.1.4
func (Store) DeleteAssetAnnotations ¶ added in v1.1.4
func (db Store) DeleteAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) error
DeleteAssetAnnotations deletes the given annotations belonging to the given asset and team.
func (Store) DeleteChecktypeSetting ¶ added in v1.1.4
func (Store) DeleteGroup ¶ added in v1.1.4
func (Store) DeletePolicy ¶ added in v1.1.4
func (Store) DeleteProgram ¶ added in v1.1.4
func (Store) DeleteProgramMetadata ¶ added in v1.1.4
func (Store) DeleteTeam ¶ added in v1.1.4
func (Store) DeleteTeamMember ¶ added in v1.1.4
func (Store) DeleteUserByID ¶ added in v1.1.4
func (Store) DisjoinAssetsInGroups ¶ added in v1.1.4
func (Store) FindChecktypeSetting ¶ added in v1.1.4
func (db Store) FindChecktypeSetting(checktypeSettingID string) (*api.ChecktypeSetting, error)
func (Store) FindGlobalProgramMetadata ¶ added in v1.1.4
func (db Store) FindGlobalProgramMetadata(programID string, teamID string) (*api.GlobalProgramsMetadata, error)
func (Store) FindGroupInfo ¶ added in v1.1.4
func (Store) FindPolicy ¶ added in v1.1.4
func (Store) FindProgram ¶ added in v1.1.4
func (Store) FindTeamByIDForUser ¶ added in v1.1.4
FindTeamByIDForUser returns the membership information of a user in a team.
func (Store) FindTeamByName ¶ added in v1.1.4
FindTeamByName returns a team filtering by name
func (Store) FindTeamByProgram ¶ added in v1.1.4
FindTeamByProgram returns the team that the given Program belongs to.
func (Store) FindTeamByTag ¶ added in v1.1.4
FindTeamByTag returns a team filtering by tag
func (Store) FindTeamMember ¶ added in v1.1.4
func (Store) FindTeamsByTags ¶ added in v1.1.4
FindTeamByTags returns all teams with any of the specified tags.
func (Store) FindTeamsByUser ¶ added in v1.1.4
func (Store) FindUserByEmail ¶ added in v1.1.4
FindUserByEmail query a user by his email
func (Store) FindUserByID ¶ added in v1.1.4
FindUserByID query a user by his ID
func (Store) GetAssetType ¶ added in v1.1.4
func (Store) GroupAsset ¶ added in v1.1.4
func (db Store) GroupAsset(assetsGroup api.AssetGroup, teamID string) (*api.AssetGroup, error)
func (Store) Healthcheck ¶ added in v1.1.4
func (db Store) Healthcheck() error
Healthcheck simply checks for database connectivity
func (Store) IsDuplicateError ¶ added in v1.1.4
DuplicateError is an utility method to check if a returned error is a duplicate key error.
func (Store) ListAssetAnnotations ¶ added in v1.1.4
func (db Store) ListAssetAnnotations(teamID string, assetID string) ([]*api.AssetAnnotation, error)
ListAssetAnnotations returns all annotations of a given asset id.
func (Store) ListAssetGroup ¶ added in v1.1.4
func (db Store) ListAssetGroup(assetGroup api.AssetGroup, teamID string) ([]*api.AssetGroup, error)
func (Store) ListAssets ¶ added in v1.1.4
func (Store) ListChecktypeSetting ¶ added in v1.1.4
func (db Store) ListChecktypeSetting(policyID string) ([]*api.ChecktypeSetting, error)
func (Store) ListFindingOverwrites ¶ added in v1.1.4
func (db Store) ListFindingOverwrites(findingID string) ([]*api.FindingOverwrite, error)
func (Store) ListGroups ¶ added in v1.1.4
func (Store) ListPolicies ¶ added in v1.1.4
func (Store) ListPrograms ¶ added in v1.1.4
func (Store) ListRecipients ¶ added in v1.1.4
ListRecipients ...
func (Store) MergeAssets ¶ added in v1.1.4
func (db Store) MergeAssets(mergeOps api.AssetMergeOperations) error
MergeAssets executes the operations required to update a discovery group in a single transaction.
func (Store) MergeAssetsAsync ¶ added in v1.1.4
func (db Store) MergeAssetsAsync(teamID string, assets []api.Asset, groupName string) (*api.Job, error)
MergeAssetsAsync stores the information required to execute a MergeAssets operation in the Outbox. It also creates a Job to be returned to the user to track the progress of the async operation.
func (Store) NewAssetReader ¶ added in v1.1.4
func (db Store) NewAssetReader(lock bool, pageSize int) (AssetsReader, error)
NewAssetReader creates a new AssetsReader with the given page size. If the lock param is set to true it will lock for writing the following tables: Assets, Teams and AssetAnnotations.
func (Store) NotFoundError ¶ added in v1.1.4
NotFoundError is an utility method to check if a returned error is a not found error. This is needed because sometimes the services will need to act different depppending if an error is because a record it's not found or because other causes.
func (Store) PutAssetAnnotations ¶ added in v1.1.4
func (db Store) PutAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) ([]*api.AssetAnnotation, error)
PutAssetAnnotations overrides all annotations of a given asset with new content. Previous annotations will not ne preserved.
func (Store) UngroupAssets ¶ added in v1.1.4
func (db Store) UngroupAssets(assetGroup api.AssetGroup, teamID string) error
func (Store) UpdateAsset ¶ added in v1.1.4
func (Store) UpdateAssetAnnotations ¶ added in v1.1.4
func (db Store) UpdateAssetAnnotations(teamID string, assetID string, annotations []*api.AssetAnnotation) ([]*api.AssetAnnotation, error)
UpdateAssetAnnotations updates the value of the existing annotations of a given asset.
func (Store) UpdateChecktypeSetting ¶ added in v1.1.4
func (db Store) UpdateChecktypeSetting(checktypeSetting api.ChecktypeSetting) (*api.ChecktypeSetting, error)
func (Store) UpdateGlobalProgramMetadata ¶ added in v1.1.4
func (db Store) UpdateGlobalProgramMetadata(metadata api.GlobalProgramsMetadata) error
func (Store) UpdateGroup ¶ added in v1.1.4
func (Store) UpdatePolicy ¶ added in v1.1.4
func (Store) UpdateProgram ¶ added in v1.1.4
func (Store) UpdateRecipients ¶ added in v1.1.4
UpdateRecipients ...
func (Store) UpdateTeam ¶ added in v1.1.4
UpdateTeam updates a team in the database. It verifies if the team exists before actually making the update
func (Store) UpdateTeamMember ¶ added in v1.1.4
func (Store) UpdateUser ¶ added in v1.1.4
UpdateUser modifies an existing user in the database