diff --git a/internal/server/v1/firehose/crud.go b/internal/server/v1/firehose/crud.go index 073dda1..d4419f9 100644 --- a/internal/server/v1/firehose/crud.go +++ b/internal/server/v1/firehose/crud.go @@ -70,6 +70,7 @@ func (api *firehoseAPI) handleCreate(w http.ResponseWriter, r *http.Request) { labelTeam: groupSlug, labelStream: *def.Configs.StreamName, labelDescription: def.Description, + labelSinkType: def.Configs.EnvVars["SINK_TYPE"], }) prj, err := project.GetProject(ctx, def.Project, api.Shield) @@ -359,6 +360,7 @@ func (api *firehoseAPI) handlePartialUpdate(w http.ResponseWriter, r *http.Reque if req.Configs.StreamName != "" { existing.Configs.StreamName = &req.Configs.StreamName + labels[labelStream] = req.Configs.StreamName } if req.Configs.Replicas > 0 { @@ -381,6 +383,10 @@ func (api *firehoseAPI) handlePartialUpdate(w http.ResponseWriter, r *http.Reque } } + if existing.Configs.EnvVars["SINK_TYPE"] != req.Configs.EnvVars["SINK_TYPE"] { + labels[labelSinkType] = req.Configs.EnvVars["SINK_TYPE"] + } + existing.Configs.EnvVars = cloneAndMergeMaps( existing.Configs.EnvVars, req.Configs.EnvVars, diff --git a/internal/server/v1/firehose/mappings.go b/internal/server/v1/firehose/mappings.go index dbae4e4..50494a2 100644 --- a/internal/server/v1/firehose/mappings.go +++ b/internal/server/v1/firehose/mappings.go @@ -26,6 +26,7 @@ const ( labelTeam = "team" labelStream = "stream_name" labelDescription = "description" + labelSinkType = "sink_type" ) var nonAlphaNumPattern = regexp.MustCompile("[^a-zA-Z0-9]+")