Verify Resource integrity base struct

This commit is contained in:
mr
2026-02-09 10:03:40 +01:00
parent b9e7ce20b6
commit c2aa2fedaa
2 changed files with 6 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ type AbstractResource struct {
Owners []utils.Owner `json:"owners,omitempty" bson:"owners,omitempty"` // Owners is the list of owners of the resource Owners []utils.Owner `json:"owners,omitempty" bson:"owners,omitempty"` // Owners is the list of owners of the resource
UsageRestrictions string `bson:"usage_restrictions,omitempty" json:"usage_restrictions,omitempty"` UsageRestrictions string `bson:"usage_restrictions,omitempty" json:"usage_restrictions,omitempty"`
AllowedBookingModes map[booking.BookingMode]*pricing.PricingVariation `bson:"allowed_booking_modes" json:"allowed_booking_modes"` AllowedBookingModes map[booking.BookingMode]*pricing.PricingVariation `bson:"allowed_booking_modes" json:"allowed_booking_modes"`
Signature string `bson:"signature" json:"signature"`
} }
func (abs *AbstractResource) FilterPeer(peerID string) *dbs.Filters { func (abs *AbstractResource) FilterPeer(peerID string) *dbs.Filters {

View File

@@ -25,7 +25,9 @@ type NATSResponse struct {
type NATSMethod int type NATSMethod int
var meths = []string{"remove execution", "create execution", "discovery", var meths = []string{"remove execution", "create execution", "discovery",
"workflow event", "remove peer", "create peer", "create resource", "remove resource", "propalgation event", "catalogsearch event"} "workflow event", "remove peer", "create peer", "create resource", "remove resource", "verify_resource",
"propalgation event", "catalogsearch event",
}
const ( const (
REMOVE_EXECUTION NATSMethod = iota REMOVE_EXECUTION NATSMethod = iota
@@ -38,6 +40,7 @@ const (
CREATE_RESOURCE CREATE_RESOURCE
REMOVE_RESOURCE REMOVE_RESOURCE
VERIFY_RESOURCE
PROPALGATION_EVENT PROPALGATION_EVENT
CATALOG_SEARCH_EVENT CATALOG_SEARCH_EVENT
@@ -50,7 +53,7 @@ func (n NATSMethod) String() string {
// NameToMethod returns the NATSMethod enum value from a string // NameToMethod returns the NATSMethod enum value from a string
func NameToMethod(name string) NATSMethod { func NameToMethod(name string) NATSMethod {
for _, v := range [...]NATSMethod{REMOVE_EXECUTION, CREATE_EXECTUTION, DISCOVERY, WORKFLOW_EVENT, for _, v := range [...]NATSMethod{REMOVE_EXECUTION, CREATE_EXECTUTION, DISCOVERY, WORKFLOW_EVENT,
REMOVE_PEER, CREATE_PEER, CREATE_RESOURCE, REMOVE_RESOURCE, PROPALGATION_EVENT, CATALOG_SEARCH_EVENT} { REMOVE_PEER, CREATE_PEER, CREATE_RESOURCE, REMOVE_RESOURCE, VERIFY_RESOURCE, PROPALGATION_EVENT, CATALOG_SEARCH_EVENT} {
if strings.Contains(strings.ToLower(v.String()), strings.ToLower(name)) { if strings.Contains(strings.ToLower(v.String()), strings.ToLower(name)) {
return v return v
} }