817 lines
20 KiB
Go
817 lines
20 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type UserStatus string
|
|
|
|
const (
|
|
UserStatusActive UserStatus = "active"
|
|
UserStatusDisabled UserStatus = "disabled"
|
|
UserStatusPending UserStatus = "pending"
|
|
)
|
|
|
|
type AIProviderKind string
|
|
|
|
const (
|
|
AIProviderKindOpenAICompatible AIProviderKind = "openai-compatible"
|
|
AIProviderKindOpenAI AIProviderKind = "openai"
|
|
AIProviderKindClaude AIProviderKind = "claude"
|
|
AIProviderKindGemini AIProviderKind = "gemini"
|
|
AIProviderKindOllama AIProviderKind = "ollama"
|
|
AIProviderKindCustom AIProviderKind = "custom"
|
|
)
|
|
|
|
type AIRelayMode string
|
|
|
|
const (
|
|
AIRelayModeDirect AIRelayMode = "direct"
|
|
AIRelayModeRelay AIRelayMode = "relay"
|
|
AIRelayModeLocal AIRelayMode = "local"
|
|
)
|
|
|
|
type AIProviderStatus string
|
|
|
|
const (
|
|
AIProviderStatusActive AIProviderStatus = "active"
|
|
AIProviderStatusDisabled AIProviderStatus = "disabled"
|
|
AIProviderStatusError AIProviderStatus = "error"
|
|
)
|
|
|
|
type GamePluginStatus string
|
|
|
|
const (
|
|
GamePluginStatusInstalled GamePluginStatus = "installed"
|
|
GamePluginStatusDisabled GamePluginStatus = "disabled"
|
|
GamePluginStatusInvalid GamePluginStatus = "invalid"
|
|
GamePluginStatusUpdating GamePluginStatus = "updating"
|
|
)
|
|
|
|
type PluginMarketplaceStateAction string
|
|
|
|
const (
|
|
PluginMarketplaceStateActionInstall PluginMarketplaceStateAction = "install"
|
|
PluginMarketplaceStateActionEnable PluginMarketplaceStateAction = "enable"
|
|
PluginMarketplaceStateActionDisable PluginMarketplaceStateAction = "disable"
|
|
)
|
|
|
|
type ServerInstanceState string
|
|
|
|
const (
|
|
ServerInstanceStateDraft ServerInstanceState = "draft"
|
|
ServerInstanceStateInstalling ServerInstanceState = "installing"
|
|
ServerInstanceStateReady ServerInstanceState = "ready"
|
|
ServerInstanceStateRunning ServerInstanceState = "running"
|
|
ServerInstanceStateStopped ServerInstanceState = "stopped"
|
|
ServerInstanceStateFailed ServerInstanceState = "failed"
|
|
ServerInstanceStateDeleted ServerInstanceState = "deleted"
|
|
)
|
|
|
|
type RunEndpointStatus string
|
|
|
|
const (
|
|
RunEndpointStatusOnline RunEndpointStatus = "online"
|
|
RunEndpointStatusOffline RunEndpointStatus = "offline"
|
|
RunEndpointStatusDegraded RunEndpointStatus = "degraded"
|
|
RunEndpointStatusDisabled RunEndpointStatus = "disabled"
|
|
)
|
|
|
|
type JobState string
|
|
|
|
const (
|
|
JobStateQueued JobState = "queued"
|
|
JobStateAccepted JobState = "accepted"
|
|
JobStateRunning JobState = "running"
|
|
JobStateSucceeded JobState = "succeeded"
|
|
JobStateFailed JobState = "failed"
|
|
JobStateCancelled JobState = "cancelled"
|
|
)
|
|
|
|
type ArtifactOwnerKind string
|
|
|
|
const (
|
|
ArtifactOwnerKindPlatform ArtifactOwnerKind = "platform"
|
|
ArtifactOwnerKindPlugin ArtifactOwnerKind = "plugin"
|
|
ArtifactOwnerKindServerInstance ArtifactOwnerKind = "server-instance"
|
|
ArtifactOwnerKindJob ArtifactOwnerKind = "job"
|
|
)
|
|
|
|
type ArtifactState string
|
|
|
|
const (
|
|
ArtifactStateUploading ArtifactState = "uploading"
|
|
ArtifactStateAvailable ArtifactState = "available"
|
|
ArtifactStateExpired ArtifactState = "expired"
|
|
ArtifactStateFailed ArtifactState = "failed"
|
|
)
|
|
|
|
type LogStreamSource string
|
|
|
|
const (
|
|
LogStreamSourceProcess LogStreamSource = "process"
|
|
LogStreamSourceFile LogStreamSource = "file"
|
|
LogStreamSourcePlugin LogStreamSource = "plugin"
|
|
)
|
|
|
|
type LogStorageBackend string
|
|
|
|
const (
|
|
LogStorageBackendLocalSegments LogStorageBackend = "local-segments"
|
|
LogStorageBackendLoki LogStorageBackend = "loki"
|
|
LogStorageBackendClickHouse LogStorageBackend = "clickhouse"
|
|
LogStorageBackendOpenSearch LogStorageBackend = "opensearch"
|
|
LogStorageBackendElasticsearch LogStorageBackend = "elasticsearch"
|
|
)
|
|
|
|
type AuditResult string
|
|
|
|
const (
|
|
AuditResultSuccess AuditResult = "success"
|
|
AuditResultDenied AuditResult = "denied"
|
|
AuditResultFailed AuditResult = "failed"
|
|
AuditResultQueued AuditResult = "queued"
|
|
)
|
|
|
|
type User struct {
|
|
ID string
|
|
DisplayName string
|
|
Email string
|
|
Status UserStatus
|
|
Roles []string
|
|
PasswordHash string
|
|
Profile UserProfile
|
|
Theme UserThemePreference
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type UserProfile struct {
|
|
AvatarURL string
|
|
Phone string
|
|
QQ string
|
|
ContactNote string
|
|
}
|
|
|
|
type UserThemePreference struct {
|
|
UserID string
|
|
PaletteID string
|
|
BackgroundPresetID string
|
|
BackgroundImage string
|
|
Persistence string
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type UserRegistration struct {
|
|
DisplayName string
|
|
Email string
|
|
Password string
|
|
Profile UserProfile
|
|
}
|
|
|
|
type UserLogin struct {
|
|
Account string
|
|
Password string
|
|
}
|
|
|
|
type AuthSession struct {
|
|
SessionID string
|
|
User User
|
|
Status string
|
|
Message string
|
|
}
|
|
|
|
type AIProvider struct {
|
|
ID string
|
|
Name string
|
|
Kind AIProviderKind
|
|
BaseURL string
|
|
APIKeyRef string
|
|
Models []string
|
|
DefaultModel string
|
|
RelayMode AIRelayMode
|
|
TimeoutMS int
|
|
Status AIProviderStatus
|
|
RedactionPolicy string
|
|
}
|
|
|
|
type AIProviderTestResult struct {
|
|
ProviderID string
|
|
Mode string
|
|
Success bool
|
|
Message string
|
|
Violations []string
|
|
}
|
|
|
|
type AIProviderModels struct {
|
|
ProviderID string
|
|
DefaultModel string
|
|
Models []string
|
|
}
|
|
|
|
type PluginPermissions struct {
|
|
AI bool
|
|
Logs bool
|
|
Files bool
|
|
Jobs bool
|
|
Artifacts bool
|
|
}
|
|
|
|
type PluginLifecycleActions struct {
|
|
Install string
|
|
Start string
|
|
Stop string
|
|
Restart string
|
|
Status string
|
|
}
|
|
|
|
type GamePluginPage struct {
|
|
Key string
|
|
Title string
|
|
Path string
|
|
Permissions []string
|
|
BridgeActions []string
|
|
}
|
|
|
|
type GamePluginBridge struct {
|
|
Actions []string
|
|
}
|
|
|
|
type GamePluginManifestServer struct {
|
|
Type string
|
|
DisplayName string
|
|
SupportedOS []string
|
|
CreateFormSchema string
|
|
}
|
|
|
|
type GamePluginManifestAI struct {
|
|
Purposes []string
|
|
}
|
|
|
|
type GamePluginManifest struct {
|
|
ID string
|
|
Name string
|
|
Description string
|
|
Version string
|
|
Kind string
|
|
Tags []string
|
|
Server GamePluginManifestServer
|
|
Bridge GamePluginBridge
|
|
Capabilities []string
|
|
Permissions []string
|
|
Actions PluginLifecycleActions
|
|
Pages []GamePluginPage
|
|
AI GamePluginManifestAI
|
|
}
|
|
|
|
type GamePluginManifestRegistration struct {
|
|
ManifestRef string
|
|
Manifest GamePluginManifest
|
|
}
|
|
|
|
type GamePlugin struct {
|
|
ID string
|
|
Name string
|
|
Description string
|
|
Version string
|
|
ServerType string
|
|
ServerDisplayName string
|
|
SupportedOS []string
|
|
ManifestRef string
|
|
CreateFormSchemaRef string
|
|
RequiredRunCapabilities []string
|
|
DeclaredPermissions []string
|
|
Permissions PluginPermissions
|
|
LifecycleActions PluginLifecycleActions
|
|
BridgeActions []string
|
|
Pages []GamePluginPage
|
|
Tags []string
|
|
AIPurposes []string
|
|
ValidationViolations []string
|
|
Status GamePluginStatus
|
|
}
|
|
|
|
type PluginMarketplacePlugin struct {
|
|
ID string
|
|
Name string
|
|
Description string
|
|
Version string
|
|
ServerType string
|
|
ServerDisplayName string
|
|
SupportedOS []string
|
|
ManifestRef string
|
|
CreateFormSchemaRef string
|
|
Capabilities []string
|
|
DeclaredPermissions []string
|
|
Permissions PluginPermissions
|
|
LifecycleActions PluginLifecycleActions
|
|
BridgeActions []string
|
|
Pages []GamePluginPage
|
|
Tags []string
|
|
AIPurposes []string
|
|
ValidationViolations []string
|
|
Status GamePluginStatus
|
|
Source string
|
|
}
|
|
|
|
type PluginBridgeAction string
|
|
|
|
const (
|
|
PluginBridgeActionServerInstancesRead PluginBridgeAction = "server.instances.read"
|
|
PluginBridgeActionJobsDispatch PluginBridgeAction = "jobs.dispatch"
|
|
PluginBridgeActionLogsQuery PluginBridgeAction = "logs.query"
|
|
PluginBridgeActionArtifactsOpen PluginBridgeAction = "artifacts.open"
|
|
PluginBridgeActionFilesRequest PluginBridgeAction = "files.request"
|
|
PluginBridgeActionAIInvoke PluginBridgeAction = "ai.invoke"
|
|
)
|
|
|
|
type PluginBridgeAuthorizeRequest struct {
|
|
PluginID string
|
|
RouteKey string
|
|
ServerInstanceID string
|
|
Action PluginBridgeAction
|
|
AIPurpose string
|
|
}
|
|
|
|
type PluginBridgeAuthorization struct {
|
|
PluginID string
|
|
RouteKey string
|
|
ServerInstanceID string
|
|
Action PluginBridgeAction
|
|
Allowed bool
|
|
RequiredPermissions []string
|
|
EffectivePermissions []string
|
|
Reason string
|
|
}
|
|
|
|
type PluginBridgeExecuteRequest struct {
|
|
RequestID string
|
|
PluginID string
|
|
RouteKey string
|
|
ServerInstanceID string
|
|
Action PluginBridgeAction
|
|
AIPurpose string
|
|
Payload map[string]string
|
|
}
|
|
|
|
type PluginBridgeSafeError struct {
|
|
Code string
|
|
Message string
|
|
Details []string
|
|
}
|
|
|
|
type PluginBridgeExecuteResponse struct {
|
|
RequestID string
|
|
PluginID string
|
|
RouteKey string
|
|
ServerInstanceID string
|
|
Action PluginBridgeAction
|
|
Status string
|
|
Result map[string]string
|
|
Error *PluginBridgeSafeError
|
|
}
|
|
|
|
type ServerInstance struct {
|
|
ID string
|
|
PluginID string
|
|
PluginVersion string
|
|
RunEndpointID string
|
|
Name string
|
|
OwnerUserID string
|
|
AdminUserIDs []string
|
|
State ServerInstanceState
|
|
ConfigVersion int
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type PlatformResourceUsage struct {
|
|
CPUPercent float64
|
|
MemoryPercent float64
|
|
DiskPercent float64
|
|
Source string
|
|
CollectedAt time.Time
|
|
}
|
|
|
|
type ServerMetrics struct {
|
|
ServerInstanceID string
|
|
Online bool
|
|
PlayerCount *int
|
|
MaxPlayers *int
|
|
TPS *float64
|
|
LatencyMS *float64
|
|
CPUPercent *float64
|
|
MemoryPercent *float64
|
|
DiskPercent *float64
|
|
Source string
|
|
CollectedAt time.Time
|
|
}
|
|
|
|
type ServerConfig struct {
|
|
ServerInstanceID string
|
|
ConfigVersion int
|
|
Format string
|
|
Key string
|
|
Content string
|
|
Source string
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type ConfigDiffLine struct {
|
|
Kind string
|
|
OldNumber int
|
|
NewNumber int
|
|
Content string
|
|
}
|
|
|
|
type ServerConfigDiffRequest struct {
|
|
ServerInstanceID string
|
|
ExpectedConfigVersion int
|
|
Key string
|
|
ProposedContent string
|
|
ProposedContentInputRef string
|
|
}
|
|
|
|
type ServerConfigDiffPreview struct {
|
|
ServerInstanceID string
|
|
ConfigVersion int
|
|
Key string
|
|
CurrentContent string
|
|
ProposedContent string
|
|
ProposedContentInputRef string
|
|
Diff []ConfigDiffLine
|
|
HasChanges bool
|
|
Source string
|
|
ReviewedAt time.Time
|
|
}
|
|
|
|
type ServerConfigWriteApproval struct {
|
|
ServerInstanceID string
|
|
ExpectedConfigVersion int
|
|
Key string
|
|
ProposedContent string
|
|
ProposedContentInputRef string
|
|
IdempotencyKey string
|
|
}
|
|
|
|
type ServerConfigWriteDispatch struct {
|
|
Preview ServerConfigDiffPreview
|
|
Job Job
|
|
Status string
|
|
}
|
|
|
|
type FileOperationKind string
|
|
|
|
const (
|
|
FileOperationRead FileOperationKind = "read"
|
|
FileOperationWrite FileOperationKind = "write"
|
|
)
|
|
|
|
type FileOperationDispatchRequest struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
Operation FileOperationKind
|
|
Key string
|
|
InputRef string
|
|
ExpectedConfigVersion int
|
|
IdempotencyKey string
|
|
}
|
|
|
|
type FileOperationDispatchResult struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
Operation FileOperationKind
|
|
Key string
|
|
InputRef string
|
|
Job Job
|
|
Status string
|
|
}
|
|
|
|
type RunCapacity struct {
|
|
MaxJobs int
|
|
RunningJobs int
|
|
QueuedJobs int
|
|
Summary string
|
|
}
|
|
|
|
const (
|
|
JobCapabilityConfigWrite = "config.write"
|
|
JobCapabilityFilesRead = "files.read"
|
|
JobCapabilityFilesWrite = "files.write"
|
|
)
|
|
|
|
type RunEndpoint struct {
|
|
ID string
|
|
DisplayName string
|
|
Version string
|
|
Status RunEndpointStatus
|
|
Capabilities []string
|
|
Capacity RunCapacity
|
|
LastHeartbeatAt time.Time
|
|
}
|
|
|
|
type JobProgress struct {
|
|
Percent int
|
|
Message string
|
|
}
|
|
|
|
type Job struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
RunEndpointID string
|
|
Capability string
|
|
TargetKey string
|
|
InputRef string
|
|
IdempotencyKey string
|
|
State JobState
|
|
Progress JobProgress
|
|
ResultRef string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type Artifact struct {
|
|
ID string
|
|
OwnerKind ArtifactOwnerKind
|
|
OwnerID string
|
|
SizeBytes int64
|
|
Checksum string
|
|
State ArtifactState
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type LogStream struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
Source LogStreamSource
|
|
StreamKey string
|
|
LatestSeq uint64
|
|
StorageBackend LogStorageBackend
|
|
RetentionPolicy string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type AuditEvent struct {
|
|
ID string
|
|
ActorID string
|
|
Action string
|
|
ResourceKind string
|
|
ResourceID string
|
|
Result AuditResult
|
|
Summary string
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type UserFilter struct {
|
|
Status UserStatus
|
|
}
|
|
|
|
type AIProviderFilter struct {
|
|
Kind AIProviderKind
|
|
Status AIProviderStatus
|
|
}
|
|
|
|
type GamePluginFilter struct {
|
|
ServerType string
|
|
Status GamePluginStatus
|
|
}
|
|
|
|
type PluginMarketplaceFilter struct {
|
|
ServerType string
|
|
Status GamePluginStatus
|
|
Capability string
|
|
Keyword string
|
|
}
|
|
|
|
type ServerInstanceFilter struct {
|
|
PluginID string
|
|
RunEndpointID string
|
|
State ServerInstanceState
|
|
VisibleToUserID string
|
|
}
|
|
|
|
type RunEndpointFilter struct {
|
|
Status RunEndpointStatus
|
|
}
|
|
|
|
type JobFilter struct {
|
|
ServerInstanceID string
|
|
RunEndpointID string
|
|
State JobState
|
|
}
|
|
|
|
type ArtifactFilter struct {
|
|
OwnerKind ArtifactOwnerKind
|
|
OwnerID string
|
|
State ArtifactState
|
|
}
|
|
|
|
type LogStreamFilter struct {
|
|
ServerInstanceID string
|
|
StreamKey string
|
|
}
|
|
|
|
type AuditEventFilter struct {
|
|
ActorID string
|
|
ResourceKind string
|
|
ResourceID string
|
|
Result AuditResult
|
|
}
|
|
|
|
func CopyStringSlice(values []string) []string {
|
|
if values == nil {
|
|
return nil
|
|
}
|
|
out := make([]string, len(values))
|
|
copy(out, values)
|
|
return out
|
|
}
|
|
|
|
func CopyStringMap(values map[string]string) map[string]string {
|
|
if values == nil {
|
|
return nil
|
|
}
|
|
out := make(map[string]string, len(values))
|
|
for key, value := range values {
|
|
out[key] = value
|
|
}
|
|
return out
|
|
}
|
|
|
|
func CopyUser(user User) User {
|
|
user.Roles = CopyStringSlice(user.Roles)
|
|
return user
|
|
}
|
|
|
|
func CopyAIProvider(provider AIProvider) AIProvider {
|
|
provider.Models = CopyStringSlice(provider.Models)
|
|
return provider
|
|
}
|
|
|
|
func CopyAIProviderTestResult(result AIProviderTestResult) AIProviderTestResult {
|
|
result.Violations = CopyStringSlice(result.Violations)
|
|
return result
|
|
}
|
|
|
|
func CopyAIProviderModels(models AIProviderModels) AIProviderModels {
|
|
models.Models = CopyStringSlice(models.Models)
|
|
return models
|
|
}
|
|
|
|
func CopyGamePlugin(plugin GamePlugin) GamePlugin {
|
|
plugin.RequiredRunCapabilities = CopyStringSlice(plugin.RequiredRunCapabilities)
|
|
plugin.DeclaredPermissions = CopyStringSlice(plugin.DeclaredPermissions)
|
|
plugin.SupportedOS = CopyStringSlice(plugin.SupportedOS)
|
|
plugin.BridgeActions = CopyStringSlice(plugin.BridgeActions)
|
|
plugin.Pages = CopyGamePluginPageSlice(plugin.Pages)
|
|
plugin.Tags = CopyStringSlice(plugin.Tags)
|
|
plugin.AIPurposes = CopyStringSlice(plugin.AIPurposes)
|
|
plugin.ValidationViolations = CopyStringSlice(plugin.ValidationViolations)
|
|
return plugin
|
|
}
|
|
|
|
func CopyPluginMarketplacePlugin(plugin PluginMarketplacePlugin) PluginMarketplacePlugin {
|
|
plugin.SupportedOS = CopyStringSlice(plugin.SupportedOS)
|
|
plugin.Capabilities = CopyStringSlice(plugin.Capabilities)
|
|
plugin.DeclaredPermissions = CopyStringSlice(plugin.DeclaredPermissions)
|
|
plugin.BridgeActions = CopyStringSlice(plugin.BridgeActions)
|
|
plugin.Pages = CopyGamePluginPageSlice(plugin.Pages)
|
|
plugin.Tags = CopyStringSlice(plugin.Tags)
|
|
plugin.AIPurposes = CopyStringSlice(plugin.AIPurposes)
|
|
plugin.ValidationViolations = CopyStringSlice(plugin.ValidationViolations)
|
|
return plugin
|
|
}
|
|
|
|
func CopyPluginMarketplacePluginSlice(plugins []PluginMarketplacePlugin) []PluginMarketplacePlugin {
|
|
if plugins == nil {
|
|
return nil
|
|
}
|
|
out := make([]PluginMarketplacePlugin, len(plugins))
|
|
for i, plugin := range plugins {
|
|
out[i] = CopyPluginMarketplacePlugin(plugin)
|
|
}
|
|
return out
|
|
}
|
|
|
|
func CopyGamePluginManifestRegistration(registration GamePluginManifestRegistration) GamePluginManifestRegistration {
|
|
registration.Manifest = CopyGamePluginManifest(registration.Manifest)
|
|
return registration
|
|
}
|
|
|
|
func CopyGamePluginManifest(manifest GamePluginManifest) GamePluginManifest {
|
|
manifest.Tags = CopyStringSlice(manifest.Tags)
|
|
manifest.Server.SupportedOS = CopyStringSlice(manifest.Server.SupportedOS)
|
|
manifest.Bridge.Actions = CopyStringSlice(manifest.Bridge.Actions)
|
|
manifest.Capabilities = CopyStringSlice(manifest.Capabilities)
|
|
manifest.Permissions = CopyStringSlice(manifest.Permissions)
|
|
manifest.Pages = CopyGamePluginPageSlice(manifest.Pages)
|
|
manifest.AI.Purposes = CopyStringSlice(manifest.AI.Purposes)
|
|
return manifest
|
|
}
|
|
|
|
func CopyGamePluginPageSlice(pages []GamePluginPage) []GamePluginPage {
|
|
if pages == nil {
|
|
return nil
|
|
}
|
|
out := make([]GamePluginPage, len(pages))
|
|
for i, page := range pages {
|
|
out[i] = page
|
|
out[i].Permissions = CopyStringSlice(page.Permissions)
|
|
out[i].BridgeActions = CopyStringSlice(page.BridgeActions)
|
|
}
|
|
return out
|
|
}
|
|
|
|
func CopyPluginBridgeAuthorization(result PluginBridgeAuthorization) PluginBridgeAuthorization {
|
|
result.RequiredPermissions = CopyStringSlice(result.RequiredPermissions)
|
|
result.EffectivePermissions = CopyStringSlice(result.EffectivePermissions)
|
|
return result
|
|
}
|
|
|
|
func CopyPluginBridgeExecuteRequest(request PluginBridgeExecuteRequest) PluginBridgeExecuteRequest {
|
|
request.Payload = CopyStringMap(request.Payload)
|
|
return request
|
|
}
|
|
|
|
func CopyPluginBridgeExecuteResponse(response PluginBridgeExecuteResponse) PluginBridgeExecuteResponse {
|
|
response.Result = CopyStringMap(response.Result)
|
|
if response.Error != nil {
|
|
errorCopy := *response.Error
|
|
errorCopy.Details = CopyStringSlice(errorCopy.Details)
|
|
response.Error = &errorCopy
|
|
}
|
|
return response
|
|
}
|
|
|
|
func CopyServerInstance(instance ServerInstance) ServerInstance {
|
|
instance.AdminUserIDs = CopyStringSlice(instance.AdminUserIDs)
|
|
return instance
|
|
}
|
|
|
|
func CopyPlatformResourceUsage(usage PlatformResourceUsage) PlatformResourceUsage {
|
|
return usage
|
|
}
|
|
|
|
func CopyServerMetrics(metrics ServerMetrics) ServerMetrics {
|
|
return metrics
|
|
}
|
|
|
|
func CopyServerMetricsSlice(items []ServerMetrics) []ServerMetrics {
|
|
if items == nil {
|
|
return nil
|
|
}
|
|
out := make([]ServerMetrics, len(items))
|
|
copy(out, items)
|
|
return out
|
|
}
|
|
|
|
func CopyServerConfig(config ServerConfig) ServerConfig {
|
|
return config
|
|
}
|
|
|
|
func CopyConfigDiffLines(lines []ConfigDiffLine) []ConfigDiffLine {
|
|
if lines == nil {
|
|
return nil
|
|
}
|
|
out := make([]ConfigDiffLine, len(lines))
|
|
copy(out, lines)
|
|
return out
|
|
}
|
|
|
|
func CopyServerConfigDiffPreview(preview ServerConfigDiffPreview) ServerConfigDiffPreview {
|
|
preview.Diff = CopyConfigDiffLines(preview.Diff)
|
|
return preview
|
|
}
|
|
|
|
func CopyServerConfigWriteDispatch(dispatch ServerConfigWriteDispatch) ServerConfigWriteDispatch {
|
|
dispatch.Preview = CopyServerConfigDiffPreview(dispatch.Preview)
|
|
dispatch.Job = CopyJob(dispatch.Job)
|
|
return dispatch
|
|
}
|
|
|
|
func CopyFileOperationDispatchResult(result FileOperationDispatchResult) FileOperationDispatchResult {
|
|
result.Job = CopyJob(result.Job)
|
|
return result
|
|
}
|
|
|
|
func CopyRunEndpoint(endpoint RunEndpoint) RunEndpoint {
|
|
endpoint.Capabilities = CopyStringSlice(endpoint.Capabilities)
|
|
return endpoint
|
|
}
|
|
|
|
func CopyJob(job Job) Job {
|
|
return job
|
|
}
|
|
|
|
func CopyArtifact(artifact Artifact) Artifact {
|
|
return artifact
|
|
}
|
|
|
|
func CopyLogStream(stream LogStream) LogStream {
|
|
return stream
|
|
}
|
|
|
|
func CopyAuditEvent(event AuditEvent) AuditEvent {
|
|
return event
|
|
}
|