MCPcopy Create free account
hub / github.com/Scalingo/cli / doesDatabaseHandleUserManagement

Function doesDatabaseHandleUserManagement

db/users/utils.go:23–49  ·  view source on GitHub ↗
(ctx context.Context, app, addonUUID string)

Source from the content-addressed store, hash-verified

21)
22
23func doesDatabaseHandleUserManagement(ctx context.Context, app, addonUUID string) (bool, error) {
24 addonsClient, err := config.ScalingoClient(ctx)
25 if err != nil {
26 return false, errors.Wrap(ctx, err, "get Scalingo client")
27 }
28
29 isDB, err := utils.IsResourceDatabase(ctx, app)
30 if err != nil && !errors.Is(err, utils.ErrResourceNotFound) {
31 return false, errors.Wrap(ctx, err, "check if the resource is a database")
32 }
33 if isDB {
34 return true, nil
35 }
36
37 addon, err := addonsClient.AddonShow(ctx, app, addonUUID)
38 if err != nil {
39 return false, errors.Wrap(ctx, err, "get the addon to check user management support")
40 }
41
42 for _, supportedAddon := range SupportedAddons {
43 if strings.EqualFold(supportedAddon, addon.AddonProvider.Name) {
44 return true, nil
45 }
46 }
47
48 return false, nil
49}
50
51func askForPasswordWithRetry(ctx context.Context, remainingRetries int) (string, string, error) {
52 if remainingRetries <= 0 {

Callers 4

UpdateUserPasswordFunction · 0.85
DeleteUserFunction · 0.85
CreateUserFunction · 0.85
ListFunction · 0.85

Calls 2

ScalingoClientFunction · 0.92
IsResourceDatabaseFunction · 0.92

Tested by

no test coverage detected