Svetlin 49bf9c9d37
[gcp] Fixup for the deprecated Secure Boot guest OS feature (#9371)
GCP informed us that the GuestOsFeature SECURE_BOOT is deprecated and
that they are using UEFI_COMPATIBLE instead. This means, using an image
with 'UEFI_COMPATIBLE' guest OS feature confirms the 'secureBoot'
feature compatibility.
2020-06-10 16:21:11 +02:00

36 lines
645 B
Go

package googlecompute
import (
"strings"
compute "google.golang.org/api/compute/v1"
)
type Image struct {
GuestOsFeatures []*compute.GuestOsFeature
Labels map[string]string
Licenses []string
Name string
ProjectId string
SelfLink string
SizeGb int64
}
func (i *Image) IsWindows() bool {
for _, license := range i.Licenses {
if strings.Contains(license, "windows") {
return true
}
}
return false
}
func (i *Image) IsSecureBootCompatible() bool {
for _, osFeature := range i.GuestOsFeatures {
if osFeature.Type == "UEFI_COMPATIBLE" {
return true
}
}
return false
}