1
0
mirror of https://github.com/harness/drone.git synced 2025-04-28 22:04:44 +00:00
drone/app/api/handler/aiagent/update_pipeline.go
Yogesh Chauhan 0af264d09f feat: [ML-338]: APIs for Harness Intelligence ()
* Return empty summary/branch for now
* Fix Lint Issues
* feat: [ML-288]: API skeletons for Harness Intelligence
* fix ai pipelines ()

* fix ai pipelines
* Update pipeline name ()

* Update pipeline name
* fix: [ML-288]: update remediation prompt and suggestions ()

* fix: [ML-288]: update remediation prompt and suggestions
* fix: [ML-288]: update url for artifact registry ()

* fix: [ML-288]: update url for artifact registry
* Add snippet to mark code as written by Harness Intelligence ()

* Add snippet to mark code as written by Harness Intelligence
* Add snippet to mark code as written by Harness Intelligence ()

* Add snippet to mark code as written by Harness Intelligence
* feat: [ML-288]: link to harness artifact registry ()

* some linting fixes
* feat: [ML-288]: link to harness artifact registry
* feat: [ML-286]: updating pipeline suggestions ()

* updating suggestions
* feat: [ML-286]: updating pipeline suggestions
* feat: [ML-288]: adding slackbot ()

* updating slack responses
* prevent responding to any bot messages
* feat: [ML-288]: adding slackbot
* throw error for commit
* commit stubbed
* feat: [ML-286]: moving stubbed response earlier in execution ()

* feat: [ML-286]: moving stubbed response earlier in execution
* feat: [ML-286]: adding stubbed response for analyze execution ()

* updating branch name
* adding updated-main for analyse-execution endpoint
* feat: [ML-286]: adding stubbed response for analyze execution
* Update AnalyseExecutionOutput to contain multi file diff ()

* Create branch and commit changes on analyse
* Simplify AnalyseExecutionOutput to contain only high level summary and branch
* Update AnalyseExecutionOutput to contain multi file diff
* updating endpoints for unscripted demo ()

* cleaning up code, adding suggested pipeline response
* updating suggestions api
* updating endpoints for unscripted demo
* Stub out generate pipeline yaml
2024-09-09 17:49:44 +00:00

46 lines
1.3 KiB
Go

// Copyright 2023 Harness, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package aiagent
import (
"encoding/json"
"net/http"
"github.com/harness/gitness/app/api/controller/aiagent"
"github.com/harness/gitness/app/api/render"
)
func HandleUpdatePipeline(aiagentCtrl *aiagent.Controller) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
// TODO Question: how come we decode body here vs putting that logic in the request package?
in := new(aiagent.UpdatePipelineInput)
err := json.NewDecoder(r.Body).Decode(in)
if err != nil {
render.BadRequestf(ctx, w, "Invalid Request Body: %s.", err)
return
}
pipeline, err := aiagentCtrl.UpdatePipeline(ctx, in)
if err != nil {
render.TranslatedUserError(ctx, w, err)
return
}
render.JSON(w, http.StatusOK, pipeline)
}
}