(ctx context.Context, name string, param params.UpdateGithubEndpointParams)
| 75 | } |
| 76 | |
| 77 | func (r *Runner) UpdateGithubEndpoint(ctx context.Context, name string, param params.UpdateGithubEndpointParams) (params.ForgeEndpoint, error) { |
| 78 | if !auth.IsAdmin(ctx) { |
| 79 | return params.ForgeEndpoint{}, runnerErrors.ErrUnauthorized |
| 80 | } |
| 81 | |
| 82 | if len(param.CACertBundle) > 0 { |
| 83 | // deduplicate before storing. |
| 84 | sanitized, err := util.SanitizeCABundle(param.CACertBundle) |
| 85 | if err != nil { |
| 86 | return params.ForgeEndpoint{}, fmt.Errorf("failed to sanitize CA bundle: %w", err) |
| 87 | } |
| 88 | param.CACertBundle = sanitized |
| 89 | } |
| 90 | |
| 91 | if err := param.Validate(); err != nil { |
| 92 | return params.ForgeEndpoint{}, fmt.Errorf("failed to validate github endpoint params: %w", err) |
| 93 | } |
| 94 | |
| 95 | newEp, err := r.store.UpdateGithubEndpoint(ctx, name, param) |
| 96 | if err != nil { |
| 97 | return params.ForgeEndpoint{}, fmt.Errorf("failed to update github endpoint: %w", err) |
| 98 | } |
| 99 | return newEp, nil |
| 100 | } |
| 101 | |
| 102 | func (r *Runner) ListGithubEndpoints(ctx context.Context) ([]params.ForgeEndpoint, error) { |
| 103 | if !auth.IsAdmin(ctx) { |
nothing calls this directly
no test coverage detected