diff --git a/pkg/api/presenters/resource.go b/pkg/api/presenters/resource.go index 929efec5..5a18703b 100755 --- a/pkg/api/presenters/resource.go +++ b/pkg/api/presenters/resource.go @@ -1,10 +1,12 @@ package presenters import ( + "gorm.io/datatypes" + "github.com/openshift-online/maestro/pkg/api" "github.com/openshift-online/maestro/pkg/api/openapi" + "github.com/openshift-online/maestro/pkg/constants" "github.com/openshift-online/maestro/pkg/util" - "gorm.io/datatypes" ) // ConvertResource converts a resource from the API to the openapi representation. @@ -20,8 +22,10 @@ func ConvertResource(resource openapi.Resource) (*api.Resource, error) { }, ConsumerName: util.NilToEmptyString(resource.ConsumerName), Version: util.NilToEmptyInt32(resource.Version), - Type: api.ResourceTypeSingle, - Manifest: manifest, + // Set the default source ID for RESTful API calls and do not allow modification + Source: constants.DefaultSourceID, + Type: api.ResourceTypeSingle, + Manifest: manifest, }, nil } diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go new file mode 100644 index 00000000..6467883b --- /dev/null +++ b/pkg/constants/constants.go @@ -0,0 +1,5 @@ +package constants + +const ( + DefaultSourceID = "maestro" +)