1 package agent 2 3 import ( 4 "github.com/datawire/ambassador/v2/pkg/api/agent" 5 snapshotTypes "github.com/datawire/ambassador/v2/pkg/snapshot/v1" 6 ) 7 8 // GetIdentity returns the Agent's DCP Identity, if present, enabled, and 9 // configured by the user. 10 func GetIdentity(ambassadorMeta *snapshotTypes.AmbassadorMetaInfo, ambHost string) *agent.Identity { 11 if ambassadorMeta == nil || ambassadorMeta.ClusterID == "" { 12 // No Ambassador module -> no identity -> no reporting 13 return nil 14 } 15 16 return &agent.Identity{ 17 ClusterId: ambassadorMeta.ClusterID, 18 Hostname: ambHost, 19 } 20 } 21