swagger:route POST /organizations/{orgID}/pools organizations pools CreateOrgPool Create organization pool with the parameters given. Parameters: + name: orgID description: Organization ID. type: string in: path required: true + name: Body description: Parameters u
(w http.ResponseWriter, r *http.Request)
| 269 | // 200: Pool |
| 270 | // default: APIErrorResponse |
| 271 | func (a *APIController) CreateOrgPoolHandler(w http.ResponseWriter, r *http.Request) { |
| 272 | ctx := r.Context() |
| 273 | |
| 274 | vars := mux.Vars(r) |
| 275 | orgID, ok := vars["orgID"] |
| 276 | if !ok { |
| 277 | w.WriteHeader(http.StatusBadRequest) |
| 278 | if err := json.NewEncoder(w).Encode(params.APIErrorResponse{ |
| 279 | Error: "Bad Request", |
| 280 | Details: "No org ID specified", |
| 281 | }); err != nil { |
| 282 | slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response") |
| 283 | } |
| 284 | return |
| 285 | } |
| 286 | |
| 287 | var poolData runnerParams.CreatePoolParams |
| 288 | if err := json.NewDecoder(r.Body).Decode(&poolData); err != nil { |
| 289 | slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to decode") |
| 290 | handleError(ctx, w, gErrors.ErrBadRequest) |
| 291 | return |
| 292 | } |
| 293 | |
| 294 | pool, err := a.r.CreateOrgPool(ctx, orgID, poolData) |
| 295 | if err != nil { |
| 296 | slog.With(slog.Any("error", err)).ErrorContext(ctx, "error creating organization pool") |
| 297 | handleError(ctx, w, err) |
| 298 | return |
| 299 | } |
| 300 | |
| 301 | w.Header().Set("Content-Type", "application/json") |
| 302 | if err := json.NewEncoder(w).Encode(pool); err != nil { |
| 303 | slog.With(slog.Any("error", err)).ErrorContext(ctx, "failed to encode response") |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | // swagger:route POST /organizations/{orgID}/scalesets organizations scalesets CreateOrgScaleSet |
| 308 | // |
nothing calls this directly
no test coverage detected