ENV, Input, Outpu Expose, Container change of rules

This commit is contained in:
mr
2026-04-02 14:31:19 +02:00
parent 2bc4555793
commit a2f6f3c252
9 changed files with 41 additions and 135 deletions

View File

@@ -44,6 +44,15 @@ func (abs *StorageResource) ConvertToPricedResource(t tools.DataType, selectedIn
}, nil
}
func (ri *StorageResource) StoreDraftDefault() {
ri.AbstractObject.StoreDraftDefault()
ri.Env = append(ri.Env, models.Param{
Attr: "source",
Value: "[resource]instance.source",
Readonly: true,
})
}
type StorageResourceInstance struct {
ResourceInstance[*StorageResourcePartnership]
Source string `bson:"source,omitempty" json:"source,omitempty"` // Source is the source of the storage
@@ -72,30 +81,6 @@ func NewStorageResourceInstance(name string, peerID string) ResourceInstanceITF
}
}
func (ri *StorageResourceInstance) ClearEnv() {
ri.Env = []models.Param{}
ri.Inputs = []models.Param{}
ri.Outputs = []models.Param{}
}
func (ri *StorageResourceInstance) StoreDraftDefault() {
found := false
for _, p := range ri.ResourceInstance.Env {
if p.Attr == "source" {
found = true
break
}
}
if !found {
ri.ResourceInstance.Env = append(ri.ResourceInstance.Env, models.Param{
Attr: "source",
Value: ri.Source,
Readonly: true,
})
}
ri.ResourceInstance.StoreDraftDefault()
}
type StorageResourcePartnership struct {
ResourcePartnerShip[*StorageResourcePricingProfile]
MaxSizeGBAllowed float64 `json:"allowed_gb,omitempty" bson:"allowed_gb,omitempty"`
@@ -121,7 +106,7 @@ func (t PrivilegeStoragePricingStrategy) String() string {
type StorageResourcePricingStrategy int
const (
PER_DATA_STORED StorageResourcePricingStrategy = iota + 6
PER_DATA_STORED StorageResourcePricingStrategy = iota + 7
PER_TB_STORED
PER_GB_STORED
PER_MB_STORED