add shared workspace logic
This commit is contained in:
parent
62e245753b
commit
eea7f25379
@ -5,6 +5,7 @@ import (
|
||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||
"cloud.o-forge.io/core/oc-lib/logs"
|
||||
"cloud.o-forge.io/core/oc-lib/models"
|
||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/data"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
||||
@ -15,6 +16,8 @@ import (
|
||||
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||
shared_workspace "cloud.o-forge.io/core/oc-lib/models/workspace/shared"
|
||||
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/rules/rule"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
@ -32,6 +35,9 @@ const (
|
||||
WORKFLOW = utils.WORKFLOW
|
||||
WORKSPACE = utils.WORKSPACE
|
||||
WORKFLOW_EXECUTION = utils.WORKFLOW_EXECUTION
|
||||
PEER = utils.PEER
|
||||
SHARED_WORKSPACE = utils.SHARED_WORKSPACE
|
||||
RULE = utils.RULE
|
||||
)
|
||||
|
||||
func (d LibDataEnum) String() string {
|
||||
@ -181,6 +187,12 @@ func (l *LibData) ToWorkflowResource() *w.WorkflowResource {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (l *LibData) ToPeer() *peer.Peer {
|
||||
if l.Data.GetAccessor().GetType() == utils.PEER.String() {
|
||||
return l.Data.(*peer.Peer)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToWorkflow() *w2.Workflow {
|
||||
if l.Data.GetAccessor().GetType() == utils.WORKFLOW.String() {
|
||||
@ -194,6 +206,21 @@ func (l *LibData) ToWorkspace() *workspace.Workspace {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToSharedWorkspace() *shared_workspace.SharedWorkspace {
|
||||
if l.Data.GetAccessor().GetType() == utils.SHARED_WORKSPACE.String() {
|
||||
return l.Data.(*shared_workspace.SharedWorkspace)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToRule() *rule.Rule {
|
||||
if l.Data.GetAccessor().GetType() == utils.SHARED_WORKSPACE.String() {
|
||||
return l.Data.(*rule.Rule)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *LibData) ToWorkflowExecution() *workflow_execution.WorkflowExecution {
|
||||
if l.Data.GetAccessor().GetType() == utils.WORKFLOW_EXECUTION.String() {
|
||||
return l.Data.(*workflow_execution.WorkflowExecution)
|
||||
|
Loading…
Reference in New Issue
Block a user