MCPcopy Create free account
hub / github.com/cloudfoundry/multiapps-cli-plugin / BuildUserAgent

Function BuildUserAgent

util/user_agent_builder.go:43–56  ·  view source on GitHub ↗

BuildUserAgent creates a User-Agent string in the format: "Multiapps-CF-plugin/{version} ({operating system version}) {golang builder version} {custom_env_value}"

()

Source from the content-addressed store, hash-verified

41// BuildUserAgent creates a User-Agent string in the format:
42// "Multiapps-CF-plugin/{version} ({operating system version}) {golang builder version} {custom_env_value}"
43func BuildUserAgent() string {
44 osInformation := getOperatingSystemInformation()
45 goVersion := runtime.Version()
46 cfCliVersion := GetCfCliVersion()
47 customValue := getCustomEnvValue()
48
49 userAgent := fmt.Sprintf("Multiapps-CF-plugin/%s (%s) %s (%s)", pluginVersion, osInformation, goVersion, cfCliVersion)
50
51 if customValue != "" {
52 userAgent = fmt.Sprintf("%s %s", userAgent, customValue)
53 }
54
55 return userAgent
56}
57
58// getOperatingSystemInformation returns OS name and architecture
59func getOperatingSystemInformation() string {

Callers 2

NewUserAgentTransportFunction · 0.92

Calls 3

GetCfCliVersionFunction · 0.85
getCustomEnvValueFunction · 0.85

Tested by

no test coverage detected