Complete platform management workflows
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"browser.local/run/protocol"
|
||||
)
|
||||
|
||||
func ExecuteRemoteAccessJob(ctx context.Context, assignment protocol.RunJobAssignment) LifecycleExecutionResult {
|
||||
if err := protocol.ValidateRunJobAssignment(assignment); err != nil {
|
||||
return lifecycleFailure("unsafe_remote_access_job", err.Error())
|
||||
}
|
||||
if !isSupportedRemoteCapability(assignment.Capability) {
|
||||
return lifecycleFailure("unsupported_remote_access_capability", "unsupported remote access capability")
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return LifecycleExecutionResult{
|
||||
State: lifecycleResultStateCancelled,
|
||||
Progress: protocol.RunJobProgressReport{Percent: 100, Message: "remote access action cancelled"},
|
||||
Message: "remote access action cancelled",
|
||||
ErrorCode: "remote_access_cancelled",
|
||||
}
|
||||
default:
|
||||
}
|
||||
return LifecycleExecutionResult{
|
||||
State: lifecycleResultStateSucceeded,
|
||||
Progress: protocol.RunJobProgressReport{Percent: 100, Message: "remote access job accepted"},
|
||||
ResultRef: fmt.Sprintf("artifact://jobs/%s/remote-access-result", url.PathEscape(assignment.JobID)),
|
||||
Message: fmt.Sprintf("%s completed through bounded remote access envelope", assignment.Capability),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user