repository

package
v0.0.0-...-88209a0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

@author: vikram@github.com/devtron-labs @description: user crud

Index

Constants

View Source
const (
	REGISTRYTYPE_ECR              = "ecr"
	REGISTRYTYPE_OTHER            = "other"
	REGISTRYTYPE_DOCKER_HUB       = "docker-hub"
	REGISTRYTYPE_GCR              = "gcr"
	REGISTRYTYPE_ARTIFACTREGISTRY = "artifact-registry"
)
View Source
const (
	CycloneDxSbom ResourceScanFormat = 1 //SBOM
	TrivyJson                        = 2
	Json                             = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLog

type AuditLog struct {
	CreatedOn time.Time `sql:"created_on"`
	CreatedBy int32     `sql:"created_by"`
	UpdatedOn time.Time `sql:"updated_on"`
	UpdatedBy int32     `sql:"updated_by"`
}

type CiArtifact

type CiArtifact struct {
	Id               int       `sql:"id,pk"`
	PipelineId       int       `sql:"pipeline_id,notnull"` //id of the ci pipeline from which this webhook was triggered
	Image            string    `sql:"image,notnull"`
	ImageDigest      string    `sql:"image_digest,notnull"`
	MaterialInfo     string    `sql:"material_info"` //git material metadata json array string
	DataSource       string    `sql:"data_source,notnull"`
	WorkflowId       *int      `sql:"ci_workflow_id"`
	ParentCiArtifact int       `sql:"parent_ci_artifact"`
	ScanEnabled      bool      `sql:"scan_enabled"`
	Scanned          bool      `sql:"scanned"`
	DeployedTime     time.Time `sql:"-"`
	Deployed         bool      `sql:"-"`
	Latest           bool      `sql:"-"`
	AuditLog
	// contains filtered or unexported fields
}

type CiArtifactRepository

type CiArtifactRepository interface {
	Update(artifact *CiArtifact) error
	Get(imageDigest string) (*CiArtifact, error)
}

type CiArtifactRepositoryImpl

type CiArtifactRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewCiArtifactRepositoryImpl

func NewCiArtifactRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *CiArtifactRepositoryImpl

func (CiArtifactRepositoryImpl) Get

func (impl CiArtifactRepositoryImpl) Get(imageDigest string) (*CiArtifact, error)

func (CiArtifactRepositoryImpl) Update

func (impl CiArtifactRepositoryImpl) Update(artifact *CiArtifact) error

type CvePolicy

type CvePolicy struct {
	Id            int `sql:"id,pk"`
	Global        bool
	ClusterId     int
	EnvironmentId int
	AppId         int
	CVEStoreId    int
	Action        PolicyAction
	Severity      bean.Severity
	Deleted       bool
	AuditLog
	*CveStore
	// contains filtered or unexported fields
}

func (*CvePolicy) PolicyLevel

func (policy *CvePolicy) PolicyLevel() PolicyLevel

type CvePolicyRepository

type CvePolicyRepository interface {
	GetEnvPolicies(clusterId int, environmentId int) (policies []*CvePolicy, err error)
	GetAppEnvPolicies(clusterId int, environmentId int, appId int) (policies []*CvePolicy, err error)
}

type CvePolicyRepositoryImpl

type CvePolicyRepositoryImpl struct {
	// contains filtered or unexported fields
}

func (*CvePolicyRepositoryImpl) GetAppEnvPolicies

func (impl *CvePolicyRepositoryImpl) GetAppEnvPolicies(clusterId int, environmentId int, appId int) (policies []*CvePolicy, err error)

func (*CvePolicyRepositoryImpl) GetEnvPolicies

func (impl *CvePolicyRepositoryImpl) GetEnvPolicies(clusterId int, environmentId int) (policies []*CvePolicy, err error)

type CveStore

type CveStore struct {
	Name             string        `sql:"name,pk"`
	Severity         bean.Severity `sql:"severity,notnull"`
	Package          string        `sql:"package,notnull"`
	Version          string        `sql:"version,notnull"`
	FixedVersion     string        `sql:"fixed_version,notnull"`
	StandardSeverity bean.Severity `sql:"standard_severity,notnull"`
	AuditLog
	// contains filtered or unexported fields
}

type CveStoreRepository

type CveStoreRepository interface {
	GetConnection() (dbConnection *pg.DB)
	Save(model *CveStore) error
	SaveInBatch(model []*CveStore, tx *pg.Tx) error
	FindAll() ([]*CveStore, error)
	FindByCveNames(names []string) ([]*CveStore, error)
	FindByName(name string) (*CveStore, error)
	Update(model *CveStore) error
}

type CveStoreRepositoryImpl

type CveStoreRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewCveStoreRepositoryImpl

func NewCveStoreRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *CveStoreRepositoryImpl

func (CveStoreRepositoryImpl) FindAll

func (impl CveStoreRepositoryImpl) FindAll() ([]*CveStore, error)

func (CveStoreRepositoryImpl) FindByCveNames

func (impl CveStoreRepositoryImpl) FindByCveNames(names []string) ([]*CveStore, error)

func (CveStoreRepositoryImpl) FindByName

func (impl CveStoreRepositoryImpl) FindByName(name string) (*CveStore, error)

func (CveStoreRepositoryImpl) GetConnection

func (impl CveStoreRepositoryImpl) GetConnection() (dbConnection *pg.DB)

func (CveStoreRepositoryImpl) Save

func (impl CveStoreRepositoryImpl) Save(model *CveStore) error

func (CveStoreRepositoryImpl) SaveInBatch

func (impl CveStoreRepositoryImpl) SaveInBatch(model []*CveStore, tx *pg.Tx) error

func (CveStoreRepositoryImpl) Update

func (impl CveStoreRepositoryImpl) Update(team *CveStore) error

type DockerArtifactStore

type DockerArtifactStore struct {
	Id                 string              `sql:"id,pk" json:"id,,omitempty"`
	PluginId           string              `sql:"plugin_id,notnull" json:"pluginId,omitempty"`
	RegistryURL        string              `sql:"registry_url" json:"registryUrl,omitempty"`
	RegistryType       common.RegistryType `sql:"registry_type,notnull" json:"registryType,omitempty"`
	AWSAccessKeyId     string              `sql:"aws_accesskey_id" json:"awsAccessKeyId,omitempty" `
	AWSSecretAccessKey string              `sql:"aws_secret_accesskey" json:"awsSecretAccessKey,omitempty"`
	AWSRegion          string              `sql:"aws_region" json:"awsRegion,omitempty"`
	Username           string              `sql:"username" json:"username,omitempty"`
	Password           string              `sql:"password" json:"password,omitempty"`
	IsDefault          bool                `sql:"is_default,notnull" json:"isDefault"`
	Connection         string              `sql:"connection" json:"connection,omitempty"`
	Cert               string              `sql:"cert" json:"cert,omitempty"`
	Active             bool                `sql:"active,notnull" json:"active"`
	AuditLog
	// contains filtered or unexported fields
}

func (*DockerArtifactStore) GetRegistryLocation

func (store *DockerArtifactStore) GetRegistryLocation() (registryLocation string, err error)

type DockerArtifactStoreRepository

type DockerArtifactStoreRepository interface {
	FindActiveDefaultStore() (*DockerArtifactStore, error)
	FindById(id string) (*DockerArtifactStore, error)
}

type DockerArtifactStoreRepositoryImpl

type DockerArtifactStoreRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewDockerArtifactStoreRepositoryImpl

func NewDockerArtifactStoreRepositoryImpl(dbConnection *pg.DB,
	logger *zap.SugaredLogger) *DockerArtifactStoreRepositoryImpl

func (DockerArtifactStoreRepositoryImpl) FindActiveDefaultStore

func (impl DockerArtifactStoreRepositoryImpl) FindActiveDefaultStore() (*DockerArtifactStore, error)

func (DockerArtifactStoreRepositoryImpl) FindById

type ImageScanDeployInfo

type ImageScanDeployInfo struct {
	Id                          int    `sql:"id,pk"`
	ImageScanExecutionHistoryId []int  `sql:"image_scan_execution_history_id,notnull" pg:",array"`
	ScanObjectMetaId            int    `sql:"scan_object_meta_id,notnull"`
	ObjectType                  string `sql:"object_type"`
	EnvId                       int    `sql:"env_id"`
	AuditLog
	// contains filtered or unexported fields
}

* this table contains scanned images registry for deployed object and apps, images which are deployed on cluster by anyway and has scanned result

type ImageScanDeployInfoRepository

type ImageScanDeployInfoRepository interface {
	Save(model *ImageScanDeployInfo) error
	FindAll() ([]*ImageScanDeployInfo, error)
	FindOne(id int) (*ImageScanDeployInfo, error)
	FindByIds(ids []int) ([]*ImageScanDeployInfo, error)
	Update(model *ImageScanDeployInfo) error
	FetchListingGroupByObject() ([]*ImageScanDeployInfo, error)
	FetchByAppIdAndEnvId(appId int, envId int) (*ImageScanDeployInfo, error)
}

type ImageScanDeployInfoRepositoryImpl

type ImageScanDeployInfoRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewImageScanDeployInfoRepositoryImpl

func NewImageScanDeployInfoRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *ImageScanDeployInfoRepositoryImpl

func (ImageScanDeployInfoRepositoryImpl) FetchByAppIdAndEnvId

func (impl ImageScanDeployInfoRepositoryImpl) FetchByAppIdAndEnvId(appId int, envId int) (*ImageScanDeployInfo, error)

func (ImageScanDeployInfoRepositoryImpl) FetchListingGroupByObject

func (impl ImageScanDeployInfoRepositoryImpl) FetchListingGroupByObject() ([]*ImageScanDeployInfo, error)

func (ImageScanDeployInfoRepositoryImpl) FindAll

func (ImageScanDeployInfoRepositoryImpl) FindByIds

func (impl ImageScanDeployInfoRepositoryImpl) FindByIds(ids []int) ([]*ImageScanDeployInfo, error)

func (ImageScanDeployInfoRepositoryImpl) FindOne

func (ImageScanDeployInfoRepositoryImpl) Save

func (ImageScanDeployInfoRepositoryImpl) Update

type ImageScanExecutionHistory

type ImageScanExecutionHistory struct {
	Id                            int                  `sql:"id,pk"`
	Image                         string               `sql:"image,notnull"`
	ImageHash                     string               `sql:"image_hash,notnull"` // TODO Migrate to request metadata
	ExecutionTime                 time.Time            `sql:"execution_time"`
	ExecutedBy                    int                  `sql:"executed_by,notnull"`
	SourceMetadataJson            string               `sql:"source_metadata_json"`             // to have relevant info to process a scan for a given source type and subtype
	ExecutionHistoryDirectoryPath string               `sql:"execution_history_directory_path"` // Deprecated
	SourceType                    common.SourceType    `sql:"source_type"`
	SourceSubType                 common.SourceSubType `sql:"source_sub_type"`
	// contains filtered or unexported fields
}

type ImageScanExecutionResult

type ImageScanExecutionResult struct {
	Id                          int    `sql:"id,pk"`
	CveStoreName                string `sql:"cve_store_name,notnull"`
	ImageScanExecutionHistoryId int    `sql:"image_scan_execution_history_id"` //TODO: remove this
	ScanToolId                  int    `sql:"scan_tool_id"`
	CveStore                    CveStore
	ImageScanExecutionHistory   ImageScanExecutionHistory
	// contains filtered or unexported fields
}

type ImageScanHistoryRepository

type ImageScanHistoryRepository interface {
	Save(model *ImageScanExecutionHistory) error
	FindAll() ([]*ImageScanExecutionHistory, error)
	FindOne(id int) (*ImageScanExecutionHistory, error)
	FindByImageDigest(image string) (*ImageScanExecutionHistory, error)
	FindByImageDigests(digest []string) ([]*ImageScanExecutionHistory, error)
	Update(model *ImageScanExecutionHistory) error
	FindByImage(image string) (*ImageScanExecutionHistory, error)
}

type ImageScanHistoryRepositoryImpl

type ImageScanHistoryRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewImageScanHistoryRepositoryImpl

func NewImageScanHistoryRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *ImageScanHistoryRepositoryImpl

func (ImageScanHistoryRepositoryImpl) FindAll

func (ImageScanHistoryRepositoryImpl) FindByImage

func (ImageScanHistoryRepositoryImpl) FindByImageDigest

func (impl ImageScanHistoryRepositoryImpl) FindByImageDigest(image string) (*ImageScanExecutionHistory, error)

func (ImageScanHistoryRepositoryImpl) FindByImageDigests

func (impl ImageScanHistoryRepositoryImpl) FindByImageDigests(digest []string) ([]*ImageScanExecutionHistory, error)

func (ImageScanHistoryRepositoryImpl) FindOne

func (ImageScanHistoryRepositoryImpl) Save

func (ImageScanHistoryRepositoryImpl) Update

type ImageScanObjectMeta

type ImageScanObjectMeta struct {
	Id     int    `sql:"id,pk"`
	Name   string `sql:"name,notnull"`
	Image  string `sql:"image,notnull"`
	Active bool   `sql:"active"`
	// contains filtered or unexported fields
}

type ImageScanObjectMetaRepository

type ImageScanObjectMetaRepository interface {
	Save(model *ImageScanObjectMeta) error
	FindAll() ([]*ImageScanObjectMeta, error)
	FindOne(id int) (*ImageScanObjectMeta, error)
	FindByNameAndType(name string, types string) ([]*ImageScanObjectMeta, error)
	Update(model *ImageScanObjectMeta) error
}

type ImageScanObjectMetaRepositoryImpl

type ImageScanObjectMetaRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewImageScanObjectMetaRepositoryImpl

func NewImageScanObjectMetaRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *ImageScanObjectMetaRepositoryImpl

func (ImageScanObjectMetaRepositoryImpl) FindAll

func (ImageScanObjectMetaRepositoryImpl) FindByNameAndType

func (impl ImageScanObjectMetaRepositoryImpl) FindByNameAndType(name string, types string) ([]*ImageScanObjectMeta, error)

func (ImageScanObjectMetaRepositoryImpl) FindOne

func (ImageScanObjectMetaRepositoryImpl) Save

func (ImageScanObjectMetaRepositoryImpl) Update

type ImageScanResultRepository

type ImageScanResultRepository interface {
	Save(model *ImageScanExecutionResult) error
	SaveInBatch(models []*ImageScanExecutionResult, tx *pg.Tx) error
	FindAll() ([]*ImageScanExecutionResult, error)
	FindOne(id int) (*ImageScanExecutionResult, error)
	FindByCveName(name string) ([]*ImageScanExecutionResult, error)
	Update(model *ImageScanExecutionResult) error
	FetchByScanExecutionId(id int) ([]*ImageScanExecutionResult, error)
	FetchByScanExecutionIds(ids []int) ([]*ImageScanExecutionResult, error)
}

type ImageScanResultRepositoryImpl

type ImageScanResultRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewImageScanResultRepositoryImpl

func NewImageScanResultRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *ImageScanResultRepositoryImpl

func (ImageScanResultRepositoryImpl) FetchByScanExecutionId

func (impl ImageScanResultRepositoryImpl) FetchByScanExecutionId(scanExecutionId int) ([]*ImageScanExecutionResult, error)

func (ImageScanResultRepositoryImpl) FetchByScanExecutionIds

func (impl ImageScanResultRepositoryImpl) FetchByScanExecutionIds(ids []int) ([]*ImageScanExecutionResult, error)

func (ImageScanResultRepositoryImpl) FindAll

func (ImageScanResultRepositoryImpl) FindByCveName

func (impl ImageScanResultRepositoryImpl) FindByCveName(name string) ([]*ImageScanExecutionResult, error)

func (ImageScanResultRepositoryImpl) FindOne

func (ImageScanResultRepositoryImpl) Save

func (ImageScanResultRepositoryImpl) SaveInBatch

func (impl ImageScanResultRepositoryImpl) SaveInBatch(models []*ImageScanExecutionResult, tx *pg.Tx) error

func (ImageScanResultRepositoryImpl) Update

type PolicyAction

type PolicyAction int
const (
	Inherit PolicyAction = iota
	Allow
	Block
)

func (PolicyAction) String

func (d PolicyAction) String() string

type PolicyLevel

type PolicyLevel int
const (
	Global PolicyLevel = iota
	Cluster
	Environment
	App
)

func (PolicyLevel) String

func (d PolicyLevel) String() string

type RegistryIndexMapping

type RegistryIndexMapping struct {
	Id         int                 `sql:"id,pk"`
	Registry   common.RegistryType `sql:"registry_type"`
	Index      int                 `sql:"starting_index"`
	ScanToolId int                 `sql:"scan_tool_id"`
	// contains filtered or unexported fields
}

type RegistryIndexMappingRepository

type RegistryIndexMappingRepository interface {
	GetStartingIndexForARegistryAndATool(scanToolid int, registry common.RegistryType) (*RegistryIndexMapping, error)
}

type RegistryIndexMappingRepositoryImpl

type RegistryIndexMappingRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewRegistryIndexMappingRepositoryImpl

func NewRegistryIndexMappingRepositoryImpl(dbConnection *pg.DB,
	logger *zap.SugaredLogger) *RegistryIndexMappingRepositoryImpl

func (*RegistryIndexMappingRepositoryImpl) GetStartingIndexForARegistryAndATool

func (repo *RegistryIndexMappingRepositoryImpl) GetStartingIndexForARegistryAndATool(scanToolid int, registry common.RegistryType) (*RegistryIndexMapping, error)

type ResourceScanFormat

type ResourceScanFormat int

type ResourceScanResult

type ResourceScanResult struct {
	Id                          int                `sql:"id,pk"`
	ImageScanExecutionHistoryId int                `sql:"image_scan_execution_history_id"`
	ScanDataJson                string             `sql:"scan_data_json"`
	Format                      ResourceScanFormat `sql:"format"`
	Types                       []int              `sql:"types" pg:",array"`
	ScanToolId                  int                `sql:"scan_tool_id"`
	// contains filtered or unexported fields
}

type ResourceScanResultRepository

type ResourceScanResultRepository interface {
	SaveInBatch(models []*ResourceScanResult) error
}

type ResourceScanResultRepositoryImpl

type ResourceScanResultRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewResourceScanResultRepositoryImpl

func NewResourceScanResultRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *ResourceScanResultRepositoryImpl

func (ResourceScanResultRepositoryImpl) SaveInBatch

func (impl ResourceScanResultRepositoryImpl) SaveInBatch(models []*ResourceScanResult) error

type ResourceScanType

type ResourceScanType int
const (
	Vulnerabilities ResourceScanType = 1
	License         ResourceScanType = 2
	Config          ResourceScanType = 3
	Secrets         ResourceScanType = 4
)

func (ResourceScanType) ToInt

func (t ResourceScanType) ToInt() int

type ScanStepCondition

type ScanStepCondition struct {
	Id                      int                 `sql:"id,pk"`
	ConditionVariableFormat bean.VariableFormat `sql:"condition_variable_format"`
	ConditionalOperator     string              `sql:"conditional_operator"`
	ConditionalValue        string              `sql:"conditional_value"`
	ConditionOn             string              `sql:"condition_on"` //json path of variable on which condition is to be applied
	Deleted                 bool                `sql:"deleted,notnull"`
	AuditLog
	// contains filtered or unexported fields
}

type ScanStepConditionMapping

type ScanStepConditionMapping struct {
	Id                         int `sql:"id,pk"`
	ScanStepConditionId        int `sql:"scan_step_condition_id"`
	ScanStepConditionMappingId int `sql:"scan_tool_step_id"`
	ScanToolMetadata
	ScanStepCondition
	AuditLog
	// contains filtered or unexported fields
}

type ScanStepConditionMappingRepositoryImpl

type ScanStepConditionMappingRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewScanStepConditionMappingRepositoryImpl

func NewScanStepConditionMappingRepositoryImpl(dbConnection *pg.DB,
	logger *zap.SugaredLogger) *ScanStepConditionMappingRepositoryImpl

func (*ScanStepConditionMappingRepositoryImpl) Save

func (*ScanStepConditionMappingRepositoryImpl) SaveBulk

func (*ScanStepConditionMappingRepositoryImpl) Update

func (*ScanStepConditionMappingRepositoryImpl) UpdateBulk

type ScanStepConditionRepository

type ScanStepConditionRepository interface {
	Save(model *ScanStepCondition) (*ScanStepCondition, error)
	Update(model *ScanStepCondition) (*ScanStepCondition, error)
	SaveBulk(model []*ScanStepCondition) ([]*ScanStepCondition, error)
	UpdateBulk(model []*ScanStepCondition) ([]*ScanStepCondition, error)
	FindAllByToolStepId(toolStepId int) ([]*ScanStepCondition, error)
	MarkDeletedById(id int) error
	MarkAllConditionsDeletedByToolStepId(toolStepId int) error
}

type ScanStepConditionRepositoryImpl

type ScanStepConditionRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewScanStepConditionRepositoryImpl

func NewScanStepConditionRepositoryImpl(dbConnection *pg.DB,
	logger *zap.SugaredLogger) *ScanStepConditionRepositoryImpl

func (*ScanStepConditionRepositoryImpl) FindAllByToolStepId

func (repo *ScanStepConditionRepositoryImpl) FindAllByToolStepId(toolStepId int) ([]*ScanStepCondition, error)

func (*ScanStepConditionRepositoryImpl) MarkAllConditionsDeletedByToolStepId

func (repo *ScanStepConditionRepositoryImpl) MarkAllConditionsDeletedByToolStepId(toolStepId int) error

func (*ScanStepConditionRepositoryImpl) MarkDeletedById

func (repo *ScanStepConditionRepositoryImpl) MarkDeletedById(id int) error

func (*ScanStepConditionRepositoryImpl) Save

func (*ScanStepConditionRepositoryImpl) SaveBulk

func (*ScanStepConditionRepositoryImpl) Update

func (*ScanStepConditionRepositoryImpl) UpdateBulk

type ScanTargetType

type ScanTargetType string
const (
	ImageScanTargetType ScanTargetType = "IMAGE"
	CodeScanTargetType  ScanTargetType = "CODE"
)

type ScanToolExecutionHistoryMapping

type ScanToolExecutionHistoryMapping struct {
	Id                          int                            `sql:"id,pk"`
	ImageScanExecutionHistoryId int                            `sql:"image_scan_execution_history_id"`
	ScanToolId                  int                            `sql:"scan_tool_id"`
	ExecutionStartTime          time.Time                      `sql:"execution_start_time,notnull"`
	ExecutionFinishTime         time.Time                      `sql:"execution_finish_time,notnull"`
	State                       bean.ScanExecutionProcessState `sql:"state"`
	ErrorMessage                string                         `sql:"error_message"`
	TryCount                    int                            `sql:"try_count"`
	AuditLog
	// contains filtered or unexported fields
}

type ScanToolExecutionHistoryMappingRepository

type ScanToolExecutionHistoryMappingRepository interface {
	Save(model *ScanToolExecutionHistoryMapping) error
	SaveInBatch(models []*ScanToolExecutionHistoryMapping) error
	UpdateStateByToolAndExecutionHistoryId(executionHistoryId, toolId int, state bean.ScanExecutionProcessState, executionFinishTime time.Time) error
	MarkAllRunningStateAsFailedHavingTryCountReachedLimit(tryCount int) error
	GetAllScanHistoriesByState(state bean.ScanExecutionProcessState) ([]*ScanToolExecutionHistoryMapping, error)
	GetAllScanHistoriesByExecutionHistoryIdAndStates(executionHistoryId int, states []bean.ScanExecutionProcessState) ([]*ScanToolExecutionHistoryMapping, error)
}

type ScanToolExecutionHistoryMappingRepositoryImpl

type ScanToolExecutionHistoryMappingRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewScanToolExecutionHistoryMappingRepositoryImpl

func NewScanToolExecutionHistoryMappingRepositoryImpl(dbConnection *pg.DB,
	logger *zap.SugaredLogger) *ScanToolExecutionHistoryMappingRepositoryImpl

func (*ScanToolExecutionHistoryMappingRepositoryImpl) GetAllScanHistoriesByExecutionHistoryIdAndStates

func (repo *ScanToolExecutionHistoryMappingRepositoryImpl) GetAllScanHistoriesByExecutionHistoryIdAndStates(executionHistoryId int, states []bean.ScanExecutionProcessState) ([]*ScanToolExecutionHistoryMapping, error)

func (*ScanToolExecutionHistoryMappingRepositoryImpl) GetAllScanHistoriesByState

func (*ScanToolExecutionHistoryMappingRepositoryImpl) MarkAllRunningStateAsFailedHavingTryCountReachedLimit

func (repo *ScanToolExecutionHistoryMappingRepositoryImpl) MarkAllRunningStateAsFailedHavingTryCountReachedLimit(tryCount int) error

func (*ScanToolExecutionHistoryMappingRepositoryImpl) Save

func (*ScanToolExecutionHistoryMappingRepositoryImpl) SaveInBatch

func (*ScanToolExecutionHistoryMappingRepositoryImpl) UpdateStateByToolAndExecutionHistoryId

func (repo *ScanToolExecutionHistoryMappingRepositoryImpl) UpdateStateByToolAndExecutionHistoryId(executionHistoryId, toolId int,
	state bean.ScanExecutionProcessState, executionFinishTime time.Time) error

type ScanToolMetadata

type ScanToolMetadata struct {
	Id                       int            `sql:"id,pk"`
	Name                     string         `sql:"name"`
	Version                  string         `sql:"version"`
	ServerBaseUrl            string         `sql:"server_base_url"`
	ResultDescriptorTemplate string         `sql:"result_descriptor_template"`
	ScanTarget               ScanTargetType `sql:"scan_target"`
	Active                   bool           `sql:"active,notnull"`
	Deleted                  bool           `sql:"deleted,notnull"`
	ToolMetaData             string         `sql:"tool_metadata"`
	AuditLog
	// contains filtered or unexported fields
}

type ScanToolMetadataRepository

type ScanToolMetadataRepository interface {
	FindActiveToolByScanTarget(scanTarget ScanTargetType) (*ScanToolMetadata, error)
	FindByNameAndVersion(name, version string) (*ScanToolMetadata, error)
	FindActiveById(id int) (*ScanToolMetadata, error)
	Save(model *ScanToolMetadata) (*ScanToolMetadata, error)
	Update(model *ScanToolMetadata) (*ScanToolMetadata, error)
	MarkToolDeletedById(id int) error
	FindAllActiveTools() ([]*ScanToolMetadata, error)
}

type ScanToolMetadataRepositoryImpl

type ScanToolMetadataRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewScanToolMetadataRepositoryImpl

func NewScanToolMetadataRepositoryImpl(dbConnection *pg.DB,
	logger *zap.SugaredLogger) *ScanToolMetadataRepositoryImpl

func (*ScanToolMetadataRepositoryImpl) FindActiveById

func (repo *ScanToolMetadataRepositoryImpl) FindActiveById(id int) (*ScanToolMetadata, error)

func (*ScanToolMetadataRepositoryImpl) FindActiveToolByScanTarget

func (repo *ScanToolMetadataRepositoryImpl) FindActiveToolByScanTarget(scanTargetType ScanTargetType) (*ScanToolMetadata, error)

func (*ScanToolMetadataRepositoryImpl) FindAllActiveTools

func (repo *ScanToolMetadataRepositoryImpl) FindAllActiveTools() ([]*ScanToolMetadata, error)

func (*ScanToolMetadataRepositoryImpl) FindByNameAndVersion

func (repo *ScanToolMetadataRepositoryImpl) FindByNameAndVersion(name, version string) (*ScanToolMetadata, error)

func (*ScanToolMetadataRepositoryImpl) MarkToolDeletedById

func (repo *ScanToolMetadataRepositoryImpl) MarkToolDeletedById(id int) error

func (*ScanToolMetadataRepositoryImpl) Save

func (*ScanToolMetadataRepositoryImpl) Update

type ScanToolStep

type ScanToolStep struct {
	Id                      int                    `sql:"id,pk"`
	ScanToolId              int                    `sql:"scan_tool_id"`
	Index                   int                    `sql:"index"`
	StepExecutionType       bean.ScanExecutionType `sql:"step_execution_type"`
	StepExecutionSync       bool                   `sql:"step_execution_sync,notnull"` //sync if true, else async
	RetryCount              int                    `sql:"retry_count"`                 //only applicable if step fails
	ExecuteStepOnFail       int                    `sql:"execute_step_on_fail"`        //fail means that at least one condition is not matched (not applicable for async process)
	ExecuteStepOnPass       int                    `sql:"execute_step_on_pass"`        //pass means that all conditions are matched
	RenderInputDataFromStep int                    `sql:"render_input_data_from_step"` //use this steps output to render input data, -1 if not needed
	HttpInputPayload        json.RawMessage        `sql:"http_input_payload"`
	HttpMethodType          string                 `sql:"http_method_type"`
	HttpReqHeaders          json.RawMessage        `sql:"http_req_headers"`
	HttpQueryParams         json.RawMessage        `sql:"http_query_params"`
	CliCommand              string                 `sql:"cli_command"` //consists of sub command and flags along with applicable values
	CliOutputType           cli_util.CliOutputType `sql:"cli_output_type"`
	Deleted                 bool                   `sql:"deleted,notnull"`
	AuditLog
	// contains filtered or unexported fields
}

type ScanToolStepRepository

type ScanToolStepRepository interface {
	Save(model *ScanToolStep) (*ScanToolStep, error)
	Update(model *ScanToolStep) (*ScanToolStep, error)
	SaveInBatch(model []*ScanToolStep) ([]*ScanToolStep, error)
	UpdateInBatch(model []*ScanToolStep) ([]*ScanToolStep, error)
	FindAllByScanToolId(scanToolId int) ([]*ScanToolStep, error)
	MarkDeletedById(id int) error
	MarkAllStepsDeletedByToolId(scanToolId int) error
}

type ScanToolStepRepositoryImpl

type ScanToolStepRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewScanToolStepRepositoryImpl

func NewScanToolStepRepositoryImpl(dbConnection *pg.DB,
	logger *zap.SugaredLogger) *ScanToolStepRepositoryImpl

func (*ScanToolStepRepositoryImpl) FindAllByScanToolId

func (repo *ScanToolStepRepositoryImpl) FindAllByScanToolId(scanToolId int) ([]*ScanToolStep, error)

func (*ScanToolStepRepositoryImpl) MarkAllStepsDeletedByToolId

func (repo *ScanToolStepRepositoryImpl) MarkAllStepsDeletedByToolId(scanToolId int) error

func (*ScanToolStepRepositoryImpl) MarkDeletedById

func (repo *ScanToolStepRepositoryImpl) MarkDeletedById(id int) error

func (*ScanToolStepRepositoryImpl) Save

func (*ScanToolStepRepositoryImpl) SaveInBatch

func (repo *ScanToolStepRepositoryImpl) SaveInBatch(model []*ScanToolStep) ([]*ScanToolStep, error)

func (*ScanToolStepRepositoryImpl) Update

func (repo *ScanToolStepRepositoryImpl) Update(model *ScanToolStep) (*ScanToolStep, error)

func (*ScanToolStepRepositoryImpl) UpdateInBatch

func (repo *ScanToolStepRepositoryImpl) UpdateInBatch(model []*ScanToolStep) ([]*ScanToolStep, error)

type UserModel

type UserModel struct {
	TableName   struct{} `sql:"users"`
	Id          int32    `sql:"id,pk"`
	EmailId     string   `sql:"email_id,notnull"`
	AccessToken string   `sql:"access_token"`
	Active      bool     `sql:"active,notnull"`
	AuditLog
}

type UserRepository

type UserRepository interface {
	CreateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)
	UpdateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)
	GetById(id int32) (*UserModel, error)
	GetAll() ([]UserModel, error)
	GetUsersByFilter(size int, from int) ([]UserModel, error)
	FetchUserByEmail(email string) (bean.UserInfo, error)
	FetchUserByEmailV2(email string) (*UserModel, error)
	FetchUserDetailByEmailV2(email string) (*UserModel, error)
	GetByIds(ids []int32) ([]UserModel, error)
	DeleteUser(userModel *UserModel, tx *pg.Tx) (bool, error)

	GetConnection() (dbConnection *pg.DB)
	GetByEmailId(email string) ([]UserModel, error)
}

