Groovy web console

subscribe to the feed Subscribe
to this
site

Toto

Published 4 months ago by Toto
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
flexibility_config="""
{
    "flexibility_paas_version": {
        "3": "v7.15.30",
        "4": "v8.9.12",
        "5": "v9.6.3",
        "6": "v10.0.0"
    }
}
"""
def getPAASVersion(version) {
  def slurper = new groovy.json.JsonSlurperClassic()
  def flexJSONConfig = slurper.parseText(flexibility_config)
  if (flexJSONConfig && flexJSONConfig.flexibility_paas_version) {
    return flexJSONConfig.flexibility_paas_version[version]
  }
  return ""
}

System.out.println(getPAASVersion(null))
System.out.println(getPAASVersion(3))
System.out.println(getPAASVersion("3"))
System.out.println(getPAASVersion("4"))
System.out.println(getPAASVersion("5"))
System.out.println(getPAASVersion("6"))