143 lines
3.8 KiB
Go
143 lines
3.8 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type RunCapabilityReport struct {
|
|
Capabilities []string
|
|
Fingerprint string
|
|
}
|
|
|
|
type RunControlHello struct {
|
|
RegistrationToken string
|
|
RunEndpointID string
|
|
ServerInstanceID string
|
|
PluginID string
|
|
ComponentKind DistributionComponentKind
|
|
ComponentKey string
|
|
KeyGeneration int
|
|
DisplayName string
|
|
Version string
|
|
Status RunEndpointStatus
|
|
Platform string
|
|
Architecture string
|
|
UpdateJobID string
|
|
UpdateOutcome string
|
|
CapabilityReport RunCapabilityReport
|
|
Capacity RunCapacity
|
|
}
|
|
|
|
type RunControlHelloResult struct {
|
|
Accepted bool
|
|
RunEndpointID string
|
|
SessionToken string
|
|
ServerTime time.Time
|
|
HeartbeatIntervalSeconds int
|
|
SessionExpiresAt time.Time
|
|
FeatureFlags []string
|
|
}
|
|
|
|
type RunControlHeartbeat struct {
|
|
RunEndpointID string
|
|
SessionToken string
|
|
Version string
|
|
Status RunEndpointStatus
|
|
CapabilityFingerprint string
|
|
Capacity RunCapacity
|
|
}
|
|
|
|
type RunControlHeartbeatResult struct {
|
|
Accepted bool
|
|
RunEndpointID string
|
|
NextHeartbeatSeconds int
|
|
RefreshCapabilities bool
|
|
ServerTime time.Time
|
|
}
|
|
|
|
type RunLifecycleReport struct {
|
|
RunEndpointID string
|
|
SessionToken string
|
|
ServerInstanceID string
|
|
Capability string
|
|
State JobState
|
|
Progress RunJobProgressReport
|
|
Message string
|
|
ErrorCode string
|
|
ManagedProcessID string
|
|
ObservationSeq uint64
|
|
ObservedAt time.Time
|
|
ExecutionResult JobExecutionResult
|
|
}
|
|
|
|
type RunLifecycleReportResult struct {
|
|
Accepted bool
|
|
RunEndpointID string
|
|
ServerInstanceID string
|
|
ProjectedState ServerInstanceState
|
|
ServerTime time.Time
|
|
}
|
|
|
|
type RunControlSession struct {
|
|
RunEndpointID string
|
|
SessionToken string `json:"-"`
|
|
SessionTokenHash string
|
|
Status AuthSessionStatus
|
|
Generation int
|
|
CapabilityFingerprint string
|
|
HeartbeatIntervalSeconds int
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
ExpiresAt time.Time
|
|
RevokedAt time.Time
|
|
RequireSignedRequests bool
|
|
UsedNonces []string
|
|
}
|
|
|
|
type RunRequestSignature struct {
|
|
RunEndpointID string
|
|
SessionToken string
|
|
Method string
|
|
Path string
|
|
Timestamp string
|
|
Nonce string
|
|
BodyHash string
|
|
Signature string
|
|
}
|
|
|
|
func CopyRunCapabilityReport(report RunCapabilityReport) RunCapabilityReport {
|
|
report.Capabilities = CopyStringSlice(report.Capabilities)
|
|
return report
|
|
}
|
|
|
|
func CopyRunControlHello(hello RunControlHello) RunControlHello {
|
|
hello.CapabilityReport = CopyRunCapabilityReport(hello.CapabilityReport)
|
|
return hello
|
|
}
|
|
|
|
func CopyRunControlHelloResult(result RunControlHelloResult) RunControlHelloResult {
|
|
result.FeatureFlags = CopyStringSlice(result.FeatureFlags)
|
|
return result
|
|
}
|
|
|
|
func CopyRunControlHeartbeat(heartbeat RunControlHeartbeat) RunControlHeartbeat {
|
|
return heartbeat
|
|
}
|
|
|
|
func CopyRunControlHeartbeatResult(result RunControlHeartbeatResult) RunControlHeartbeatResult {
|
|
return result
|
|
}
|
|
|
|
func CopyRunLifecycleReport(report RunLifecycleReport) RunLifecycleReport {
|
|
report.ExecutionResult.ServerDeploymentEvidence = CopyServerDeploymentEvidence(report.ExecutionResult.ServerDeploymentEvidence)
|
|
report.ExecutionResult.DeploymentReceipt = CopyServerDeploymentExecutionReceipt(report.ExecutionResult.DeploymentReceipt)
|
|
return report
|
|
}
|
|
|
|
func CopyRunLifecycleReportResult(result RunLifecycleReportResult) RunLifecycleReportResult {
|
|
return result
|
|
}
|
|
|
|
func CopyRunControlSession(session RunControlSession) RunControlSession {
|
|
session.UsedNonces = CopyStringSlice(session.UsedNonces)
|
|
return session
|
|
}
|