@@ -60,6 +60,7 @@ import (
6060 "github.com/SigNoz/signoz/pkg/query-service/postprocess"
6161 "github.com/SigNoz/signoz/pkg/types"
6262 "github.com/SigNoz/signoz/pkg/types/authtypes"
63+ "github.com/SigNoz/signoz/pkg/types/pipelinetypes"
6364
6465 "go.uber.org/zap"
6566
@@ -4462,6 +4463,11 @@ func (aH *APIHandler) PreviewLogsPipelinesHandler(w http.ResponseWriter, r *http
44624463}
44634464
44644465func (aH * APIHandler ) ListLogsPipelinesHandler (w http.ResponseWriter , r * http.Request ) {
4466+ claims , ok := authtypes .ClaimsFromContext (r .Context ())
4467+ if ! ok {
4468+ render .Error (w , errorsV2 .Newf (errorsV2 .TypeUnauthenticated , errorsV2 .CodeUnauthenticated , "unauthenticated" ))
4469+ return
4470+ }
44654471
44664472 version , err := parseAgentConfigVersion (r )
44674473 if err != nil {
@@ -4473,9 +4479,9 @@ func (aH *APIHandler) ListLogsPipelinesHandler(w http.ResponseWriter, r *http.Re
44734479 var apierr * model.ApiError
44744480
44754481 if version != - 1 {
4476- payload , apierr = aH .listLogsPipelinesByVersion (context .Background (), version )
4482+ payload , apierr = aH .listLogsPipelinesByVersion (context .Background (), claims . OrgID , version )
44774483 } else {
4478- payload , apierr = aH .listLogsPipelines (context .Background ())
4484+ payload , apierr = aH .listLogsPipelines (context .Background (), claims . OrgID )
44794485 }
44804486
44814487 if apierr != nil {
@@ -4486,7 +4492,7 @@ func (aH *APIHandler) ListLogsPipelinesHandler(w http.ResponseWriter, r *http.Re
44864492}
44874493
44884494// listLogsPipelines lists logs piplines for latest version
4489- func (aH * APIHandler ) listLogsPipelines (ctx context.Context ) (
4495+ func (aH * APIHandler ) listLogsPipelines (ctx context.Context , orgID string ) (
44904496 * logparsingpipeline.PipelinesResponse , * model.ApiError ,
44914497) {
44924498 // get lateset agent config
@@ -4516,7 +4522,7 @@ func (aH *APIHandler) listLogsPipelines(ctx context.Context) (
45164522}
45174523
45184524// listLogsPipelinesByVersion lists pipelines along with config version history
4519- func (aH * APIHandler ) listLogsPipelinesByVersion (ctx context.Context , version int ) (
4525+ func (aH * APIHandler ) listLogsPipelinesByVersion (ctx context.Context , orgID string , version int ) (
45204526 * logparsingpipeline.PipelinesResponse , * model.ApiError ,
45214527) {
45224528 payload , err := aH .LogsParsingPipelineController .GetPipelinesByVersion (ctx , version )
@@ -4537,7 +4543,13 @@ func (aH *APIHandler) listLogsPipelinesByVersion(ctx context.Context, version in
45374543
45384544func (aH * APIHandler ) CreateLogsPipeline (w http.ResponseWriter , r * http.Request ) {
45394545
4540- req := logparsingpipeline.PostablePipelines {}
4546+ claims , ok := authtypes .ClaimsFromContext (r .Context ())
4547+ if ! ok {
4548+ render .Error (w , errorsV2 .Newf (errorsV2 .TypeUnauthenticated , errorsV2 .CodeUnauthenticated , "unauthenticated" ))
4549+ return
4550+ }
4551+
4552+ req := pipelinetypes.PostablePipelines {}
45414553
45424554 if err := json .NewDecoder (r .Body ).Decode (& req ); err != nil {
45434555 RespondError (w , model .BadRequest (err ), nil )
@@ -4546,7 +4558,7 @@ func (aH *APIHandler) CreateLogsPipeline(w http.ResponseWriter, r *http.Request)
45464558
45474559 createPipeline := func (
45484560 ctx context.Context ,
4549- postable []logparsingpipeline .PostablePipeline ,
4561+ postable []pipelinetypes .PostablePipeline ,
45504562 ) (* logparsingpipeline.PipelinesResponse , * model.ApiError ) {
45514563 if len (postable ) == 0 {
45524564 zap .L ().Warn ("found no pipelines in the http request, this will delete all the pipelines" )
@@ -4557,7 +4569,7 @@ func (aH *APIHandler) CreateLogsPipeline(w http.ResponseWriter, r *http.Request)
45574569 return nil , validationErr
45584570 }
45594571
4560- return aH .LogsParsingPipelineController .ApplyPipelines (ctx , postable )
4572+ return aH .LogsParsingPipelineController .ApplyPipelines (ctx , claims . OrgID , postable )
45614573 }
45624574
45634575 res , err := createPipeline (r .Context (), req .Pipelines )
0 commit comments