constellation/internal/cloud/gcp/role.go

26 lines
510 B
Go
Raw Normal View History

/*
Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
2022-06-28 10:08:05 -04:00
package gcp
import (
2022-09-21 07:47:57 -04:00
"github.com/edgelesssys/constellation/v2/internal/role"
2022-06-28 10:08:05 -04:00
)
const roleMetadataKey = "constellation-role"
// extractRole extracts role from cloud provider metadata.
func extractRole(metadata map[string]string) role.Role {
switch metadata[roleMetadataKey] {
case role.ControlPlane.String():
return role.ControlPlane
case role.Worker.String():
return role.Worker
2022-06-28 10:08:05 -04:00
default:
return role.Unknown
}
}