(ctx context.Context, client *scalingo.Client, app, addon, feature string)
| 55 | } |
| 56 | |
| 57 | func waitFeatureUntilActivated(ctx context.Context, client *scalingo.Client, app, addon, feature string) error { |
| 58 | ticker := time.NewTicker(3 * time.Second) |
| 59 | defer ticker.Stop() |
| 60 | for range ticker.C { |
| 61 | db, err := client.DatabaseShow(ctx, app, addon) |
| 62 | if err != nil { |
| 63 | return errors.Wrapf(ctx, err, "fail to refresh database metadata") |
| 64 | } |
| 65 | for _, f := range db.Features { |
| 66 | if f.Name == feature && f.Status != scalingo.DatabaseFeatureStatusPending { |
| 67 | switch f.Status { |
| 68 | case scalingo.DatabaseFeatureStatusActivated: |
| 69 | io.Statusf("Feature %v has been activated\n", feature) |
| 70 | return nil |
| 71 | case scalingo.DatabaseFeatureStatusFailed: |
| 72 | io.Warningf("Feature %v failed to get activated, please contact our support\n", feature) |
| 73 | return nil |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | // DisableFeature is the command handler to disable a database feature on a |
| 82 | // database addon like 'force-ssl' or 'public-availability' |
no test coverage detected