MCPcopy Create free account
hub / github.com/cloudbase/garm / UpdateOrgPoolHandler

Method UpdateOrgPoolHandler

apiserver/controllers/organizations.go:568–603  ·  view source on GitHub ↗

swagger:route PUT /organizations/{orgID}/pools/{poolID} organizations pools UpdateOrgPool Update organization pool with the parameters given. Parameters: + name: orgID description: Organization ID. type: string in: path required: true + name: poolID description: ID

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

Source from the content-addressed store, hash-verified

566// 200: Pool
567// default: APIErrorResponse
568func (a *APIController) UpdateOrgPoolHandler(w http.ResponseWriter, r *http.Request) {
569 ctx := r.Context()
570
571 vars := mux.Vars(r)
572 orgID, orgOk := vars["orgID"]
573 poolID, poolOk := vars["poolID"]
574 if !orgOk || !poolOk {
575 w.WriteHeader(http.StatusBadRequest)
576 if err := json.NewEncoder(w).Encode(params.APIErrorResponse{
577 Error: "Bad Request",
578 Details: "No org or pool ID specified",
579 }); err != nil {
580 slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
581 }
582 return
583 }
584
585 var poolData runnerParams.UpdatePoolParams
586 if err := json.NewDecoder(r.Body).Decode(&poolData); err != nil {
587 slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode")
588 handleError(ctx, w, gErrors.ErrBadRequest)
589 return
590 }
591
592 pool, err := a.r.UpdateOrgPool(ctx, orgID, poolID, poolData)
593 if err != nil {
594 slog.With(slog.Any("error", err)).ErrorContext(ctx, "error creating organization pool")
595 handleError(ctx, w, err)
596 return
597 }
598
599 w.Header().Set("Content-Type", "application/json")
600 if err := json.NewEncoder(w).Encode(pool); err != nil {
601 slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response")
602 }
603}
604
605// swagger:route POST /organizations/{orgID}/webhook organizations hooks InstallOrgWebhook
606//

Callers

nothing calls this directly

Calls 3

handleErrorFunction · 0.85
UpdateOrgPoolMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected