From 7c114a0f18b47f63e9dec83509b0dffaf875cbd6 Mon Sep 17 00:00:00 2001 From: Ilias Katsakioris Date: Wed, 26 Oct 2022 20:56:30 +0300 Subject: [PATCH] feat(backend): Include namespace in Pipeline API model. Part of #4197 (#8375) --- backend/src/apiserver/server/api_converter.go | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/backend/src/apiserver/server/api_converter.go b/backend/src/apiserver/server/api_converter.go index bd6325448b0..d3f9f171afc 100644 --- a/backend/src/apiserver/server/api_converter.go +++ b/backend/src/apiserver/server/api_converter.go @@ -74,13 +74,27 @@ func ToApiPipeline(pipeline *model.Pipeline) *api.Pipeline { } } + var resourceRefs []*api.ResourceReference + if len(pipeline.Namespace) > 0 { + resourceRefs = []*api.ResourceReference{ + { + Key: &api.ResourceKey{ + Type: api.ResourceType_NAMESPACE, + Id: pipeline.Namespace, + }, + Relationship: api.Relationship_OWNER, + }, + } + } + return &api.Pipeline{ - Id: pipeline.UUID, - CreatedAt: ×tamp.Timestamp{Seconds: pipeline.CreatedAtInSec}, - Name: pipeline.Name, - Description: pipeline.Description, - Parameters: params, - DefaultVersion: defaultVersion, + Id: pipeline.UUID, + CreatedAt: ×tamp.Timestamp{Seconds: pipeline.CreatedAtInSec}, + Name: pipeline.Name, + Description: pipeline.Description, + Parameters: params, + DefaultVersion: defaultVersion, + ResourceReferences: resourceRefs, } }