mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-06 16:16:26 +00:00
28 lines
743 B
Go
28 lines
743 B
Go
package tools
|
|
|
|
import "strings"
|
|
|
|
// resolveContainerArg returns the canonical container argument value.
|
|
// The returned bool is true when deprecated app_container was provided.
|
|
func resolveContainerArg(args map[string]interface{}) (string, bool) {
|
|
if value, ok := args["container"].(string); ok {
|
|
value = strings.TrimSpace(value)
|
|
if value != "" {
|
|
return value, false
|
|
}
|
|
}
|
|
if value, ok := args["app_container"].(string); ok {
|
|
if strings.TrimSpace(value) != "" {
|
|
return "", true
|
|
}
|
|
}
|
|
return "", false
|
|
}
|
|
|
|
// setContainerResponseFields includes canonical response fields.
|
|
func setContainerResponseFields(response map[string]interface{}, container string) {
|
|
if container == "" {
|
|
return
|
|
}
|
|
response["container"] = container
|
|
}
|