adding inputs output struct based on argo naming for now

This commit is contained in:
mr 2025-01-27 12:09:38 +01:00
parent d731277914
commit 1ad9ce09cb
2 changed files with 9 additions and 5 deletions

View File

@ -12,12 +12,13 @@ type ResourceInterface interface {
Trim() Trim()
ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF
GetType() string GetType() string
GetSelectedInstance() ResourceInstanceITF GetSelectedInstance() utils.DBObject
SetAllowedInstances(request *tools.APIRequest) SetAllowedInstances(request *tools.APIRequest)
SetResourceModel(model *resource_model.ResourceModel) SetResourceModel(model *resource_model.ResourceModel)
} }
type ResourceInstanceITF interface { type ResourceInstanceITF interface {
utils.DBObject
GetID() string GetID() string
GetName() string GetName() string
GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF

View File

@ -35,7 +35,7 @@ type AbstractResource struct {
SelectedInstanceIndex *int `json:"selected_instance_index,omitempty" bson:"selected_instance_index,omitempty"` // SelectedInstance is the selected instance SelectedInstanceIndex *int `json:"selected_instance_index,omitempty" bson:"selected_instance_index,omitempty"` // SelectedInstance is the selected instance
} }
func (r *AbstractResource) GetSelectedInstance() ResourceInstanceITF { func (r *AbstractResource) GetSelectedInstance() utils.DBObject {
return nil return nil
} }
@ -86,7 +86,7 @@ func (abs *AbstractIntanciatedResource[T]) ConvertToPricedResource(
} }
} }
func (r *AbstractIntanciatedResource[T]) GetSelectedInstance() ResourceInstanceITF { 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]
} }
@ -140,8 +140,7 @@ type GeoPoint struct {
} }
type ResourceInstance[T ResourcePartnerITF] struct { type ResourceInstance[T ResourcePartnerITF] struct {
UUID string `json:"id,omitempty" bson:"id,omitempty"` utils.AbstractObject
Name string `json:"name,omitempty" bson:"name,omitempty"`
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"`
@ -150,6 +149,10 @@ type ResourceInstance[T ResourcePartnerITF] struct {
Partnerships []T `json:"partnerships,omitempty" bson:"partnerships,omitempty"` Partnerships []T `json:"partnerships,omitempty" bson:"partnerships,omitempty"`
} }
func (ri *ResourceInstance[T]) GetAccessor(request *tools.APIRequest) utils.Accessor {
return nil
}
func (ri *ResourceInstance[T]) GetID() string { func (ri *ResourceInstance[T]) GetID() string {
return ri.UUID return ri.UUID
} }