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

Method CreateOrgPool

runner/organizations.go:208–238  ·  view source on GitHub ↗
(ctx context.Context, orgID string, param params.CreatePoolParams)

Source from the content-addressed store, hash-verified

206}
207
208func (r *Runner) CreateOrgPool(ctx context.Context, orgID string, param params.CreatePoolParams) (params.Pool, error) {
209 if !auth.IsAdmin(ctx) {
210 return params.Pool{}, runnerErrors.ErrUnauthorized
211 }
212
213 createPoolParams, err := r.appendTagsToCreatePoolParams(param)
214 if err != nil {
215 return params.Pool{}, fmt.Errorf("error fetching pool params: %w", err)
216 }
217
218 if param.RunnerBootstrapTimeout == 0 {
219 param.RunnerBootstrapTimeout = appdefaults.DefaultRunnerBootstrapTimeout
220 }
221
222 entity, err := r.store.GetForgeEntity(ctx, params.ForgeEntityTypeOrganization, orgID)
223 if err != nil {
224 return params.Pool{}, fmt.Errorf("failed to get repo: %w", err)
225 }
226
227 template, err := r.findTemplate(ctx, entity, param.OSType, param.TemplateID)
228 if err != nil {
229 return params.Pool{}, fmt.Errorf("failed to find suitable template: %w", err)
230 }
231 createPoolParams.TemplateID = &template.ID
232 pool, err := r.store.CreateEntityPool(ctx, entity, createPoolParams)
233 if err != nil {
234 return params.Pool{}, fmt.Errorf("error creating pool: %w", err)
235 }
236
237 return pool, nil
238}
239
240func (r *Runner) GetOrgPoolByID(ctx context.Context, orgID, poolID string) (params.Pool, error) {
241 if !auth.IsAdmin(ctx) {

Callers

nothing calls this directly

Calls 5

findTemplateMethod · 0.95
IsAdminFunction · 0.92
GetForgeEntityMethod · 0.65
CreateEntityPoolMethod · 0.65

Tested by

no test coverage detected