MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / dummyValueForConfigKey

Function dummyValueForConfigKey

cmd/pulumi.go:1451–1479  ·  view source on GitHub ↗

dummyValueForConfigKey returns a reasonable dummy value for a non-pricing config key. For keys that look like they expect a number, returns "1". For keys that look like secrets/passwords, returns a long-enough string. For keys that look like names/usernames, returns "dummy". Otherwise returns "dummy

(key string)

Source from the content-addressed store, hash-verified

1449// For keys that look like names/usernames, returns "dummy".
1450// Otherwise returns "dummy".
1451func dummyValueForConfigKey(key string) string {
1452 lower := strings.ToLower(key)
1453
1454 // Numeric-looking keys
1455 numericHints := []string{"size", "count", "number", "num", "port", "desired", "min", "max", "replicas", "capacity"}
1456 for _, hint := range numericHints {
1457 if strings.Contains(lower, hint) {
1458 return "1"
1459 }
1460 }
1461
1462 // Secret/password/key-looking keys — some programs validate minimum length
1463 secretHints := []string{"password", "secret", "token", "key", "credential"}
1464 for _, hint := range secretHints {
1465 if strings.Contains(lower, hint) {
1466 return "dummySecret01234567890123456789012345678901234567890"
1467 }
1468 }
1469
1470 // Name/username-looking keys
1471 nameHints := []string{"name", "user", "email", "admin", "owner", "account"}
1472 for _, hint := range nameHints {
1473 if strings.Contains(lower, hint) {
1474 return "dummy"
1475 }
1476 }
1477
1478 return "dummy"
1479}
1480
1481// parseUsageFlags parses --usage name=quantity flags into a map.
1482// Each entry must be in the form "resource-name=number", e.g. "my-api=5000000".

Callers 1

runPulumiEstimateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected