Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
715 B

package intention
import (
"github.com/hashicorp/consul/api"
)
// FormatSource returns the namespace/name format for the source. This is
// different from (*api.Intention).SourceString in that the default namespace
// is not omitted.
func FormatSource(i *api.Intention) string {
return partString(i.SourceNS, i.SourceName)
}
// FormatDestination returns the namespace/name format for the destination.
// This is different from (*api.Intention).DestinationString in that the
// default namespace is not omitted.
func FormatDestination(i *api.Intention) string {
return partString(i.DestinationNS, i.DestinationName)
}
func partString(ns, n string) string {
if ns == "" {
return n
}
return ns + "/" + n
}