(ctx context.Context, app string, params scalingo.SCMRepoLinkUpdateParams)
| 11 | ) |
| 12 | |
| 13 | func Update(ctx context.Context, app string, params scalingo.SCMRepoLinkUpdateParams) error { |
| 14 | if app == "" { |
| 15 | return errors.New(ctx, "no app defined") |
| 16 | } |
| 17 | |
| 18 | c, err := config.ScalingoClient(ctx) |
| 19 | if err != nil { |
| 20 | return errors.Wrapf(ctx, err, "fail to get Scalingo client") |
| 21 | } |
| 22 | |
| 23 | _, err = c.SCMRepoLinkUpdate(ctx, app, params) |
| 24 | if err != nil { |
| 25 | if !utils.IsPaymentRequiredAndFreeTrialExceededError(err) { |
| 26 | return errors.Wrapf(ctx, err, "fail to update integration link") |
| 27 | } |
| 28 | |
| 29 | return utils.AskAndStopFreeTrial(ctx, c, func() error { |
| 30 | return Update(ctx, app, params) |
| 31 | }) |
| 32 | } |
| 33 | |
| 34 | io.Statusf("Your app '%s' integration link has been updated.\n", app) |
| 35 | return nil |
| 36 | } |
no test coverage detected