draft of compute units catalog
This commit is contained in:
parent
9e52663261
commit
0b0952b28c
@ -25,6 +25,7 @@ type ResourceInstanceITF interface {
|
||||
GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF
|
||||
GetPeerGroups() ([]ResourcePartnerITF, []map[string][]string)
|
||||
ClearPeerGroups()
|
||||
GetSelectedPartnership() ResourcePartnerITF
|
||||
GetPartnerships(peerID string, groups []string) []ResourcePartnerITF
|
||||
}
|
||||
|
||||
|
@ -144,13 +144,24 @@ type Credentials struct {
|
||||
|
||||
type ResourceInstance[T ResourcePartnerITF] struct {
|
||||
utils.AbstractObject
|
||||
Location GeoPoint `json:"location,omitempty" bson:"location,omitempty"`
|
||||
Country countries.CountryCode `json:"country,omitempty" bson:"country,omitempty"`
|
||||
AccessProtocol string `json:"access_protocol,omitempty" bson:"access_protocol,omitempty"`
|
||||
Env []models.Param `json:"env,omitempty" bson:"env,omitempty"`
|
||||
Inputs []models.Param `json:"inputs,omitempty" bson:"inputs,omitempty"`
|
||||
Outputs []models.Param `json:"outputs,omitempty" bson:"outputs,omitempty"`
|
||||
Partnerships []T `json:"partnerships,omitempty" bson:"partnerships,omitempty"`
|
||||
Location GeoPoint `json:"location,omitempty" bson:"location,omitempty"`
|
||||
Country countries.CountryCode `json:"country,omitempty" bson:"country,omitempty"`
|
||||
AccessProtocol string `json:"access_protocol,omitempty" bson:"access_protocol,omitempty"`
|
||||
Env []models.Param `json:"env,omitempty" bson:"env,omitempty"`
|
||||
Inputs []models.Param `json:"inputs,omitempty" bson:"inputs,omitempty"`
|
||||
Outputs []models.Param `json:"outputs,omitempty" bson:"outputs,omitempty"`
|
||||
SelectedPartnershipIndex *int `json:"selected_partnership_index,omitempty" bson:"selected_partnership_index,omitempty"` // SelectedInstance is the selected instance
|
||||
Partnerships []T `json:"partnerships,omitempty" bson:"partnerships,omitempty"`
|
||||
}
|
||||
|
||||
func (r *ResourceInstance[T]) GetSelectedPartnership() ResourcePartnerITF {
|
||||
if r.SelectedPartnershipIndex != nil && len(r.Partnerships) > *r.SelectedPartnershipIndex {
|
||||
return r.Partnerships[*r.SelectedPartnershipIndex]
|
||||
}
|
||||
if len(r.Partnerships) > 0 {
|
||||
return r.Partnerships[0]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ri *ResourceInstance[T]) ClearEnv() {
|
||||
@ -206,9 +217,6 @@ type ResourcePartnerShip[T pricing.PricingProfileITF] struct {
|
||||
func (ri *ResourcePartnerShip[T]) GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF {
|
||||
profiles := []pricing.PricingProfileITF{}
|
||||
if ri.PeerGroups[peerID] != nil {
|
||||
for _, ri := range ri.PricingProfiles {
|
||||
profiles = append(profiles, ri)
|
||||
}
|
||||
if slices.Contains(groups, "*") {
|
||||
for _, ri := range ri.PricingProfiles {
|
||||
profiles = append(profiles, ri)
|
||||
|
Loading…
Reference in New Issue
Block a user