inspect comparision

This commit is contained in:
mr
2026-05-29 10:22:07 +02:00
parent 7e5b69b1d2
commit ce110ee634
3 changed files with 16 additions and 5 deletions
+3
View File
@@ -1,6 +1,8 @@
package live
import (
"fmt"
"cloud.o-forge.io/core/oc-lib/models/common/enum"
"cloud.o-forge.io/core/oc-lib/models/common/models"
"cloud.o-forge.io/core/oc-lib/models/utils"
@@ -36,6 +38,7 @@ type LiveDatacenter struct {
}
func (r *LiveDatacenter) IsCompatible(service map[string]interface{}) bool {
fmt.Println("COMPARE <", service["infrastructure"], "> <", r.Infrastructure, "> AND <", service["architecture"], "> <", r.Architecture, ">")
return service["infrastructure"] == r.Infrastructure && service["architecture"] == r.Architecture
}
+9 -5
View File
@@ -1,6 +1,8 @@
package live
import (
"fmt"
"cloud.o-forge.io/core/oc-lib/models/common/enum"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
@@ -26,11 +28,11 @@ func (p ServiceProtocol) String() string {
// rather than trusted from the ServiceResource, which may be stale.
type LiveService struct {
AbstractLive
MaxConcurrent int `json:"max_concurrent" bson:"max_concurrent"`
Protocol ServiceProtocol `json:"protocol" bson:"protocol" default:"0"`
EndpointPattern string `json:"endpoint_pattern,omitempty" bson:"endpoint_pattern,omitempty"`
HealthCheckPath string `json:"health_check_path,omitempty" bson:"health_check_path,omitempty"`
Infrastructure enum.InfrastructureType `json:"infrastructure" bson:"infrastructure" default:"-1"` // Infrastructure is the infrastructure
MaxConcurrent int `json:"max_concurrent" bson:"max_concurrent"`
Protocol ServiceProtocol `json:"protocol" bson:"protocol" default:"0"`
EndpointPattern string `json:"endpoint_pattern,omitempty" bson:"endpoint_pattern,omitempty"`
HealthCheckPath string `json:"health_check_path,omitempty" bson:"health_check_path,omitempty"`
Infrastructure enum.InfrastructureType `json:"infrastructure" bson:"infrastructure" default:"-1"` // Infrastructure is the infrastructure
}
func (d *LiveService) GetAccessor(request *tools.APIRequest) utils.Accessor {
@@ -38,5 +40,7 @@ func (d *LiveService) GetAccessor(request *tools.APIRequest) utils.Accessor {
}
func (r *LiveService) IsCompatible(service map[string]interface{}) bool {
fmt.Println("COMPARE <", service["infrastructure"], "> <", r.Infrastructure, ">")
return service["infrastructure"] == r.Infrastructure
}
+4
View File
@@ -1,6 +1,8 @@
package live
import (
"fmt"
"cloud.o-forge.io/core/oc-lib/models/common/enum"
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/tools"
@@ -26,6 +28,8 @@ type LiveStorage struct {
}
func (r *LiveStorage) IsCompatible(service map[string]interface{}) bool {
fmt.Println("COMPARE <", service["storage_type"], "> <", r.StorageType, ">")
return service["storage_type"] == r.StorageType
}