From 1ad9ce09cb35feae511c24a796986f405d66634d Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 27 Jan 2025 12:09:38 +0100 Subject: [PATCH] adding inputs output struct based on argo naming for now --- models/resources/interfaces.go | 3 ++- models/resources/resource.go | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/models/resources/interfaces.go b/models/resources/interfaces.go index 6ad2c28..05f74a6 100644 --- a/models/resources/interfaces.go +++ b/models/resources/interfaces.go @@ -12,12 +12,13 @@ type ResourceInterface interface { Trim() ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF GetType() string - GetSelectedInstance() ResourceInstanceITF + GetSelectedInstance() utils.DBObject SetAllowedInstances(request *tools.APIRequest) SetResourceModel(model *resource_model.ResourceModel) } type ResourceInstanceITF interface { + utils.DBObject GetID() string GetName() string GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF diff --git a/models/resources/resource.go b/models/resources/resource.go index d24de34..d0eee29 100644 --- a/models/resources/resource.go +++ b/models/resources/resource.go @@ -35,7 +35,7 @@ type AbstractResource struct { 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 } @@ -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 { return r.Instances[*r.SelectedInstanceIndex] } @@ -140,8 +140,7 @@ type GeoPoint struct { } type ResourceInstance[T ResourcePartnerITF] struct { - UUID string `json:"id,omitempty" bson:"id,omitempty"` - Name string `json:"name,omitempty" bson:"name,omitempty"` + 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"` @@ -150,6 +149,10 @@ type ResourceInstance[T ResourcePartnerITF] struct { 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 { return ri.UUID }