MCPcopy Index your code
hub / github.com/cloudfoundry/java-buildpack / appdVCAPServices

Function appdVCAPServices

src/java/frameworks/app_dynamics_test.go:33–48  ·  view source on GitHub ↗

appdVCAPServices builds a VCAP_SERVICES JSON for an AppDynamics service. extraCreds is an optional comma-separated list of additional JSON key:value pairs.

(label, name string, tags []string, extraCreds string)

Source from the content-addressed store, hash-verified

31// appdVCAPServices builds a VCAP_SERVICES JSON for an AppDynamics service.
32// extraCreds is an optional comma-separated list of additional JSON key:value pairs.
33func appdVCAPServices(label, name string, tags []string, extraCreds string) string {
34 tagJSON := "[]"
35 if len(tags) > 0 {
36 parts := make([]string, len(tags))
37 for i, t := range tags {
38 parts[i] = fmt.Sprintf("%q", t)
39 }
40 tagJSON = "[" + joinAPPDStrings(parts) + "]"
41 }
42 creds := `"placeholder":"true"`
43 if extraCreds != "" {
44 creds += "," + extraCreds
45 }
46 return fmt.Sprintf(`{%q:[{"name":%q,"label":%q,"tags":%s,"credentials":{%s}}]}`,
47 label, name, label, tagJSON, creds)
48}
49
50func joinAPPDStrings(ss []string) string {
51 result := ""

Callers 1

Calls 1

joinAPPDStringsFunction · 0.85

Tested by

no test coverage detected