Documentation
¶
Overview ¶
Package util provides utility functions for converting API group and resource names into normalized type names suitable for use in authorization systems.
This package is primarily designed for use with Fine-Grained Authorization (FGA) systems where consistent naming conventions are required for type definitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToTypeName ¶
ConvertToTypeName converts an API group and singular resource name into a normalized type name suitable for use in authorization systems.
Parameters:
- group: The API group name (e.g., "apps", "networking.k8s.io", "")
- singular: The singular form of the resource name (e.g., "deployment", "pod", "Service")
Returns:
A normalized type name string suitable for authorization system usage.
Examples:
ConvertToTypeName("apps", "deployment") → "apps_deployment" ConvertToTypeName("", "pod") → "core_pod" ConvertToTypeName("networking.k8s.io", "ingress") → "networking_k8s_io_ingress" ConvertToTypeName("Apps", "Deployment") → "apps_deployment"
The function handles edge cases gracefully:
- Empty group names default to "core"
- Very long names are truncated to respect maxRelationLength
- Special characters like dots are normalized to underscores
- Mixed case is normalized to lowercase
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.