light modification

This commit is contained in:
mr
2025-01-14 11:28:16 +01:00
parent 918006302b
commit ae9a80c8f3
9 changed files with 48 additions and 66 deletions

View File

@@ -71,10 +71,10 @@ type AbstractIntanciatedResource[T ResourceInstanceITF] struct {
func (abs *AbstractIntanciatedResource[T]) ConvertToPricedResource(
t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF {
instances := map[string]string{}
profiles := map[string][]pricing.PricingProfileITF{}
profiles := []pricing.PricingProfileITF{}
for _, instance := range abs.Instances {
instances[instance.GetID()] = instance.GetName()
profiles[instance.GetID()] = instance.GetPricingsProfiles(request.PeerID, request.Groups)
profiles = instance.GetPricingsProfiles(request.PeerID, request.Groups)
}
return &PricedResource{
Name: abs.Name,
@@ -175,7 +175,7 @@ func (ri *ResourceInstance[T]) ClearPeerGroups() {
type ResourcePartnerShip[T pricing.PricingProfileITF] struct {
Namespace string `json:"namespace" bson:"namespace" default:"default-namespace"`
PeerGroups map[string][]string `json:"peer_groups,omitempty" bson:"peer_groups,omitempty"`
PricingProfiles map[string]T `json:"pricing,omitempty" bson:"pricing,omitempty"`
PricingProfiles []T `json:"pricing_profiles,omitempty" bson:"pricing_profiles,omitempty"`
}
func (ri *ResourcePartnerShip[T]) GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF {