MCPcopy Index your code
hub / github.com/coder/coder / deleteGroupAIBudget

Method deleteGroupAIBudget

enterprise/coderd/aibridge.go:795–823  ·  view source on GitHub ↗

@Summary Delete group AI budget @ID delete-group-ai-budget @Security CoderSessionToken @Tags Enterprise @Param group path string true "Group ID" format(uuid) @Success 204 @Router /api/v2/groups/{group}/ai/budget [delete]

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

793// @Success 204
794// @Router /api/v2/groups/{group}/ai/budget [delete]
795func (api *API) deleteGroupAIBudget(rw http.ResponseWriter, r *http.Request) {
796 var (
797 ctx = r.Context()
798 group = httpmw.GroupParam(r)
799 auditor = api.AGPL.Auditor.Load()
800 aReq, commitAudit = audit.InitRequest[database.AuditableGroupAiBudget](rw, &audit.RequestParams{
801 Audit: *auditor,
802 Log: api.Logger,
803 Request: r,
804 Action: database.AuditActionDelete,
805 OrganizationID: group.OrganizationID,
806 })
807 )
808 defer commitAudit()
809
810 deleted, err := api.Database.DeleteGroupAIBudget(ctx, group.ID)
811 if httpapi.Is404Error(err) {
812 httpapi.ResourceNotFound(rw)
813 return
814 }
815 if err != nil {
816 api.Logger.Error(ctx, "delete group AI budget", slog.Error(err))
817 httpapi.InternalServerError(rw, err)
818 return
819 }
820 aReq.Old = deleted.Auditable(group.Name)
821
822 rw.WriteHeader(http.StatusNoContent)
823}

Callers

nothing calls this directly

Calls 11

GroupParamFunction · 0.92
InitRequestFunction · 0.92
Is404ErrorFunction · 0.92
ResourceNotFoundFunction · 0.92
InternalServerErrorFunction · 0.92
ContextMethod · 0.65
DeleteGroupAIBudgetMethod · 0.65
LoadMethod · 0.45
ErrorMethod · 0.45
AuditableMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected