2024-11-28 16:49:41 +01:00
|
|
|
package resources
|
2024-07-18 11:51:12 +02:00
|
|
|
|
|
|
|
import (
|
2025-01-13 11:24:07 +01:00
|
|
|
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
|
2024-08-12 16:11:25 +02:00
|
|
|
"cloud.o-forge.io/core/oc-lib/tools"
|
2024-07-18 11:51:12 +02:00
|
|
|
)
|
|
|
|
|
2024-12-12 16:25:47 +01:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2024-08-30 14:50:48 +02:00
|
|
|
// WorkflowResource is a struct that represents a workflow resource
|
|
|
|
// it defines the resource workflow
|
2024-07-19 10:54:58 +02:00
|
|
|
type WorkflowResource struct {
|
2025-01-13 11:24:07 +01:00
|
|
|
AbsResource
|
2024-12-12 16:25:47 +01:00
|
|
|
abstractWorkflowResource
|
|
|
|
}
|
|
|
|
|
2025-01-13 11:24:07 +01:00
|
|
|
func (w *WorkflowResource) Trim() {
|
|
|
|
/*EMPTY AND PROUD TO BE*/
|
2024-12-16 12:17:20 +01:00
|
|
|
}
|
|
|
|
|
2025-01-13 11:24:07 +01:00
|
|
|
func (w *WorkflowResource) SetAllowedInstances(request *tools.APIRequest) {
|
|
|
|
/*EMPTY AND PROUD TO BE*/
|
2024-07-18 11:51:12 +02:00
|
|
|
}
|
|
|
|
|
2025-01-13 11:24:07 +01:00
|
|
|
func (w *WorkflowResource) ConvertToPricedResource(
|
|
|
|
t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF {
|
|
|
|
instances := map[string]string{}
|
|
|
|
profiles := map[string][]pricing.PricingProfileITF{}
|
|
|
|
return &PricedResource{
|
|
|
|
Name: w.Name,
|
|
|
|
Logo: w.Logo,
|
|
|
|
ResourceID: w.UUID,
|
|
|
|
ResourceType: t,
|
|
|
|
InstancesRefs: instances,
|
|
|
|
PricingProfiles: profiles,
|
|
|
|
CreatorID: w.CreatorID,
|
2024-12-12 16:25:47 +01:00
|
|
|
}
|
2024-07-18 11:51:12 +02:00
|
|
|
}
|