mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04: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
|
||
|
}
|
||
|
}
|