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

Method CreateGithubCredentials

runner/github_credentials.go:53–68  ·  view source on GitHub ↗
(ctx context.Context, param params.CreateGithubCredentialsParams)

Source from the content-addressed store, hash-verified

51}
52
53func (r *Runner) CreateGithubCredentials(ctx context.Context, param params.CreateGithubCredentialsParams) (params.ForgeCredentials, error) {
54 if !auth.IsAdmin(ctx) {
55 return params.ForgeCredentials{}, runnerErrors.ErrUnauthorized
56 }
57
58 if err := param.Validate(); err != nil {
59 return params.ForgeCredentials{}, fmt.Errorf("failed to validate github credentials params: %w", err)
60 }
61
62 creds, err := r.store.CreateGithubCredentials(ctx, param)
63 if err != nil {
64 return params.ForgeCredentials{}, fmt.Errorf("failed to create github credentials: %w", err)
65 }
66
67 return creds, nil
68}
69
70func (r *Runner) GetGithubCredentials(ctx context.Context, id uint) (params.ForgeCredentials, error) {
71 if !auth.IsAdmin(ctx) {

Callers

nothing calls this directly

Calls 3

IsAdminFunction · 0.92
ValidateMethod · 0.45

Tested by

no test coverage detected