|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MonitorWidget struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Value any `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DashboardState struct {
|
|
|
|
Widgets []MonitorWidget `json:"widgets"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Database interface {
|
|
|
|
// Dashboard DashboardState
|
|
|
|
|
|
|
|
GetDashboardState() (DashboardState, error)
|
|
|
|
SetDashboardState(DashboardState) error
|
|
|
|
|
|
|
|
// API Keys
|
|
|
|
|
|
|
|
AllAPIKeys() ([]string, error)
|
|
|
|
|
|
|
|
CreateAPIKey() (string, error)
|
|
|
|
CheckAPIKey(key string) error
|
|
|
|
RemoveAPIKey(key string) error
|
|
|
|
|
|
|
|
// Bucket Operations
|
|
|
|
|
|
|
|
AllBuckets() ([]string, error)
|
|
|
|
|
|
|
|
CreateBucket(bucket string, settings any) error
|
|
|
|
GetBucketSettings(bucket string) (any, error)
|
|
|
|
SetBucketSettings(bucket string, settings any) error
|
|
|
|
DeleteBucket(bucket string) error
|
|
|
|
|
|
|
|
// Bucket Object Operations
|
|
|
|
|
|
|
|
AllBucketObjects(bucket string) ([]string, error)
|
|
|
|
|
|
|
|
CreateBucketObject(bucket string, r io.Reader) (string, error)
|
|
|
|
GetBucketObject(bucket, id string, w io.Writer) error
|
|
|
|
SetBucketObject(bucket, id string, r io.Reader) error
|
|
|
|
DeleteBucketObject(bucket, id string) error
|
|
|
|
}
|