149 lines
5.9 KiB
Go
149 lines
5.9 KiB
Go
package protocol
|
|
|
|
import "time"
|
|
|
|
const (
|
|
RunCapabilityProcessInstall = "process.install"
|
|
RunCapabilityProcessStart = "process.start"
|
|
RunCapabilityProcessStop = "process.stop"
|
|
RunCapabilityLogsRead = "logs.read"
|
|
RunCapabilityConfigWrite = "config.write"
|
|
RunCapabilityFilesRead = "files.read"
|
|
RunCapabilityFilesWrite = "files.write"
|
|
RunCapabilityRemoteFTPRead = "remote.ftp.read"
|
|
RunCapabilityRemoteFTPWrite = "remote.ftp.write"
|
|
RunCapabilityRemoteRsyncRead = "remote.rsync.read"
|
|
RunCapabilityRemoteRsyncWrite = "remote.rsync.write"
|
|
RunCapabilityRemoteRunFilesRead = "remote.run.files.read"
|
|
RunCapabilityRemoteRunFilesWrite = "remote.run.files.write"
|
|
RunCapabilityRemoteRunProcessStart = "remote.run.process.start"
|
|
RunCapabilityRemoteRunProcessStop = "remote.run.process.stop"
|
|
RunCapabilityRemoteRunDBMySQLQuery = "remote.run.db.mysql.query"
|
|
RunCapabilityRemoteRunDBSQLiteQuery = "remote.run.db.sqlite.query"
|
|
RunCapabilityRemoteRunLogsTransfer = "remote.run.logs.transfer"
|
|
RunCapabilityRemoteRunRCONCommand = "remote.run.rcon.command"
|
|
RunCapabilityRunSelfUpdate = "run.self-update"
|
|
RunCapabilityDependenciesCheck = "dependencies.check"
|
|
RunCapabilityDependenciesInstall = "dependencies.install"
|
|
RunCapabilityLogsBackfill = "logs.backfill"
|
|
)
|
|
|
|
type RunJobProgressReport struct {
|
|
Percent int `json:"percent"`
|
|
Message string `json:"message,omitempty"`
|
|
}
|
|
|
|
type RunJobAssignment struct {
|
|
JobID string `json:"jobId"`
|
|
ServerInstanceID string `json:"serverInstanceId,omitempty"`
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
Capability string `json:"capability"`
|
|
TargetKey string `json:"targetKey,omitempty"`
|
|
InputRef string `json:"inputRef,omitempty"`
|
|
IdempotencyKey string `json:"idempotencyKey"`
|
|
State string `json:"state"`
|
|
Progress RunJobProgressReport `json:"progress"`
|
|
ResultRef string `json:"resultRef,omitempty"`
|
|
LeaseToken string `json:"leaseToken"`
|
|
Attempt int `json:"attempt"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
type RunJobClaimRequest struct {
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
SessionToken string `json:"sessionToken"`
|
|
Capabilities []string `json:"capabilities"`
|
|
Capacity RunCapacityReport `json:"capacity"`
|
|
}
|
|
|
|
type RunJobClaimResponse struct {
|
|
Accepted bool `json:"accepted"`
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
HasJob bool `json:"hasJob"`
|
|
Job *RunJobAssignment `json:"job,omitempty"`
|
|
NextPollSeconds int `json:"nextPollSeconds"`
|
|
ServerTime time.Time `json:"serverTime"`
|
|
}
|
|
|
|
type RunJobAckRequest struct {
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
SessionToken string `json:"sessionToken"`
|
|
JobID string `json:"jobId"`
|
|
LeaseToken string `json:"leaseToken"`
|
|
Attempt int `json:"attempt"`
|
|
Message string `json:"message,omitempty"`
|
|
}
|
|
|
|
type RunJobAckResponse struct {
|
|
Accepted bool `json:"accepted"`
|
|
Job RunJobAssignment `json:"job"`
|
|
ServerTime time.Time `json:"serverTime"`
|
|
}
|
|
|
|
type RunJobProgressRequest struct {
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
SessionToken string `json:"sessionToken"`
|
|
JobID string `json:"jobId"`
|
|
LeaseToken string `json:"leaseToken"`
|
|
Attempt int `json:"attempt"`
|
|
Progress RunJobProgressReport `json:"progress"`
|
|
Sequence uint64 `json:"sequence,omitempty"`
|
|
}
|
|
|
|
type RunJobProgressResponse struct {
|
|
Accepted bool `json:"accepted"`
|
|
Job RunJobAssignment `json:"job"`
|
|
ServerTime time.Time `json:"serverTime"`
|
|
}
|
|
|
|
type RunJobResultRequest struct {
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
SessionToken string `json:"sessionToken"`
|
|
JobID string `json:"jobId"`
|
|
LeaseToken string `json:"leaseToken"`
|
|
Attempt int `json:"attempt"`
|
|
State string `json:"state"`
|
|
Progress RunJobProgressReport `json:"progress"`
|
|
ResultRef string `json:"resultRef,omitempty"`
|
|
Message string `json:"message,omitempty"`
|
|
ErrorCode string `json:"errorCode,omitempty"`
|
|
}
|
|
|
|
type RunJobResultResponse struct {
|
|
Accepted bool `json:"accepted"`
|
|
Job RunJobAssignment `json:"job"`
|
|
ServerTime time.Time `json:"serverTime"`
|
|
}
|
|
|
|
type RunJobCancelPollRequest struct {
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
SessionToken string `json:"sessionToken"`
|
|
JobID string `json:"jobId,omitempty"`
|
|
LeaseToken string `json:"leaseToken,omitempty"`
|
|
}
|
|
|
|
type RunJobCancelPollResponse struct {
|
|
Accepted bool `json:"accepted"`
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
HasCancel bool `json:"hasCancel"`
|
|
JobID string `json:"jobId,omitempty"`
|
|
Reason string `json:"reason,omitempty"`
|
|
RequestedAt time.Time `json:"requestedAt,omitempty"`
|
|
ServerTime time.Time `json:"serverTime"`
|
|
}
|
|
|
|
type RunJobReconcileRequest struct {
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
SessionToken string `json:"sessionToken"`
|
|
ActiveJobIDs []string `json:"activeJobIds"`
|
|
}
|
|
|
|
type RunJobReconcileResponse struct {
|
|
Accepted bool `json:"accepted"`
|
|
RunEndpointID string `json:"runEndpointId"`
|
|
ActiveJobs []RunJobAssignment `json:"activeJobs"`
|
|
UnknownJobIDs []string `json:"unknownJobIds"`
|
|
ServerTime time.Time `json:"serverTime"`
|
|
}
|