169 lines
4.9 KiB
Go
169 lines
4.9 KiB
Go
package domain
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type Application struct {
|
|
ID int64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
Department string `json:"department"`
|
|
Owner string `json:"owner"`
|
|
Desc string `json:"desc"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
UpdatedBy string `json:"-"`
|
|
}
|
|
|
|
type Environment struct {
|
|
ID int64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
Order int `json:"order"`
|
|
Desc string `json:"desc"`
|
|
UpdatedBy string `json:"-"`
|
|
}
|
|
|
|
type Namespace struct {
|
|
ID int64 `json:"id"`
|
|
AppID int64 `json:"appId"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Desc string `json:"desc"`
|
|
UpdatedBy string `json:"-"`
|
|
}
|
|
|
|
type ConfigItem struct {
|
|
ID int64 `json:"id"`
|
|
AppID int64 `json:"appId"`
|
|
NamespaceID int64 `json:"nsId"`
|
|
EnvironmentID int64 `json:"envId"`
|
|
Key string `json:"key"`
|
|
Value string `json:"value"`
|
|
ReleasedValue *string `json:"releasedValue"`
|
|
PendingDelete bool `json:"pendingDelete"`
|
|
Comment string `json:"comment"`
|
|
UpdatedBy string `json:"updatedBy"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
func (item ConfigItem) Pending() bool {
|
|
return item.PendingDelete || item.ReleasedValue == nil || *item.ReleasedValue != item.Value
|
|
}
|
|
|
|
type Release struct {
|
|
ID int64 `json:"id"`
|
|
AppID int64 `json:"appId"`
|
|
NamespaceID int64 `json:"nsId"`
|
|
EnvironmentID int64 `json:"envId"`
|
|
Version int `json:"version"`
|
|
Snapshot map[string]string `json:"snapshot"`
|
|
Added int `json:"added"`
|
|
Modified int `json:"modified"`
|
|
Removed int `json:"removed"`
|
|
Comment string `json:"comment"`
|
|
Operator string `json:"operator"`
|
|
EtcdRevision *int64 `json:"etcdRevision"`
|
|
Status string `json:"status"`
|
|
Time time.Time `json:"time"`
|
|
}
|
|
|
|
type PublishRequest struct {
|
|
EnvironmentID int64 `json:"envId"`
|
|
AppID int64 `json:"appId"`
|
|
NamespaceID int64 `json:"nsId"`
|
|
Comment string `json:"comment"`
|
|
Operator string `json:"operator"`
|
|
}
|
|
|
|
type RollbackRequest struct {
|
|
EnvironmentID int64 `json:"envId"`
|
|
AppID int64 `json:"appId"`
|
|
NamespaceID int64 `json:"nsId"`
|
|
TargetVersion int `json:"targetVersion"`
|
|
Operator string `json:"operator"`
|
|
}
|
|
|
|
type RuntimeConfig struct {
|
|
Items map[string]string `json:"items"`
|
|
Revision int64 `json:"revision"`
|
|
ReleaseVersion int `json:"releaseVersion"`
|
|
GrayRuleIDs []int64 `json:"grayRuleIds,omitempty"`
|
|
}
|
|
|
|
type OutboxEntry struct {
|
|
ID int64
|
|
ReleaseID int64
|
|
EtcdKey string
|
|
Payload json.RawMessage
|
|
RetryCount int
|
|
}
|
|
|
|
type AuditLog struct {
|
|
ID int64 `json:"id"`
|
|
Actor string `json:"actor"`
|
|
Action string `json:"action"`
|
|
TargetType string `json:"targetType"`
|
|
TargetID *int64 `json:"targetId"`
|
|
Detail json.RawMessage `json:"detail"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
}
|
|
|
|
type ConfigEvent struct {
|
|
Type string `json:"type"`
|
|
Items map[string]string `json:"items"`
|
|
Revision int64 `json:"revision"`
|
|
GrayRuleIDs []int64 `json:"grayRuleIds,omitempty"`
|
|
}
|
|
|
|
type User struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"displayName"`
|
|
IsAdmin bool `json:"isAdmin"`
|
|
Disabled bool `json:"disabled"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedBy string `json:"-"`
|
|
}
|
|
|
|
type UserCredential struct {
|
|
User
|
|
PasswordHash string `json:"-"`
|
|
}
|
|
|
|
type UserAppRole struct {
|
|
UserID int64 `json:"userId"`
|
|
AppID int64 `json:"appId"`
|
|
Role string `json:"role"`
|
|
UpdatedBy string `json:"-"`
|
|
}
|
|
|
|
type Principal struct {
|
|
UserID int64 `json:"userId"`
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"displayName"`
|
|
IsAdmin bool `json:"isAdmin"`
|
|
}
|
|
|
|
type GrayRule struct {
|
|
ID int64 `json:"id"`
|
|
AppID int64 `json:"appId"`
|
|
NamespaceID int64 `json:"nsId"`
|
|
EnvironmentID int64 `json:"envId"`
|
|
RuleType string `json:"ruleType"`
|
|
RuleValue json.RawMessage `json:"ruleValue"`
|
|
Overrides map[string]string `json:"overrides"`
|
|
Enabled bool `json:"enabled"`
|
|
Priority int `json:"priority"`
|
|
Desc string `json:"desc"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
}
|
|
|
|
type OutboxStats struct {
|
|
Pending int64 `json:"pending"`
|
|
Processing int64 `json:"processing"`
|
|
Failed int64 `json:"failed"`
|
|
}
|