oc-lib/models/resources/resource.go
2024-07-19 10:54:58 +02:00

34 lines
1.1 KiB
Go

package resources
import (
"cloud.o-forge.io/core/oc-lib/models/utils"
)
// AbstractResource is the struct containing all of the attributes commons to all ressources
// Resource is the interface to be implemented by all classes inheriting from Resource to have the same behavior
//http://www.inanzzz.com/index.php/post/wqbs/a-basic-usage-of-int-and-string-enum-types-in-golang
type Resource interface {
GetType() utils.DataType
}
type AbstractResource struct {
utils.AbstractObject
ShortDescription string `json:"short_description" required:"true" bson:"short_description" validate:"required"`
Description string `json:"description,omitempty" bson:"description"`
Logo string `json:"logo" required:"true" bson:"logo" validate:"required"`
Owner string `json:"owner" required:"true" bson:"owner" validate:"required"`
OwnerLogo string `json:"owner_logo" required:"true" bson:"owner_logo"`
SourceUrl string `json:"source_url" required:"true" bson:"source_url" validate:"required"`
}
func (r *AbstractResource) GetID() string {
return r.UUID
}
func (r *AbstractResource) GetName() string {
return r.Name
}