EXPERIMENTAL: this endpoint is experimental and is subject to change. nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
(rw http.ResponseWriter, r *http.Request)
| 5167 | // |
| 5168 | //nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler. |
| 5169 | func (api *API) getChatDebugLogging(rw http.ResponseWriter, r *http.Request) { |
| 5170 | ctx := r.Context() |
| 5171 | if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentConfig) { |
| 5172 | httpapi.ResourceNotFound(rw) |
| 5173 | return |
| 5174 | } |
| 5175 | |
| 5176 | allowUsers, err := api.Database.GetChatDebugLoggingAllowUsers(ctx) |
| 5177 | if err != nil && !errors.Is(err, sql.ErrNoRows) { |
| 5178 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 5179 | Message: "Internal error fetching chat debug logging setting.", |
| 5180 | Detail: err.Error(), |
| 5181 | }) |
| 5182 | return |
| 5183 | } |
| 5184 | httpapi.Write(ctx, rw, http.StatusOK, codersdk.ChatDebugLoggingAdminSettings{ |
| 5185 | AllowUsers: err == nil && allowUsers, |
| 5186 | ForcedByDeployment: api.deploymentChatDebugLoggingEnabled(), |
| 5187 | }) |
| 5188 | } |
| 5189 | |
| 5190 | // EXPERIMENTAL: this endpoint is experimental and is subject to change. |
| 5191 | func (api *API) putChatDebugLogging(rw http.ResponseWriter, r *http.Request) { |
no test coverage detected