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

Method CreateGithubEndpoint

runner/github_endpoints.go:27–50  ·  view source on GitHub ↗
(ctx context.Context, param params.CreateGithubEndpointParams)

Source from the content-addressed store, hash-verified

25)
26
27func (r *Runner) CreateGithubEndpoint(ctx context.Context, param params.CreateGithubEndpointParams) (params.ForgeEndpoint, error) {
28 if !auth.IsAdmin(ctx) {
29 return params.ForgeEndpoint{}, runnerErrors.ErrUnauthorized
30 }
31 if len(param.CACertBundle) > 0 {
32 // deduplicate before storing.
33 sanitized, err := util.SanitizeCABundle(param.CACertBundle)
34 if err != nil {
35 return params.ForgeEndpoint{}, fmt.Errorf("failed to sanitize CA bundle: %w", err)
36 }
37 param.CACertBundle = sanitized
38 }
39
40 if err := param.Validate(); err != nil {
41 return params.ForgeEndpoint{}, fmt.Errorf("error failed to validate github endpoint params: %w", err)
42 }
43
44 ep, err := r.store.CreateGithubEndpoint(ctx, param)
45 if err != nil {
46 return params.ForgeEndpoint{}, fmt.Errorf("failed to create github endpoint: %w", err)
47 }
48
49 return ep, nil
50}
51
52func (r *Runner) GetGithubEndpoint(ctx context.Context, name string) (params.ForgeEndpoint, error) {
53 if !auth.IsAdmin(ctx) {

Callers

nothing calls this directly

Calls 3

IsAdminFunction · 0.92
CreateGithubEndpointMethod · 0.65
ValidateMethod · 0.45

Tested by

no test coverage detected