storage

package
v0.0.0-...-a79a6e6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllDefaultClassAndTags

func GetAllDefaultClassAndTags() ([]*Tag, []*Class, error)

Types

type CScan

type CScan struct {
	DsName    string `json:"dsName"`
	DbName    string `json:"dbName"`
	TableName string `json:"tableName"`
	Columns   string `json:"columns"`
	Classes   string `json:"classes"`
	Tags      string `json:"tags"`
}

type Class

type Class struct {
	Id          int    `csv:"id"`
	Description string `csv:"description"`
	Rule        string `csv:"rule"`
	Class       string `csv:"class"`
}

type DpDataSource

type DpDataSource struct {
	ID           int    `json:"id"`
	Datadomain   string `json:"Datadomain"`
	Dsname       string `json:"Dsname"`
	Dsdecription string `json:"Dsdecription"`
	Dstype       string `json:"Dstype"`
	DsKey        string `json:"DsKey"`
	Dsversion    string `json:"Dsversion"`
	Host         string `json:"Host"`
	Port         string `json:"Port"`
	User         string `json:"User"`
	Password     string `json:"Password"`
	CreatedAt    string `json:"CreatedAt"`
}

type DpDbColumn

type DpDbColumn struct {
	ColumnName    string `json:"column_name"`
	ColumnType    string `json:"ColumnType"`
	ColumnComment string `json:"Column_Comment"`
	Tags          string `json:"Tags"`
	Classes       string `json:"Classes"`
}

type DpDbDatabase

type DpDbDatabase struct {
	DsKey      string      `json:"DbKey"`
	Name       string      `json:"Name"`
	Type       string      `json:"Type"`
	DpDbTables []DpDbTable `json:"DpDbTable"`
}

type DpDbTable

type DpDbTable struct {
	Name        string       `json:"Name"`
	Tags        string       `json:"Tags"`
	DpDbColumns []DpDbColumn `json:"DpDbColumns"`
}

type DpSensitiveDataElementTag

type DpSensitiveDataElementTag struct {
	ID                     int    `json:"id" gorm:"primary_key"`
	SensitiveDataElementID int    `json:"sensitive_data_element_id"`
	WorkspaceID            int    `json:"workspace_id"`
	Tag                    string `json:"tag"`
}

type InternalStorage

type InternalStorage struct {
	SqliteConnc *sql.DB
	Path        string
}

func NewInternalStorage

func NewInternalStorage(dsn string) (InternalStorage, error)

func (InternalStorage) AddClass

func (insto InternalStorage) AddClass(description string, rule string, class string) error

func (InternalStorage) AddDataSource

func (into InternalStorage) AddDataSource(dpDataSource DpDataSource) (int64, error)

func (InternalStorage) AddTag

func (insto InternalStorage) AddTag(name string, description string, rules []string) error

func (InternalStorage) ApplyPolicy

func (into InternalStorage) ApplyPolicy(dsname string, ids []int64) error

func (InternalStorage) DeleteClasses

func (into InternalStorage) DeleteClasses(ids []int64) (bool, error)

func (InternalStorage) DeleteDataSources

func (into InternalStorage) DeleteDataSources(ids []int64) (bool, error)

func (InternalStorage) DeleteTags

func (into InternalStorage) DeleteTags(ids []int64) (bool, error)

func (InternalStorage) GetAssociatedClasses

func (insto InternalStorage) GetAssociatedClasses(rule string) ([]Class, error)

func (InternalStorage) GetAssociatedTags

func (insto InternalStorage) GetAssociatedTags(class string) ([]Tag, error)

func (InternalStorage) GetClasses

func (insto InternalStorage) GetClasses() ([]Class, error)

func (InternalStorage) GetDataSource

func (into InternalStorage) GetDataSource(dsname string) (DpDataSource, error)

func (InternalStorage) GetDataSources

func (into InternalStorage) GetDataSources() ([]DpDataSource, error)

func (InternalStorage) GetRecommendedPolicy

func (into InternalStorage) GetRecommendedPolicy(dsname string) ([]RecommendedPolicy, error)

func (InternalStorage) GetScanLog

func (insto InternalStorage) GetScanLog(ds string, db string, table string, columns []string) ([]CScan, error)

func (InternalStorage) GetStatus

func (into InternalStorage) GetStatus(dsname string) (string, error)

func (InternalStorage) GetTags

func (insto InternalStorage) GetTags() ([]Tag, error)

func (InternalStorage) InsertDefaultData

func (into InternalStorage) InsertDefaultData(tags []*Tag, classes []*Class) error

func (InternalStorage) Scan

func (into InternalStorage) Scan(dsname string) error

func (InternalStorage) SetSchemaData

func (into InternalStorage) SetSchemaData(dpDbDatabase DpDbDatabase) error

func (InternalStorage) UpdateDSStatus

func (insto InternalStorage) UpdateDSStatus(dsid int64, statusid int64) error

type RecommendedPolicy

type RecommendedPolicy struct {
	PolicyId   int32
	PolicyName string
}

type ScanDto

type ScanDto struct {
	DatabaseId int `json:"db_id"`
}

type SensitiveDataElement

type SensitiveDataElement struct {
	ID                      int                         `json:"id" gorm:"primary_key"`
	WorkspaceID             int                         `json:"workspace_id"`
	DpDbColumn              string                      `json:"dp_db_column"`
	ElementID               int                         `json:"element_id"`
	DeletedAt               time.Time                   `json:"deleted_at"`
	SensitivityClass        string                      `json:"sensitivity_class"`
	SensitiveDataElementTag []DpSensitiveDataElementTag `gorm:"foreignKey:SensitiveDataElementID;references:ID" json:"sensitive_data_element_tag"`
}

type SensitiveElementTag

type SensitiveElementTag struct {
	SensitiveElementTags []SensitiveElementTags `json:"sensitive_data_element"`
}

type SensitiveElementTags

type SensitiveElementTags struct {
	SensitivityClass string `json:"sensitivity_class"`
	Tags             string `json:"tags"`
}

type Storage

type Storage interface {
	GetClasses() ([]Class, error)
	AddClass(string, string, string) error
	DeleteClasses(ids []int64) (bool, error)

	GetTags() ([]Tag, error)
	AddTag(string, string, []string) error
	DeleteTags(ids []int64) (bool, error)

	GetAssociatedTags(string) ([]Tag, error)
	GetAssociatedClasses(string) ([]Class, error)
	SetSchemaData(DpDbDatabase) error

	AddDataSource(DpDataSource) (int64, error)
	GetDataSources() ([]DpDataSource, error)
	DeleteDataSources(ids []int64) (bool, error)
	Scan(dsname string) error
	GetStatus(dsname string) (string, error)
	GetRecommendedPolicy(dsname string) ([]RecommendedPolicy, error)
	ApplyPolicy(dsname string, ids []int64) error
	GetDataSource(dsname string) (DpDataSource, error)

	GetScanLog(ds string, db string, table string, columns []string) ([]CScan, error)

	UpdateDSStatus(dsid int64, statusid int64) error
}

func GetStorageInstance

func GetStorageInstance() (Storage, error)

func New

func New(config StorageConfig) (Storage, error)

type StorageConfig

type StorageConfig struct {
	Type string
	Path string
}

type Tag

type Tag struct {
	Id          int    `csv:"id"`
	TagName     string `csv:"tag_name"`
	Rule        string `csv:"rule"`
	Description string `csv:"description"`
}

Jump to

Keyboard shortcuts

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