Merge branch 'main' of https://cloud.o-forge.io/core/oc-lib into main

This commit is contained in:
mr 2025-07-04 10:44:59 +02:00
commit 443546027b
4 changed files with 11 additions and 6 deletions

View File

@ -17,9 +17,9 @@ import (
*/ */
type Booking struct { type Booking struct {
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name) utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
PricedItem pricing.PricedItemITF `json:"priced_item,omitempty" bson:"priced_item,omitempty" validate:"required"` PricedItem pricing.PricedItemITF `json:"priced_item,omitempty" bson:"priced_item,omitempty"` // We need to add the validate:"required" tag once the pricing feature is implemented, removed to avoid handling the error
ResumeMetrics map[string]map[string]models.MetricResume `json:"resume_metrics,omitempty" bson:"resume_metrics,omitempty"` ResumeMetrics map[string]map[string]models.MetricResume `json:"resume_metrics,omitempty" bson:"resume_metrics,omitempty"`
ExecutionMetrics map[string][]models.MetricsSnapshot `json:"metrics,omitempty" bson:"metrics,omitempty"` ExecutionMetrics map[string][]models.MetricsSnapshot `json:"metrics,omitempty" bson:"metrics,omitempty"`
ExecutionsID string `json:"executions_id,omitempty" bson:"executions_id,omitempty" validate:"required"` // ExecutionsID is the ID of the executions ExecutionsID string `json:"executions_id,omitempty" bson:"executions_id,omitempty" validate:"required"` // ExecutionsID is the ID of the executions

View File

@ -36,7 +36,7 @@ func (a *orderMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBO
} }
func (a *orderMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) { func (a *orderMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
return nil, 404, errors.New("Not implemented") return utils.GenericStoreOne(data,a)
} }
func (a *orderMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) { func (a *orderMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {

View File

@ -240,9 +240,10 @@ func plan[T resources.ResourceInterface](
return resources, priceds, errors.New("could not load the processing resource") return resources, priceds, errors.New("could not load the processing resource")
} }
priced := realItem.ConvertToPricedResource(dt, request) priced := realItem.ConvertToPricedResource(dt, request)
if priced.SelectPricing() == nil { // Should be commented once the Pricing selection feature has been implemented, related to the commit d35ad440fa77763ec7f49ab34a85e47e75581b61
return resources, priceds, errors.New("no pricings are selected... can't proceed") // if priced.SelectPricing() == nil {
} // return resources, priceds, errors.New("no pricings are selected... can't proceed")
// }
started, duration := start(realItem, priced) started, duration := start(realItem, priced)
priced.SetLocationStart(started) priced.SetLocationStart(started)
if duration >= 0 { if duration >= 0 {

View File

@ -29,6 +29,7 @@ const (
LIVE_DATACENTER LIVE_DATACENTER
LIVE_STORAGE LIVE_STORAGE
BILL BILL
MINIO_SVCACC
) )
var NOAPI = "" var NOAPI = ""
@ -44,6 +45,7 @@ var ADMIRALTY_TARGETAPI = DATACENTERAPI + "/admiralty/target"
var ADMIRALTY_SECRETAPI = DATACENTERAPI + "/admiralty/secret" var ADMIRALTY_SECRETAPI = DATACENTERAPI + "/admiralty/secret"
var ADMIRALTY_KUBECONFIGAPI = DATACENTERAPI + "/admiralty/kubeconfig" var ADMIRALTY_KUBECONFIGAPI = DATACENTERAPI + "/admiralty/kubeconfig"
var ADMIRALTY_NODESAPI = DATACENTERAPI + "/admiralty/node" var ADMIRALTY_NODESAPI = DATACENTERAPI + "/admiralty/node"
var MINIO = DATACENTERAPI + "/minio"
// Bind the standard API name to the data type // Bind the standard API name to the data type
var DefaultAPI = [...]string{ var DefaultAPI = [...]string{
@ -72,6 +74,7 @@ var DefaultAPI = [...]string{
DATACENTERAPI, DATACENTERAPI,
DATACENTERAPI, DATACENTERAPI,
NOAPI, NOAPI,
MINIO,
} }
// Bind the standard data name to the data type // Bind the standard data name to the data type
@ -101,6 +104,7 @@ var Str = [...]string{
"live_datacenter", "live_datacenter",
"live_storage", "live_storage",
"bill", "bill",
"service_account",
} }
func FromInt(i int) string { func FromInt(i int) string {