data change for resource struct
This commit is contained in:
@@ -2,8 +2,6 @@ package resources
|
||||
|
||||
import (
|
||||
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
)
|
||||
|
||||
@@ -12,51 +10,23 @@ 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 {
|
||||
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
||||
Logo string `json:"logo,omitempty" bson:"logo,omitempty" validate:"required"` // Logo is the logo of the resource
|
||||
Description string `json:"description,omitempty" bson:"description,omitempty"` // Description is the description of the resource
|
||||
ShortDescription string `json:"short_description,omitempty" bson:"short_description,omitempty" validate:"required"` // ShortDescription is the short description of the resource
|
||||
Owners []utils.Owner `json:"owners,omitempty" bson:"owners,omitempty"` // Owners is the list of owners of the resource
|
||||
ResourceModel *resource_model.ResourceModel `json:"resource_model,omitempty" bson:"resource_model,omitempty"` // ResourceModel is the model of the resource
|
||||
UsageRestrictions string `bson:"usage_restrictions,omitempty" json:"usage_restrictions,omitempty"`
|
||||
AbstractResource
|
||||
abstractWorkflowResource
|
||||
}
|
||||
|
||||
func (r *WorkflowResource) Transform() utils.DBObject {
|
||||
return r
|
||||
func (d *WorkflowResource) Trim() {
|
||||
/* EMPTY */
|
||||
}
|
||||
|
||||
func (r *WorkflowResource) StoreDraftDefault() {
|
||||
r.IsDraft = true
|
||||
func (abs *WorkflowResource) VerifyAuth(request *tools.APIRequest) bool {
|
||||
return true
|
||||
}
|
||||
func (r *WorkflowResource) CanUpdate(set utils.DBObject) (bool, utils.DBObject) {
|
||||
if r.IsDraft != set.IsDrafted() && set.IsDrafted() {
|
||||
return true, set // only state can be updated
|
||||
}
|
||||
return r.IsDraft != set.IsDrafted() && set.IsDrafted(), set
|
||||
}
|
||||
|
||||
func (r *WorkflowResource) CanDelete() bool {
|
||||
return r.IsDraft // only draft bookings can be deleted
|
||||
}
|
||||
|
||||
func (ao *WorkflowResource) GetAccessor(request *tools.APIRequest) utils.Accessor {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (abs *WorkflowResource) SetResourceModel(model *resource_model.ResourceModel) {
|
||||
abs.ResourceModel = model
|
||||
}
|
||||
|
||||
func (w *WorkflowResource) Trim() {
|
||||
/*EMPTY AND PROUD TO BE*/
|
||||
}
|
||||
|
||||
func (w *WorkflowResource) SetAllowedInstances(request *tools.APIRequest) {
|
||||
/*EMPTY AND PROUD TO BE*/
|
||||
/* EMPTY */
|
||||
}
|
||||
|
||||
func (w *WorkflowResource) ConvertToPricedResource(
|
||||
|
||||
Reference in New Issue
Block a user