add exec
This commit is contained in:
parent
a0f436b3e1
commit
1c32cd2d12
@ -32,3 +32,8 @@ const (
|
||||
MEMORY
|
||||
HARDWARE
|
||||
)
|
||||
|
||||
// String() - Returns the string representation of the storage type
|
||||
func (t StorageType) String() string {
|
||||
return [...]string{"FILE", "STREAM", "API", "DATABASE", "S3", "MEMORY", "HARDWARE"}[t]
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ type ShallowResourceInterface interface {
|
||||
type ResourceInterface interface {
|
||||
utils.DBObject
|
||||
Trim()
|
||||
Transform() utils.DBObject
|
||||
ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF
|
||||
SetAllowedInstances(request *tools.APIRequest)
|
||||
SetResourceModel(model *resource_model.ResourceModel)
|
||||
|
@ -35,6 +35,10 @@ type AbstractResource[T ResourceInstanceITF] struct {
|
||||
Instances []T `json:"instances,omitempty" bson:"instances,omitempty"` // Bill is the bill of the resource // Bill is the bill of the resource
|
||||
}
|
||||
|
||||
func (r *AbstractResource[T]) Transform() utils.DBObject {
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *AbstractResource[T]) StoreDraftDefault() {
|
||||
r.IsDraft = true
|
||||
}
|
||||
|
@ -16,7 +16,8 @@ import (
|
||||
*/
|
||||
type StorageResource struct {
|
||||
AbstractResource[*StorageResourceInstance] // AbstractResource contains the basic fields of an object (id, name)
|
||||
Type common.StorageType `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
|
||||
Type common.StorageType `bson:"type,omitempty"` // Type is the type of the storage
|
||||
TypeJSON string `json:"type,omitempty"`
|
||||
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage
|
||||
}
|
||||
|
||||
@ -24,6 +25,11 @@ func (d *StorageResource) GetAccessor(request *tools.APIRequest) utils.Accessor
|
||||
return NewAccessor[*StorageResource](tools.STORAGE_RESOURCE, request, func() utils.DBObject { return &StorageResource{} }) // Create a new instance of the accessor
|
||||
}
|
||||
|
||||
func (r *StorageResource) Transform() utils.DBObject {
|
||||
r.TypeJSON = r.Type.String()
|
||||
return r
|
||||
}
|
||||
|
||||
type StorageResourceInstance struct {
|
||||
ResourceInstance[*StorageResourcePartnership]
|
||||
Local bool `bson:"local" json:"local"`
|
||||
|
Loading…
Reference in New Issue
Block a user