Compare commits
2 Commits
f5e1991324
...
9645e71b54
| Author | SHA1 | Date | |
|---|---|---|---|
| 9645e71b54 | |||
| 9f514a133e |
@@ -63,6 +63,7 @@ const (
|
||||
LIVE_STORAGE = tools.LIVE_STORAGE
|
||||
PURCHASE_RESOURCE = tools.PURCHASE_RESOURCE
|
||||
NATIVE_TOOL = tools.NATIVE_TOOL
|
||||
EXECUTION_VERIFICATION = tools.EXECUTION_VERIFICATION
|
||||
)
|
||||
|
||||
func GetMySelf() (*peer.Peer, error) {
|
||||
|
||||
30
models/execution_verification/execution_verification.go
Executable file
30
models/execution_verification/execution_verification.go
Executable file
@@ -0,0 +1,30 @@
|
||||
package execution_verification
|
||||
|
||||
import (
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
)
|
||||
|
||||
/*
|
||||
* ExecutionVerification is a struct that represents a list of workflow executions
|
||||
* Warning: No user can write (del, post, put) a workflow execution, it is only used by the system
|
||||
* workflows generate their own executions
|
||||
*/
|
||||
type ExecutionVerification struct {
|
||||
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
||||
WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"` // WorkflowID is the ID of the workflow
|
||||
IsVerified bool `json:"is_verified" bson:"is_verified,omitempty"`
|
||||
Validate bool `json:"validate" bson:"validate,omitempty"`
|
||||
}
|
||||
|
||||
func (r *ExecutionVerification) StoreDraftDefault() {
|
||||
r.IsDraft = false // TODO: TEMPORARY
|
||||
}
|
||||
|
||||
func (d *ExecutionVerification) GetAccessor(request *tools.APIRequest) utils.Accessor {
|
||||
return NewAccessor(request) // Create a new instance of the accessor
|
||||
}
|
||||
|
||||
func (d *ExecutionVerification) VerifyAuth(callName string, request *tools.APIRequest) bool {
|
||||
return true
|
||||
}
|
||||
35
models/execution_verification/execution_verification_mongo_accessor.go
Executable file
35
models/execution_verification/execution_verification_mongo_accessor.go
Executable file
@@ -0,0 +1,35 @@
|
||||
package execution_verification
|
||||
|
||||
import (
|
||||
"cloud.o-forge.io/core/oc-lib/logs"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
)
|
||||
|
||||
type ExecutionVerificationMongoAccessor struct {
|
||||
utils.AbstractAccessor[*ExecutionVerification]
|
||||
shallow bool
|
||||
}
|
||||
|
||||
func NewAccessor(request *tools.APIRequest) *ExecutionVerificationMongoAccessor {
|
||||
return &ExecutionVerificationMongoAccessor{
|
||||
shallow: false,
|
||||
AbstractAccessor: utils.AbstractAccessor[*ExecutionVerification]{
|
||||
Logger: logs.CreateLogger(tools.WORKFLOW_EXECUTION.String()), // Create a logger with the data type
|
||||
Request: request,
|
||||
Type: tools.WORKFLOW_EXECUTION,
|
||||
New: func() *ExecutionVerification { return &ExecutionVerification{} },
|
||||
NotImplemented: []string{"DeleteOne", "StoreOne", "CopyOne"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (wfa *ExecutionVerificationMongoAccessor) StoreOne(set utils.DBObject) (utils.DBObject, int, error) {
|
||||
set.(*ExecutionVerification).IsVerified = false
|
||||
return utils.GenericStoreOne(set, wfa)
|
||||
}
|
||||
|
||||
func (wfa *ExecutionVerificationMongoAccessor) UpdateOne(set map[string]interface{}, id string) (utils.DBObject, int, error) {
|
||||
set["is_verified"] = true
|
||||
return utils.GenericUpdateOne(set, id, wfa)
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"cloud.o-forge.io/core/oc-lib/logs"
|
||||
"cloud.o-forge.io/core/oc-lib/models/bill"
|
||||
"cloud.o-forge.io/core/oc-lib/models/execution_verification"
|
||||
"cloud.o-forge.io/core/oc-lib/models/live"
|
||||
"cloud.o-forge.io/core/oc-lib/models/order"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/purchase_resource"
|
||||
@@ -44,6 +45,7 @@ var ModelsCatalog = map[string]func() utils.DBObject{
|
||||
tools.LIVE_DATACENTER.String(): func() utils.DBObject { return &live.LiveDatacenter{} },
|
||||
tools.LIVE_STORAGE.String(): func() utils.DBObject { return &live.LiveStorage{} },
|
||||
tools.BILL.String(): func() utils.DBObject { return &bill.Bill{} },
|
||||
tools.EXECUTION_VERIFICATION.String(): func() utils.DBObject { return &execution_verification.ExecutionVerification{} },
|
||||
}
|
||||
|
||||
// Model returns the model object based on the model type
|
||||
|
||||
@@ -31,6 +31,7 @@ const (
|
||||
LIVE_STORAGE
|
||||
BILL
|
||||
NATIVE_TOOL
|
||||
EXECUTION_VERIFICATION
|
||||
)
|
||||
|
||||
var NOAPI = func() string {
|
||||
@@ -81,6 +82,7 @@ var InnerDefaultAPI = [...]func() string{
|
||||
DATACENTERAPI,
|
||||
NOAPI,
|
||||
CATALOGAPI,
|
||||
DATACENTERAPI,
|
||||
}
|
||||
|
||||
// Bind the standard data name to the data type
|
||||
@@ -106,6 +108,7 @@ var Str = [...]string{
|
||||
"live_storage",
|
||||
"bill",
|
||||
"native_tool",
|
||||
"execution_verification",
|
||||
}
|
||||
|
||||
func FromString(comp string) int {
|
||||
|
||||
Reference in New Issue
Block a user