552 lines
17 KiB
Go
552 lines
17 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type GameClientBridgeCommandState string
|
|
|
|
const (
|
|
GameClientBridgeCommandPending GameClientBridgeCommandState = "pending"
|
|
GameClientBridgeCommandClaimed GameClientBridgeCommandState = "claimed"
|
|
GameClientBridgeCommandSucceeded GameClientBridgeCommandState = "succeeded"
|
|
GameClientBridgeCommandFailed GameClientBridgeCommandState = "failed"
|
|
GameClientBridgeCommandUnknown GameClientBridgeCommandState = "unknown"
|
|
GameClientBridgeCommandCancelled GameClientBridgeCommandState = "cancelled"
|
|
GameClientBridgeCommandExpired GameClientBridgeCommandState = "expired"
|
|
)
|
|
|
|
type GameClientBridgeApprovalState string
|
|
|
|
const (
|
|
GameClientBridgeApprovalNotRequired GameClientBridgeApprovalState = "not_required"
|
|
GameClientBridgeApprovalPending GameClientBridgeApprovalState = "pending"
|
|
GameClientBridgeApprovalApproved GameClientBridgeApprovalState = "approved"
|
|
GameClientBridgeApprovalRejected GameClientBridgeApprovalState = "rejected"
|
|
)
|
|
|
|
type GameClientBridgeApprovalLevel string
|
|
|
|
const (
|
|
GameClientBridgeApprovalLevelNone GameClientBridgeApprovalLevel = "none"
|
|
GameClientBridgeApprovalLevelOperator GameClientBridgeApprovalLevel = "operator"
|
|
GameClientBridgeApprovalLevelPlatformAdmin GameClientBridgeApprovalLevel = "platform-admin"
|
|
)
|
|
|
|
type GameClientBridgeCommandDeclaration struct {
|
|
Type string
|
|
Title string
|
|
Permission string
|
|
ApprovalLevel GameClientBridgeApprovalLevel
|
|
PayloadSchemaRef string
|
|
ResultSchemaRef string
|
|
TimeoutSeconds int
|
|
MaxPayloadBytes int
|
|
}
|
|
|
|
type GameClientBridgeSnapshotDeclaration struct {
|
|
Type string
|
|
SchemaVersion string
|
|
SchemaRef string
|
|
Retention GameClientBridgeRetention
|
|
}
|
|
|
|
type GameClientBridgeQueryTemplateDeclaration struct {
|
|
Key string
|
|
Title string
|
|
Permission string
|
|
Engine string
|
|
TransportKey string
|
|
TargetKey string
|
|
ParameterSchemaRef string
|
|
ResultSchemaRef string
|
|
SQLRef string
|
|
MaxRows int
|
|
TimeoutSeconds int
|
|
PollIntervalSeconds int
|
|
RowTarget *PluginDataRowTargetDeclaration
|
|
}
|
|
|
|
const (
|
|
PluginDataRowWriteModeMerge = "merge"
|
|
PluginDataRowWriteModeReplace = "replace"
|
|
)
|
|
|
|
type PluginDataRowTargetDeclaration struct {
|
|
Collection string
|
|
UpsertKeys []string
|
|
ColumnMappings map[string]string
|
|
WriteMode string
|
|
}
|
|
|
|
type GameClientBridgeLogProjectionStepDeclaration struct {
|
|
Pattern string
|
|
}
|
|
|
|
type GameClientBridgeLogProjectionTargetDeclaration struct {
|
|
Collection string
|
|
UpsertKeys []string
|
|
CaptureMappings map[string]string
|
|
FixedValues map[string]string
|
|
ObservedAtField string
|
|
}
|
|
|
|
type GameClientBridgeLogProjectionPresenceDeclaration struct {
|
|
TimestampField string
|
|
ActiveWindowSeconds int
|
|
ActivityTarget *GameClientBridgeLogProjectionTargetDeclaration
|
|
}
|
|
|
|
type GameClientBridgeLogProjectionDeclaration struct {
|
|
Key string
|
|
StreamKeys []string
|
|
Steps []GameClientBridgeLogProjectionStepDeclaration
|
|
CorrelationFields []string
|
|
MaxInterveningLines int
|
|
Target GameClientBridgeLogProjectionTargetDeclaration
|
|
Presence *GameClientBridgeLogProjectionPresenceDeclaration
|
|
}
|
|
|
|
type GameClientBridgeDataPackDeclaration struct {
|
|
Key string
|
|
DatabaseUserVersion int
|
|
LogParserRefs []string
|
|
ConfigMapRefs []string
|
|
DataRefs []string
|
|
}
|
|
|
|
type GameClientBridgeOperationKind string
|
|
|
|
const (
|
|
GameClientBridgeOperationKindRCON GameClientBridgeOperationKind = "rcon"
|
|
GameClientBridgeOperationKindSQLiteMutation GameClientBridgeOperationKind = "sqlite-mutation"
|
|
)
|
|
|
|
type GameClientBridgeOperationTemplateDeclaration struct {
|
|
Key string
|
|
Title string
|
|
Permission string
|
|
ApprovalLevel GameClientBridgeApprovalLevel
|
|
Kind GameClientBridgeOperationKind
|
|
TransportKey string
|
|
TargetKey string
|
|
PayloadSchemaRef string
|
|
ResultSchemaRef string
|
|
ConfirmationSchemaRef string
|
|
TimeoutSeconds int
|
|
MaxPayloadBytes int
|
|
MaxRowsAffected int
|
|
Mutation GameClientBridgeOperationMutationDeclaration
|
|
Safety GameClientBridgeOperationSafety
|
|
}
|
|
|
|
type GameClientBridgeOperationMutationDeclaration struct {
|
|
FieldKey string
|
|
TableKey string
|
|
IdentityKey string
|
|
ValueKey string
|
|
ConfirmationQueryKey string
|
|
AllowedValueType string
|
|
MinValue float64
|
|
MaxValue float64
|
|
}
|
|
|
|
type GameClientBridgeOperationSafety struct {
|
|
RequiresApproval bool
|
|
RequiresOfflinePlayer bool
|
|
RequiresMaintenanceWindow bool
|
|
RequiresBeforeValue bool
|
|
RequiresConfirmation bool
|
|
BackupRequired bool
|
|
}
|
|
|
|
type GameClientBridgePageContract struct {
|
|
PageKey string
|
|
CommandTypes []string
|
|
SnapshotTypes []string
|
|
QueryTemplateKeys []string
|
|
OperationKeys []string
|
|
FeatureKeys []string
|
|
}
|
|
|
|
type GameClientBridgeFeatureDeclaration struct {
|
|
Key string
|
|
Title string
|
|
Permission string
|
|
RequiredHandlers []string
|
|
RequiredEventProducers []string
|
|
}
|
|
|
|
type GameClientBridgeCompanionDeclaration struct {
|
|
ProfileKey string
|
|
ConfigTemplateKey string
|
|
ConfigSchemaRef string
|
|
ConfigFormat string
|
|
PlatformBaseURLSource string
|
|
RegistrationProof string
|
|
ProofMaterialSource string
|
|
ProofMaterialEnv string
|
|
SessionMode string
|
|
TLSPolicy string
|
|
HeartbeatIntervalSeconds int
|
|
CommandPollIntervalSeconds int
|
|
RequestTimeoutSeconds int
|
|
}
|
|
|
|
type GameClientBridgeManifest struct {
|
|
Commands []GameClientBridgeCommandDeclaration
|
|
Snapshots []GameClientBridgeSnapshotDeclaration
|
|
QueryTemplates []GameClientBridgeQueryTemplateDeclaration
|
|
LogProjections []GameClientBridgeLogProjectionDeclaration
|
|
DataPacks []GameClientBridgeDataPackDeclaration
|
|
OperationTemplates []GameClientBridgeOperationTemplateDeclaration
|
|
Retention GameClientBridgeRetention
|
|
Pages []GameClientBridgePageContract
|
|
Features []GameClientBridgeFeatureDeclaration
|
|
Companion GameClientBridgeCompanionDeclaration
|
|
}
|
|
|
|
type GameClientBridgeResultStatus string
|
|
|
|
const (
|
|
GameClientBridgeResultSucceeded GameClientBridgeResultStatus = "succeeded"
|
|
GameClientBridgeResultFailed GameClientBridgeResultStatus = "failed"
|
|
GameClientBridgeResultUnknown GameClientBridgeResultStatus = "unknown"
|
|
GameClientBridgeResultCancelled GameClientBridgeResultStatus = "cancelled"
|
|
)
|
|
|
|
type GameClientBridgeCommand struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
CommandType string
|
|
Payload map[string]any
|
|
RunJobID string
|
|
IdempotencyKey string
|
|
Priority int
|
|
State GameClientBridgeCommandState
|
|
ApprovalState GameClientBridgeApprovalState
|
|
RequesterID string
|
|
Claim GameClientBridgeClaim
|
|
Cancellation GameClientBridgeCancellation
|
|
Result GameClientBridgeResult
|
|
ExpiresAt time.Time
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
CompletedAt time.Time
|
|
}
|
|
|
|
type GameClientBridgeClaim struct {
|
|
SessionID string
|
|
InstallationID string
|
|
DeploymentGeneration int
|
|
FencingToken uint64
|
|
LeaseExpiresAt time.Time
|
|
ClaimedAt time.Time
|
|
AcknowledgedAt time.Time
|
|
}
|
|
|
|
type GameClientBridgeCancellation struct {
|
|
RequestedBy string
|
|
Reason string
|
|
CancelledAt time.Time
|
|
}
|
|
|
|
type GameClientBridgeResult struct {
|
|
Status GameClientBridgeResultStatus
|
|
Summary string
|
|
Payload map[string]any
|
|
CompletedBy string
|
|
CompletedAt time.Time
|
|
}
|
|
|
|
type GameClientBridgeSnapshot struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
Type string
|
|
SchemaVersion string
|
|
StreamKey string
|
|
Sequence uint64
|
|
SourceSessionID string
|
|
ObservedAt time.Time
|
|
Payload map[string]any
|
|
Retention GameClientBridgeRetention
|
|
CreatedAt time.Time
|
|
ExpiresAt time.Time
|
|
}
|
|
|
|
type GameClientBridgeSnapshotStream struct {
|
|
ID string
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
Type string
|
|
StreamKey string
|
|
LatestSequence uint64
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type GameClientBridgeRetention struct {
|
|
KeepForSeconds int
|
|
MaxRecords int
|
|
}
|
|
|
|
type GameClientBridgeCommandFilter struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
State GameClientBridgeCommandState
|
|
RequesterID string
|
|
CommandType string
|
|
IdempotencyKey string
|
|
ExpiresBefore time.Time
|
|
CompletedBefore time.Time
|
|
}
|
|
|
|
type GameClientBridgeSnapshotStreamFilter struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
Type string
|
|
StreamKey string
|
|
}
|
|
|
|
type GameClientBridgeSnapshotFilter struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
Type string
|
|
StreamKey string
|
|
ObservedAfter time.Time
|
|
ExpiresBefore time.Time
|
|
Limit int
|
|
}
|
|
|
|
type GameClientBridgeQueueRequest struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
CommandType string
|
|
Payload map[string]any
|
|
IdempotencyKey string
|
|
Priority int
|
|
ExpiresAt time.Time
|
|
}
|
|
|
|
type GameClientBridgeClaimRequest struct {
|
|
SessionToken string
|
|
Limit int
|
|
}
|
|
|
|
type GameClientBridgeAckRequest struct {
|
|
SessionToken string
|
|
CommandID string
|
|
FencingToken uint64
|
|
}
|
|
|
|
type GameClientBridgeResultRequest struct {
|
|
SessionToken string
|
|
CommandID string
|
|
FencingToken uint64
|
|
Status GameClientBridgeResultStatus
|
|
Summary string
|
|
Payload map[string]any
|
|
}
|
|
|
|
type GameClientBridgeCancelRequest struct {
|
|
CommandID string
|
|
Reason string
|
|
}
|
|
|
|
type GameClientBridgeSnapshotIngestRequest struct {
|
|
SessionToken string
|
|
Type string
|
|
SchemaVersion string
|
|
StreamKey string
|
|
Sequence uint64
|
|
ObservedAt time.Time
|
|
Payload map[string]any
|
|
Retention GameClientBridgeRetention
|
|
}
|
|
|
|
type GameClientBridgeSnapshotQuery struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ProfileKey string
|
|
Type string
|
|
StreamKey string
|
|
ObservedAfter time.Time
|
|
Limit int
|
|
}
|
|
|
|
type GameClientBridgeProfileDeclaration struct {
|
|
PluginID string
|
|
ProfileKey string
|
|
Available bool
|
|
Reason string
|
|
CommandTypes []string
|
|
SnapshotTypes []string
|
|
QueryTemplateKeys []string
|
|
HandlerTypes []string
|
|
EventProducerTypes []string
|
|
}
|
|
|
|
type GameClientBridgeFeatureAvailability struct {
|
|
Key string
|
|
Available bool
|
|
Reason string
|
|
}
|
|
|
|
type GameClientBridgeStatus struct {
|
|
ServerInstanceID string
|
|
PluginID string
|
|
Available bool
|
|
Reason string
|
|
Profiles []GameClientBridgeProfileDeclaration
|
|
Features []GameClientBridgeFeatureAvailability
|
|
}
|
|
|
|
func CopyGameClientBridgeProfileDeclaration(value GameClientBridgeProfileDeclaration) GameClientBridgeProfileDeclaration {
|
|
value.CommandTypes = CopyStringSlice(value.CommandTypes)
|
|
value.SnapshotTypes = CopyStringSlice(value.SnapshotTypes)
|
|
value.QueryTemplateKeys = CopyStringSlice(value.QueryTemplateKeys)
|
|
value.HandlerTypes = CopyStringSlice(value.HandlerTypes)
|
|
value.EventProducerTypes = CopyStringSlice(value.EventProducerTypes)
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeStatus(value GameClientBridgeStatus) GameClientBridgeStatus {
|
|
value.Profiles = append([]GameClientBridgeProfileDeclaration(nil), value.Profiles...)
|
|
for index := range value.Profiles {
|
|
value.Profiles[index] = CopyGameClientBridgeProfileDeclaration(value.Profiles[index])
|
|
}
|
|
value.Features = append([]GameClientBridgeFeatureAvailability(nil), value.Features...)
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeCommand(value GameClientBridgeCommand) GameClientBridgeCommand {
|
|
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
|
value.Claim = CopyGameClientBridgeClaim(value.Claim)
|
|
value.Cancellation = CopyGameClientBridgeCancellation(value.Cancellation)
|
|
value.Result = CopyGameClientBridgeResult(value.Result)
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeClaim(value GameClientBridgeClaim) GameClientBridgeClaim { return value }
|
|
|
|
func CopyGameClientBridgeCancellation(value GameClientBridgeCancellation) GameClientBridgeCancellation {
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeResult(value GameClientBridgeResult) GameClientBridgeResult {
|
|
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeSnapshot(value GameClientBridgeSnapshot) GameClientBridgeSnapshot {
|
|
value.Payload = CopyGameClientBridgePayload(value.Payload)
|
|
value.Retention = CopyGameClientBridgeRetention(value.Retention)
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeSnapshotStream(value GameClientBridgeSnapshotStream) GameClientBridgeSnapshotStream {
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeRetention(value GameClientBridgeRetention) GameClientBridgeRetention {
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgePayload(value map[string]any) map[string]any {
|
|
if value == nil {
|
|
return nil
|
|
}
|
|
copy := make(map[string]any, len(value))
|
|
for key, item := range value {
|
|
copy[key] = copyGameClientBridgePayloadValue(item)
|
|
}
|
|
return copy
|
|
}
|
|
|
|
func CopyGameClientBridgeManifest(value GameClientBridgeManifest) GameClientBridgeManifest {
|
|
value.Commands = append([]GameClientBridgeCommandDeclaration(nil), value.Commands...)
|
|
value.Snapshots = append([]GameClientBridgeSnapshotDeclaration(nil), value.Snapshots...)
|
|
value.QueryTemplates = append([]GameClientBridgeQueryTemplateDeclaration(nil), value.QueryTemplates...)
|
|
for index := range value.QueryTemplates {
|
|
if value.QueryTemplates[index].RowTarget != nil {
|
|
copy := CopyPluginDataRowTargetDeclaration(*value.QueryTemplates[index].RowTarget)
|
|
value.QueryTemplates[index].RowTarget = ©
|
|
}
|
|
}
|
|
value.LogProjections = append([]GameClientBridgeLogProjectionDeclaration(nil), value.LogProjections...)
|
|
for index := range value.LogProjections {
|
|
value.LogProjections[index] = CopyGameClientBridgeLogProjectionDeclaration(value.LogProjections[index])
|
|
}
|
|
value.DataPacks = append([]GameClientBridgeDataPackDeclaration(nil), value.DataPacks...)
|
|
for index := range value.DataPacks {
|
|
value.DataPacks[index].LogParserRefs = CopyStringSlice(value.DataPacks[index].LogParserRefs)
|
|
value.DataPacks[index].ConfigMapRefs = CopyStringSlice(value.DataPacks[index].ConfigMapRefs)
|
|
value.DataPacks[index].DataRefs = CopyStringSlice(value.DataPacks[index].DataRefs)
|
|
}
|
|
value.OperationTemplates = append([]GameClientBridgeOperationTemplateDeclaration(nil), value.OperationTemplates...)
|
|
value.Pages = append([]GameClientBridgePageContract(nil), value.Pages...)
|
|
value.Features = append([]GameClientBridgeFeatureDeclaration(nil), value.Features...)
|
|
for index := range value.Pages {
|
|
value.Pages[index].CommandTypes = CopyStringSlice(value.Pages[index].CommandTypes)
|
|
value.Pages[index].SnapshotTypes = CopyStringSlice(value.Pages[index].SnapshotTypes)
|
|
value.Pages[index].QueryTemplateKeys = CopyStringSlice(value.Pages[index].QueryTemplateKeys)
|
|
value.Pages[index].OperationKeys = CopyStringSlice(value.Pages[index].OperationKeys)
|
|
value.Pages[index].FeatureKeys = CopyStringSlice(value.Pages[index].FeatureKeys)
|
|
}
|
|
for index := range value.Features {
|
|
value.Features[index].RequiredHandlers = CopyStringSlice(value.Features[index].RequiredHandlers)
|
|
value.Features[index].RequiredEventProducers = CopyStringSlice(value.Features[index].RequiredEventProducers)
|
|
}
|
|
return value
|
|
}
|
|
|
|
func CopyPluginDataRowTargetDeclaration(value PluginDataRowTargetDeclaration) PluginDataRowTargetDeclaration {
|
|
value.UpsertKeys = CopyStringSlice(value.UpsertKeys)
|
|
value.ColumnMappings = CopyStringMap(value.ColumnMappings)
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeLogProjectionDeclaration(value GameClientBridgeLogProjectionDeclaration) GameClientBridgeLogProjectionDeclaration {
|
|
value.StreamKeys = CopyStringSlice(value.StreamKeys)
|
|
value.Steps = append([]GameClientBridgeLogProjectionStepDeclaration(nil), value.Steps...)
|
|
value.CorrelationFields = CopyStringSlice(value.CorrelationFields)
|
|
value.Target = CopyGameClientBridgeLogProjectionTargetDeclaration(value.Target)
|
|
if value.Presence != nil {
|
|
presence := *value.Presence
|
|
if presence.ActivityTarget != nil {
|
|
activityTarget := CopyGameClientBridgeLogProjectionTargetDeclaration(*presence.ActivityTarget)
|
|
presence.ActivityTarget = &activityTarget
|
|
}
|
|
value.Presence = &presence
|
|
}
|
|
return value
|
|
}
|
|
|
|
func CopyGameClientBridgeLogProjectionTargetDeclaration(value GameClientBridgeLogProjectionTargetDeclaration) GameClientBridgeLogProjectionTargetDeclaration {
|
|
value.UpsertKeys = CopyStringSlice(value.UpsertKeys)
|
|
value.CaptureMappings = CopyStringMap(value.CaptureMappings)
|
|
value.FixedValues = CopyStringMap(value.FixedValues)
|
|
return value
|
|
}
|
|
|
|
func copyGameClientBridgePayloadValue(value any) any {
|
|
switch typed := value.(type) {
|
|
case map[string]any:
|
|
return CopyGameClientBridgePayload(typed)
|
|
case []any:
|
|
copy := make([]any, len(typed))
|
|
for index, item := range typed {
|
|
copy[index] = copyGameClientBridgePayloadValue(item)
|
|
}
|
|
return copy
|
|
default:
|
|
return typed
|
|
}
|
|
}
|