(ctx context.Context, app, email string, params scalingo.CollaboratorUpdateParams)
| 10 | ) |
| 11 | |
| 12 | func Update(ctx context.Context, app, email string, params scalingo.CollaboratorUpdateParams) error { |
| 13 | c, err := config.ScalingoClient(ctx) |
| 14 | if err != nil { |
| 15 | return errors.Wrap(ctx, err, "get Scalingo client") |
| 16 | } |
| 17 | |
| 18 | collaborator, err := getFromEmail(ctx, c, app, email) |
| 19 | if errors.Is(err, errNotFound) { |
| 20 | io.Error(email + " is not a collaborator of " + app + ".") |
| 21 | return nil |
| 22 | } else if err != nil { |
| 23 | return errors.Wrap(ctx, err, "get from email") |
| 24 | } |
| 25 | |
| 26 | collaborator, err = c.CollaboratorUpdate(ctx, app, collaborator.ID, params) |
| 27 | if err != nil { |
| 28 | return errors.Wrap(ctx, err, "update collaborator") |
| 29 | } |
| 30 | |
| 31 | io.Status(collaborator.Email, "role has been updated for", app) |
| 32 | return nil |
| 33 | } |
no test coverage detected