workflow scheduler create booking with a booking execution lot id
This commit is contained in:
parent
019b590b4f
commit
7c57cf34a8
@ -12,6 +12,7 @@ type ResourceInterface interface {
|
|||||||
ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF
|
ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF
|
||||||
GetType() string
|
GetType() string
|
||||||
GetSelectedInstance() utils.DBObject
|
GetSelectedInstance() utils.DBObject
|
||||||
|
ClearEnv() utils.DBObject
|
||||||
SetAllowedInstances(request *tools.APIRequest)
|
SetAllowedInstances(request *tools.APIRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ type ResourceInstanceITF interface {
|
|||||||
GetID() string
|
GetID() string
|
||||||
GetName() string
|
GetName() string
|
||||||
StoreDraftDefault()
|
StoreDraftDefault()
|
||||||
|
ClearEnv()
|
||||||
GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF
|
GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF
|
||||||
GetPeerGroups() ([]ResourcePartnerITF, []map[string][]string)
|
GetPeerGroups() ([]ResourcePartnerITF, []map[string][]string)
|
||||||
ClearPeerGroups()
|
ClearPeerGroups()
|
||||||
|
@ -71,6 +71,13 @@ func (abs *AbstractIntanciatedResource[T]) ConvertToPricedResource(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (abs *AbstractIntanciatedResource[T]) ClearEnv() utils.DBObject {
|
||||||
|
for _, instance := range abs.Instances {
|
||||||
|
instance.ClearEnv()
|
||||||
|
}
|
||||||
|
return abs
|
||||||
|
}
|
||||||
|
|
||||||
func (r *AbstractIntanciatedResource[T]) GetSelectedInstance() utils.DBObject {
|
func (r *AbstractIntanciatedResource[T]) GetSelectedInstance() utils.DBObject {
|
||||||
if r.SelectedInstanceIndex != nil && len(r.Instances) > *r.SelectedInstanceIndex {
|
if r.SelectedInstanceIndex != nil && len(r.Instances) > *r.SelectedInstanceIndex {
|
||||||
return r.Instances[*r.SelectedInstanceIndex]
|
return r.Instances[*r.SelectedInstanceIndex]
|
||||||
@ -127,17 +134,30 @@ type GeoPoint struct {
|
|||||||
Longitude float64 `json:"longitude,omitempty" bson:"longitude,omitempty"`
|
Longitude float64 `json:"longitude,omitempty" bson:"longitude,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Credentials struct {
|
||||||
|
Login string `json:"login,omitempty" bson:"login,omitempty"`
|
||||||
|
Pass string `json:"password,omitempty" bson:"password,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type ResourceInstance[T ResourcePartnerITF] struct {
|
type ResourceInstance[T ResourcePartnerITF] struct {
|
||||||
utils.AbstractObject
|
utils.AbstractObject
|
||||||
Location GeoPoint `json:"location,omitempty" bson:"location,omitempty"`
|
Location GeoPoint `json:"location,omitempty" bson:"location,omitempty"`
|
||||||
Country countries.CountryCode `json:"country,omitempty" bson:"country,omitempty"`
|
Country countries.CountryCode `json:"country,omitempty" bson:"country,omitempty"`
|
||||||
AccessProtocol string `json:"access_protocol,omitempty" bson:"access_protocol,omitempty"`
|
AccessProtocol string `json:"access_protocol,omitempty" bson:"access_protocol,omitempty"`
|
||||||
|
Access *Credentials `json:"access,omitempty" bson:"access,omitempty"`
|
||||||
Env []models.Param `json:"env,omitempty" bson:"env,omitempty"`
|
Env []models.Param `json:"env,omitempty" bson:"env,omitempty"`
|
||||||
Inputs []models.Param `json:"inputs,omitempty" bson:"inputs,omitempty"`
|
Inputs []models.Param `json:"inputs,omitempty" bson:"inputs,omitempty"`
|
||||||
Outputs []models.Param `json:"outputs,omitempty" bson:"outputs,omitempty"`
|
Outputs []models.Param `json:"outputs,omitempty" bson:"outputs,omitempty"`
|
||||||
Partnerships []T `json:"partnerships,omitempty" bson:"partnerships,omitempty"`
|
Partnerships []T `json:"partnerships,omitempty" bson:"partnerships,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ri *ResourceInstance[T]) ClearEnv() {
|
||||||
|
ri.Access = nil
|
||||||
|
ri.Env = []models.Param{}
|
||||||
|
ri.Inputs = []models.Param{}
|
||||||
|
ri.Outputs = []models.Param{}
|
||||||
|
}
|
||||||
|
|
||||||
func (ri *ResourceInstance[T]) GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF {
|
func (ri *ResourceInstance[T]) GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF {
|
||||||
pricings := []pricing.PricingProfileITF{}
|
pricings := []pricing.PricingProfileITF{}
|
||||||
for _, p := range ri.Partnerships {
|
for _, p := range ri.Partnerships {
|
||||||
|
@ -23,6 +23,10 @@ func (r *WorkflowResource) GetType() string {
|
|||||||
return tools.WORKFLOW_RESOURCE.String()
|
return tools.WORKFLOW_RESOURCE.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *WorkflowResource) ClearEnv() utils.DBObject {
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
func (d *WorkflowResource) Trim() {
|
func (d *WorkflowResource) Trim() {
|
||||||
/* EMPTY */
|
/* EMPTY */
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,13 @@ func (a *workflowMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, i
|
|||||||
|
|
||||||
// CopyOne copies a workflow in the database
|
// CopyOne copies a workflow in the database
|
||||||
func (a *workflowMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
func (a *workflowMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||||
|
wf := data.(*Workflow)
|
||||||
|
for _, item := range wf.Graph.Items {
|
||||||
|
_, obj := item.GetResource()
|
||||||
|
if obj != nil {
|
||||||
|
obj.ClearEnv()
|
||||||
|
}
|
||||||
|
}
|
||||||
return utils.GenericStoreOne(data, a)
|
return utils.GenericStoreOne(data, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user