Skip to content

Commit ca287db

Browse files
committed
getarch helper
1 parent 0bf97b5 commit ca287db

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

v1/instancetype.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ const (
2222
ManufacturerUnknown Manufacturer = "unknown"
2323
)
2424

25-
type Architecture string
26-
27-
const (
28-
ArchitectureX86_64 Architecture = "x86_64"
29-
ArchitectureARM64 Architecture = "arm64"
30-
)
31-
3225
func GetManufacturer(manufacturer string) Manufacturer {
3326
switch strings.ToLower(manufacturer) {
3427
case "nvidia":
@@ -40,6 +33,25 @@ func GetManufacturer(manufacturer string) Manufacturer {
4033
}
4134
}
4235

36+
type Architecture string
37+
38+
const (
39+
ArchitectureX86_64 Architecture = "x86_64"
40+
ArchitectureARM64 Architecture = "arm64"
41+
ArchitectureUnknown Architecture = "unknown"
42+
)
43+
44+
func GetArchitecture(architecture string) Architecture {
45+
switch strings.ToLower(architecture) {
46+
case "x86_64":
47+
return ArchitectureX86_64
48+
case "arm64":
49+
return ArchitectureARM64
50+
default:
51+
return ArchitectureUnknown
52+
}
53+
}
54+
4355
type InstanceTypeID string
4456

4557
type InstanceType struct {

0 commit comments

Comments
 (0)