Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetServiceMethodsByPolicyNames ¶
GetServiceMethodsByPolicyNames returns a map of service methods that have any of the given policy names. This function provides a convenient way to access pre-filtered lists of code-defined policies. It's intended for static, compile-time defined policies, not for dynamic, user-editable policies.
func RegisterPolicies ¶
func RegisterPolicies(policies []Policy)
RegisterPolicies is a public function called by generated code in init() functions. It appends a slice of policies to the global unifiedPolicies registry.
Types ¶
type Policy ¶
type Policy struct {
ServiceMethod string // gRPC full method name, e.g., "/user.v1.UserService/GetUser"
GatewayPath string // HTTP path and method, e.g., "GET:/api/v1/users/{id}"
Name string // The policy name/definition string from the proto annotation, e.g., "admin-only"
VersionID string // A hash representing the version of this policy definition
}
Policy holds all information for a single resource's policy. This struct is created by generated code and registered via init().
func RegisteredPolicies ¶
func RegisteredPolicies() []Policy
RegisteredPolicies returns a copy of all policy registrations. This is called once at application startup to sync policies to the database (the "Resource").