(apiVersion string, ui UI)
| 34 | } |
| 35 | |
| 36 | func WarnIfAPIVersionBelowSupportedMinimum(apiVersion string, ui UI) error { |
| 37 | isOutdated, err := CheckVersionOutdated(apiVersion, ccversion.MinSupportedV2ClientVersion) |
| 38 | if err != nil { |
| 39 | return err |
| 40 | } |
| 41 | |
| 42 | if isOutdated { |
| 43 | ui.DisplayWarning("Your CF API version ({{.APIVersion}}) is no longer supported. "+ |
| 44 | "Upgrade to a newer version of the API (minimum version {{.MinSupportedVersion}}). Please refer to "+ |
| 45 | "https://github.com/cloudfoundry/cli/wiki/Versioning-Policy#cf-cli-minimum-supported-version", |
| 46 | map[string]interface{}{ |
| 47 | "APIVersion": apiVersion, |
| 48 | "MinSupportedVersion": ccversion.MinSupportedV2ClientVersion, |
| 49 | }) |
| 50 | } |
| 51 | |
| 52 | return nil |
| 53 | } |
| 54 | |
| 55 | func CheckVersionOutdated(current string, minimum string) (bool, error) { |
| 56 | if current == version.DefaultVersion || minimum == "" { |
no test coverage detected