mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-28 00:49:26 -05:00
19 lines
447 B
Go
19 lines
447 B
Go
|
package cloudprovider
|
||
|
|
||
|
import (
|
||
|
"github.com/edgelesssys/constellation/coordinator/core"
|
||
|
"github.com/edgelesssys/constellation/coordinator/role"
|
||
|
)
|
||
|
|
||
|
// ExtractRole extracts role from cloud provider metadata.
|
||
|
func ExtractRole(metadata map[string]string) role.Role {
|
||
|
switch metadata[core.RoleMetadataKey] {
|
||
|
case role.Coordinator.String():
|
||
|
return role.Coordinator
|
||
|
case role.Node.String():
|
||
|
return role.Node
|
||
|
default:
|
||
|
return role.Unknown
|
||
|
}
|
||
|
}
|