github.com/observiq/carbon@v0.9.11-0.20200820160507-1b872e368a5e/operator/helper/namespace.go (about)

     1  package helper
     2  
     3  import "fmt"
     4  
     5  // CanNamespace will return a boolean indicating if an id can be namespaced.
     6  func CanNamespace(id string, exclusions []string) bool {
     7  	for _, key := range exclusions {
     8  		if key == id {
     9  			return false
    10  		}
    11  	}
    12  	return true
    13  }
    14  
    15  // AddNamespace will add a namespace to an id.
    16  func AddNamespace(id string, namespace string) string {
    17  	return fmt.Sprintf("%s.%s", namespace, id)
    18  }