type UserRepositoryImpl

type UserRepositoryImpl struct {
	Logger *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewUserRepositoryImpl

func NewUserRepositoryImpl(dbConnection *pg.DB) *UserRepositoryImpl

func (UserRepositoryImpl) CreateUser

func (impl UserRepositoryImpl) CreateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)

func (UserRepositoryImpl) DeleteUser

func (impl UserRepositoryImpl) DeleteUser(userModel *UserModel, tx *pg.Tx) (bool, error)

func (UserRepositoryImpl) FetchUserByEmail

func (impl UserRepositoryImpl) FetchUserByEmail(email string) (bean.UserInfo, error)

func (UserRepositoryImpl) FetchUserByEmailV2

func (impl UserRepositoryImpl) FetchUserByEmailV2(email string) (*UserModel, error)

func (UserRepositoryImpl) FetchUserDetailByEmailV2

func (impl UserRepositoryImpl) FetchUserDetailByEmailV2(email string) (*UserModel, error)

func (UserRepositoryImpl) GetAll

func (impl UserRepositoryImpl) GetAll() ([]UserModel, error)

func (UserRepositoryImpl) GetByEmailId

func (impl UserRepositoryImpl) GetByEmailId(email string) ([]UserModel, error)

func (UserRepositoryImpl) GetById

func (impl UserRepositoryImpl) GetById(id int32) (*UserModel, error)

func (UserRepositoryImpl) GetByIds

func (impl UserRepositoryImpl) GetByIds(ids []int32) ([]UserModel, error)

func (*UserRepositoryImpl) GetConnection

func (impl *UserRepositoryImpl) GetConnection() (dbConnection *pg.DB)

func (UserRepositoryImpl) GetUsersByFilter

func (impl UserRepositoryImpl) GetUsersByFilter(size int, from int) ([]UserModel, error)

func (UserRepositoryImpl) UpdateUser

func (impl UserRepositoryImpl) UpdateUser(userModel *UserModel, tx *pg.Tx) (*UserModel, error)

type UserRoleModel

type UserRoleModel struct {
	TableName struct{} `sql:"user_roles"`
	Id        int      `sql:"id,pk"`
	UserId    int32    `sql:"user_id,notnull"`
	RoleId    int      `sql:"role_id,notnull"`
	User      UserModel
	AuditLog
}

Jump to

Keyboard shortcuts

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