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

Method UpdateGithubEndpoint

runner/github_endpoints.go:77–100  ·  view source on GitHub ↗
(ctx context.Context, name string, param params.UpdateGithubEndpointParams)

Source from the content-addressed store, hash-verified

75}
76
77func (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
102func (r *Runner) ListGithubEndpoints(ctx context.Context) ([]params.ForgeEndpoint, error) {
103 if !auth.IsAdmin(ctx) {

Callers

nothing calls this directly

Calls 3

IsAdminFunction · 0.92
UpdateGithubEndpointMethod · 0.65
ValidateMethod · 0.45

Tested by

no test coverage detected