github.com/cilium/cilium@v1.16.2/pkg/policy/api/l7.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package api
     5  
     6  import (
     7  	"fmt"
     8  )
     9  
    10  // PortRuleL7 is a list of key-value pairs interpreted by a L7 protocol as
    11  // protocol constraints. All fields are optional, if all fields are empty or
    12  // missing, the rule does not have any effect.
    13  type PortRuleL7 map[string]string
    14  
    15  // Sanitize sanitizes key-value pair rules. It makes sure keys are present.
    16  func (rule *PortRuleL7) Sanitize() error {
    17  	for k := range *rule {
    18  		if k == "" {
    19  			return fmt.Errorf("Empty key not allowed")
    20  		}
    21  	}
    22  	return nil
    23  }