47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package resources
|
|
|
|
import (
|
|
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
"cloud.o-forge.io/core/oc-lib/tools"
|
|
)
|
|
|
|
// we don't have any information about the accessor
|
|
type abstractWorkflowResource struct {
|
|
WorkflowID string `bson:"workflow_id,omitempty" json:"workflow_id,omitempty"` // WorkflowID is the ID of the native workflow
|
|
}
|
|
|
|
type WorkflowResourcePricingProfile struct{}
|
|
|
|
// WorkflowResource is a struct that represents a workflow resource
|
|
// it defines the resource workflow
|
|
type WorkflowResource struct {
|
|
AbstractResource
|
|
abstractWorkflowResource
|
|
}
|
|
|
|
func (d *WorkflowResource) GetAccessor(request *tools.APIRequest) utils.Accessor {
|
|
return NewAccessor[*ComputeResource](tools.WORKFLOW_RESOURCE, request, func() utils.DBObject { return &WorkflowResource{} })
|
|
}
|
|
|
|
func (d *WorkflowResource) Trim() {
|
|
/* EMPTY */
|
|
}
|
|
func (abs *WorkflowResource) VerifyAuth(request *tools.APIRequest) bool {
|
|
return true
|
|
}
|
|
func (w *WorkflowResource) SetAllowedInstances(request *tools.APIRequest) {
|
|
/* EMPTY */
|
|
}
|
|
|
|
func (w *WorkflowResource) ConvertToPricedResource(
|
|
t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF {
|
|
return &PricedResource{
|
|
Name: w.Name,
|
|
Logo: w.Logo,
|
|
ResourceID: w.UUID,
|
|
ResourceType: t,
|
|
CreatorID: w.CreatorID,
|
|
}
|
|
}
|