(ctx context.Context, orgID string, param params.CreatePoolParams)
| 206 | } |
| 207 | |
| 208 | func (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 | |
| 240 | func (r *Runner) GetOrgPoolByID(ctx context.Context, orgID, poolID string) (params.Pool, error) { |
| 241 | if !auth.IsAdmin(ctx) { |
nothing calls this directly
no test coverage detected