Documentation ¶
Index ¶
- Constants
- Variables
- func CheckLicenseActive(next http.Handler) http.Handler
- func ContextWithNameSpace(ctx context.Context, ns NamespaceID) context.Context
- func ForEachNamespace(applyFn func(ctx context.Context) (string, error))
- func GetFileServerHost(ctx context.Context) (string, error)
- func GetFileServerURL(ctx context.Context) (string, error)
- func Injector(next http.Handler) http.Handler
- func IsNonSaaSDeployment() bool
- func Neo4jClient(ctx context.Context) (neo4j.DriverWithContext, error)
- func NewContextWithNameSpace(ns NamespaceID) context.Context
- func NewGlobalContext() context.Context
- func NewSQLConnection(ctx context.Context) (*sql.DB, error)
- func PostgresClient(ctx context.Context) (*postgresqlDb.Queries, error)
- func RedisClient(ctx context.Context) (*redis.Client, error)
- func WithDatabaseContext(ctx context.Context) context.Context
- func WithGlobalContext(ctx context.Context) context.Context
- type AlreadyPresentError
- type CypherDriver
- type DBConfigs
- type FileDeleteError
- type FileManager
- type FileServerConfig
- type FileServerFileManager
- func (mfm *FileServerFileManager) Bucket() string
- func (mfm *FileServerFileManager) CleanNamespace(ctx context.Context) error
- func (mfm *FileServerFileManager) Client() interface{}
- func (mfm *FileServerFileManager) CreatePublicBucket(ctx context.Context, bucket string) error
- func (mfm *FileServerFileManager) CreatePublicUploadURL(ctx context.Context, filePath string, addFilePathPrefix bool, ...) (string, error)
- func (mfm *FileServerFileManager) DeleteFile(ctx context.Context, filePath string, addFilePathPrefix bool, ...) error
- func (mfm *FileServerFileManager) DownloadFile(ctx context.Context, remoteFile string, localFile string, extra interface{}) error
- func (mfm *FileServerFileManager) DownloadFileContexts(ctx context.Context, remoteFile string, extra interface{}) ([]byte, error)
- func (mfm *FileServerFileManager) DownloadFileTo(ctx context.Context, remoteFile string, writer io.WriteCloser, ...) error
- func (mfm *FileServerFileManager) ExposeFile(ctx context.Context, filePath string, addFilePathPrefix bool, ...) (string, error)
- func (mfm *FileServerFileManager) ListFiles(ctx context.Context, pathPrefix string, recursive bool, maxKeys int, ...) []ObjectInfo
- func (mfm *FileServerFileManager) UploadFile(ctx context.Context, filename string, data []byte, overwrite bool, ...) (UploadResult, error)
- func (mfm *FileServerFileManager) UploadLocalFile(ctx context.Context, filename string, localFilename string, overwrite bool, ...) (UploadResult, error)
- type NamespaceID
- type Neo4jConfig
- type ObjectInfo
- type PathDoesNotExistsError
- type PostgresqlConfig
- type RedisConfig
- type SettingValue
- type UploadResult
- type WorkEnqueuer
Constants ¶
View Source
const ( GlobalDirKey = NamespaceID("global") NonSaaSDirKey = NamespaceID("default") DatabaseDirKey = NamespaceID("database") NamespaceKey = "namespace" LicenseActiveKey = "license_active" )
View Source
const (
ConsoleURLSettingKey = "console_url"
)
Variables ¶
View Source
var ( FileServerExternal = utils.GetEnvOrDefault("DEEPFENCE_FILE_SERVER_EXTERNAL", "false") == "true" FileServerProtocol string FileServerSecure = utils.GetEnvOrDefault("DEEPFENCE_FILE_SERVER_SECURE", "false") == "true" FileServerHost = utils.GetEnvOrDefault("DEEPFENCE_FILE_SERVER_HOST", "deepfence-file-server") FileServerPort = utils.GetEnvOrDefault("DEEPFENCE_FILE_SERVER_PORT", "9000") FileServerRegion = utils.GetEnvOrDefault("DEEPFENCE_FILE_SERVER_REGION", "") FileServerBucket = utils.GetEnvOrDefault("DEEPFENCE_FILE_SERVER_BUCKET", string(NonSaaSDirKey)) FileServerDatabaseBucket = utils.GetEnvOrDefault("DEEPFENCE_FILE_SERVER_DB_BUCKET", string(DatabaseDirKey)) )
View Source
var ErrDatabaseConfigNotFound = errors.New("database config not found")
View Source
var ErrExhaustedResources = errors.New("exhausted worker resources")
View Source
var ErrNamespaceNotFound = errors.New("namespace/tenet-id not found")
Functions ¶
func ContextWithNameSpace ¶
func ContextWithNameSpace(ctx context.Context, ns NamespaceID) context.Context
func IsNonSaaSDeployment ¶
func IsNonSaaSDeployment() bool
func Neo4jClient ¶
func Neo4jClient(ctx context.Context) (neo4j.DriverWithContext, error)
func NewContextWithNameSpace ¶
func NewContextWithNameSpace(ns NamespaceID) context.Context
func NewGlobalContext ¶
func PostgresClient ¶
func PostgresClient(ctx context.Context) (*postgresqlDb.Queries, error)
func RedisClient ¶
Types ¶
type AlreadyPresentError ¶
type AlreadyPresentError struct {
Path string
}
func (AlreadyPresentError) Error ¶
func (e AlreadyPresentError) Error() string
type CypherDriver ¶
type CypherDriver struct {
// contains filtered or unexported fields
}
type DBConfigs ¶
type DBConfigs struct { Redis *RedisConfig Neo4j *Neo4jConfig Postgres *PostgresqlConfig FileServer *FileServerConfig }
type FileDeleteError ¶
type FileDeleteError struct {
Path string
}
func (FileDeleteError) Error ¶
func (e FileDeleteError) Error() string
type FileManager ¶
type FileManager interface { ListFiles(ctx context.Context, pathPrefix string, recursive bool, maxKeys int, skipDir bool) []ObjectInfo UploadLocalFile(ctx context.Context, filename string, localFilename string, overwrite bool, extra interface{}) (UploadResult, error) UploadFile(ctx context.Context, filename string, data []byte, overwrite bool, extra interface{}) (UploadResult, error) DeleteFile(ctx context.Context, filename string, addFilePathPrefix bool, extra interface{}) error DownloadFile(ctx context.Context, remoteFile string, localFile string, extra interface{}) error DownloadFileTo(ctx context.Context, remoteFile string, localFile io.WriteCloser, extra interface{}) error DownloadFileContexts(ctx context.Context, remoteFile string, extra interface{}) ([]byte, error) ExposeFile(ctx context.Context, filePath string, addFilePathPrefix bool, expires time.Duration, reqParams url.Values, consoleURL string) (string, error) CreatePublicUploadURL(ctx context.Context, filePath string, addFilePathPrefix bool, expires time.Duration, reqParams url.Values, consoleURL string) (string, error) Client() interface{} Bucket() string CreatePublicBucket(ctx context.Context, bucket string) error CleanNamespace(ctx context.Context) error }
func FileServerClient ¶
func FileServerClient(ctx context.Context) (FileManager, error)
type FileServerConfig ¶
type FileServerFileManager ¶
type FileServerFileManager struct {
// contains filtered or unexported fields
}
func (*FileServerFileManager) Bucket ¶
func (mfm *FileServerFileManager) Bucket() string
func (*FileServerFileManager) CleanNamespace ¶
func (mfm *FileServerFileManager) CleanNamespace(ctx context.Context) error
func (*FileServerFileManager) Client ¶
func (mfm *FileServerFileManager) Client() interface{}
func (*FileServerFileManager) CreatePublicBucket ¶
func (mfm *FileServerFileManager) CreatePublicBucket(ctx context.Context, bucket string) error
func (*FileServerFileManager) CreatePublicUploadURL ¶
func (*FileServerFileManager) DeleteFile ¶
func (*FileServerFileManager) DownloadFile ¶
func (*FileServerFileManager) DownloadFileContexts ¶
func (*FileServerFileManager) DownloadFileTo ¶
func (mfm *FileServerFileManager) DownloadFileTo(ctx context.Context, remoteFile string, writer io.WriteCloser, extra interface{}) error
func (*FileServerFileManager) ExposeFile ¶
func (*FileServerFileManager) ListFiles ¶
func (mfm *FileServerFileManager) ListFiles(ctx context.Context, pathPrefix string, recursive bool, maxKeys int, skipDir bool) []ObjectInfo
func (*FileServerFileManager) UploadFile ¶
func (mfm *FileServerFileManager) UploadFile(ctx context.Context, filename string, data []byte, overwrite bool, extra interface{}) (UploadResult, error)
func (*FileServerFileManager) UploadLocalFile ¶
func (mfm *FileServerFileManager) UploadLocalFile(ctx context.Context, filename string, localFilename string, overwrite bool, extra interface{}) (UploadResult, error)
type NamespaceID ¶
type NamespaceID string
func ExtractNamespace ¶
func ExtractNamespace(ctx context.Context) (NamespaceID, error)
func FetchNamespace ¶
func FetchNamespace(email string) NamespaceID
func GetAllNamespaces ¶
func GetAllNamespaces() []NamespaceID
type Neo4jConfig ¶
type ObjectInfo ¶
type ObjectInfo struct { Key string `json:"name"` // Name of the object LastModified time.Time `json:"lastModified"` // Date and time the object was last modified. Size int64 `json:"size"` // Size in bytes of the object. ContentType string `json:"contentType"` // A standard MIME type describing the format of the object data. Expires time.Time `json:"expires"` // The date and time at which the object is no longer able to be cached. IsDir bool `json:"isDir"` // Is this object a directory }
type PathDoesNotExistsError ¶
type PathDoesNotExistsError struct {
Path string
}
func (PathDoesNotExistsError) Error ¶
func (e PathDoesNotExistsError) Error() string
type PostgresqlConfig ¶
type RedisConfig ¶
type SettingValue ¶
type UploadResult ¶
type WorkEnqueuer ¶
type WorkEnqueuer struct {
// contains filtered or unexported fields
}
func (WorkEnqueuer) DeleteAllArchivedTasks ¶
func (ws WorkEnqueuer) DeleteAllArchivedTasks() (int, []error)
func (WorkEnqueuer) EnqueueUnique ¶
utility func to use when task name is used as task id to ensure unique task is enqueued
func (WorkEnqueuer) Inspector ¶
func (ws WorkEnqueuer) Inspector() *asynq.Inspector
Click to show internal directories.
Click to hide internal directories.