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

Method DeleteOrgPool

runner/organizations.go:258–290  ·  view source on GitHub ↗
(ctx context.Context, orgID, poolID string)

Source from the content-addressed store, hash-verified

256}
257
258func (r *Runner) DeleteOrgPool(ctx context.Context, orgID, poolID string) error {
259 if !auth.IsAdmin(ctx) {
260 return runnerErrors.ErrUnauthorized
261 }
262
263 entity := params.ForgeEntity{
264 ID: orgID,
265 EntityType: params.ForgeEntityTypeOrganization,
266 }
267
268 pool, err := r.store.GetEntityPool(ctx, entity, poolID)
269 if err != nil {
270 if !errors.Is(err, runnerErrors.ErrNotFound) {
271 return fmt.Errorf("error fetching pool: %w", err)
272 }
273 return nil
274 }
275
276 // nolint:golangci-lint,godox
277 // TODO: implement a count function
278 if len(pool.Instances) > 0 {
279 runnerIDs := []string{}
280 for _, run := range pool.Instances {
281 runnerIDs = append(runnerIDs, run.ID)
282 }
283 return runnerErrors.NewBadRequestError("pool has runners: %s", strings.Join(runnerIDs, ", "))
284 }
285
286 if err := r.store.DeleteEntityPool(ctx, entity, poolID); err != nil {
287 return fmt.Errorf("error deleting pool: %w", err)
288 }
289 return nil
290}
291
292func (r *Runner) ListOrgPools(ctx context.Context, orgID string) ([]params.Pool, error) {
293 if !auth.IsAdmin(ctx) {

Callers

nothing calls this directly

Calls 3

IsAdminFunction · 0.92
GetEntityPoolMethod · 0.65
DeleteEntityPoolMethod · 0.65

Tested by

no test coverage detected