Files
oc-lib/models/resources/workflow.go

50 lines
1.5 KiB
Go
Raw Normal View History

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"
2025-01-15 09:20:26 +01:00
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
2024-07-18 11:51:12 +02:00
)
2025-01-14 09:15:50 +01:00
type WorkflowResourcePricingProfile struct{}
// 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-14 09:15:50 +01:00
AbstractResource
2025-01-17 10:07:37 +01:00
WorkflowID string `bson:"workflow_id,omitempty" json:"workflow_id,omitempty"` // WorkflowID is the ID of the native workflow
}
2025-01-15 09:20:26 +01:00
func (d *WorkflowResource) GetAccessor(request *tools.APIRequest) utils.Accessor {
2025-06-20 12:10:36 +02:00
return NewAccessor[*WorkflowResource](tools.WORKFLOW_RESOURCE, request, func() utils.DBObject { return &WorkflowResource{} })
2025-01-15 09:20:26 +01:00
}
2026-01-12 11:59:05 +01:00
func (r *WorkflowResource) AddInstances(instance ResourceInstanceITF) {
}
2025-01-20 13:26:30 +01:00
func (r *WorkflowResource) GetType() string {
return tools.WORKFLOW_RESOURCE.String()
}
func (d *WorkflowResource) ClearEnv() utils.DBObject {
return d
}
2025-01-14 09:15:50 +01:00
func (d *WorkflowResource) Trim() {
/* EMPTY */
2025-01-13 14:52:41 +01:00
}
2025-01-13 11:24:07 +01:00
func (w *WorkflowResource) SetAllowedInstances(request *tools.APIRequest) {
2025-01-14 09:15:50 +01:00
/* EMPTY */
2024-07-18 11:51:12 +02:00
}
2026-01-13 16:04:31 +01:00
func (w *WorkflowResource) ConvertToPricedResource(t tools.DataType, selectedInstance *int, selectedPartnership *int, selectedBuyingStrategy *int, selectedStrategy *int, selectedBookingModeIndex *int, request *tools.APIRequest) (pricing.PricedItemITF, error) {
2025-01-13 11:24:07 +01:00
return &PricedResource{
2025-01-14 11:28:16 +01:00
Name: w.Name,
Logo: w.Logo,
ResourceID: w.UUID,
ResourceType: t,
2026-01-13 16:04:31 +01:00
Quantity: 1,
2025-01-14 11:28:16 +01:00
CreatorID: w.CreatorID,
2026-01-13 16:04:31 +01:00
}, nil // TODO ???
2024-07-18 11:51:12 +02:00
}