2016-09-07 19:00:30 -07:00
|
|
|
package googlecompute
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
2020-03-30 15:05:16 +02:00
|
|
|
|
|
|
|
|
compute "google.golang.org/api/compute/v1"
|
2016-09-07 19:00:30 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Image struct {
|
2020-03-30 15:05:16 +02:00
|
|
|
GuestOsFeatures []*compute.GuestOsFeature
|
|
|
|
|
Labels map[string]string
|
|
|
|
|
Licenses []string
|
|
|
|
|
Name string
|
|
|
|
|
ProjectId string
|
|
|
|
|
SelfLink string
|
|
|
|
|
SizeGb int64
|
2016-09-07 19:00:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (i *Image) IsWindows() bool {
|
|
|
|
|
for _, license := range i.Licenses {
|
|
|
|
|
if strings.Contains(license, "windows") {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
2020-03-30 15:05:16 +02:00
|
|
|
|
|
|
|
|
func (i *Image) IsSecureBootCompatible() bool {
|
|
|
|
|
for _, osFeature := range i.GuestOsFeatures {
|
2020-06-10 16:21:11 +02:00
|
|
|
if osFeature.Type == "UEFI_COMPATIBLE" {
|
2020-03-30 15:05:16 +02:00
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|