You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
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
|
|
}
|