draft of compute units catalog
This commit is contained in:
		| @@ -25,6 +25,7 @@ type ResourceInstanceITF interface { | ||||
| 	GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF | ||||
| 	GetPeerGroups() ([]ResourcePartnerITF, []map[string][]string) | ||||
| 	ClearPeerGroups() | ||||
| 	GetPartnerships(peerID string, groups []string) []ResourcePartnerITF | ||||
| } | ||||
|  | ||||
| type ResourcePartnerITF interface { | ||||
|   | ||||
| @@ -159,6 +159,20 @@ func (ri *ResourceInstance[T]) ClearEnv() { | ||||
| 	ri.Outputs = []models.Param{} | ||||
| } | ||||
|  | ||||
| func (ri *ResourceInstance[T]) GetPartnerships(peerID string, groups []string) []ResourcePartnerITF { | ||||
| 	partners := []ResourcePartnerITF{} | ||||
| 	for _, p := range ri.Partnerships { | ||||
| 		if p.GetPeerGroups()[peerID] != nil { | ||||
| 			for _, g := range p.GetPeerGroups()[peerID] { | ||||
| 				if slices.Contains(groups, g) { | ||||
| 					partners = append(partners, p) | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	return partners | ||||
| } | ||||
|  | ||||
| func (ri *ResourceInstance[T]) GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF { | ||||
| 	pricings := []pricing.PricingProfileITF{} | ||||
| 	for _, p := range ri.Partnerships { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user