forked from hashicorp/terraform-provider-azurerm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
web_app_fx_strings.go
50 lines (40 loc) · 1.06 KB
/
web_app_fx_strings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package helpers
import (
"strings"
)
func decodeApplicationStackLinux(fxString string) ApplicationStackLinux {
parts := strings.Split(fxString, "|")
result := ApplicationStackLinux{}
if len(parts) != 2 {
return result
}
switch parts[0] {
case "DOTNETCORE", "DOTNET":
result.NetFrameworkVersion = parts[1]
case "NODE":
result.NodeVersion = parts[1]
case "JAVA", "TOMCAT", "JBOSSEAP":
result.JavaServer = parts[0]
javaParts := strings.Split(parts[1], "-")
if len(javaParts) == 2 {
// e.g. 8-jre8
result.JavaServerVersion = javaParts[0]
result.JavaVersion = javaParts[1]
} else {
// e.g. 8u242 or 11.0.9
result.JavaVersion = parts[1]
}
case "PHP":
result.PhpVersion = parts[1]
case "PYTHON":
result.PythonVersion = parts[1]
case "RUBY":
result.RubyVersion = parts[1]
default: // DOCKER is the expected default here as "custom" images require it
if dockerParts := strings.Split(parts[1], ":"); len(dockerParts) == 2 {
result.DockerImage = dockerParts[0]
result.DockerImageTag = dockerParts[1]
}
}
return result
}