Documentation
¶
Index ¶
- Constants
- func DecodeMountFileName(encoded string) (string, error)
- func DenormalizeName(name string) string
- func NormalizeName(name string) string
- func ValidateCollectionName(collection string) bool
- func ValidateGroupName(group string) bool
- func ValidateMountFileName(encoded string) error
- func ValidateSecretName(secretName string) bool
Constants ¶
const ( // CollectionSecretDelimiter is the separator between collection and secret name in GSM CollectionSecretDelimiter = "__" // Encoding constants for special characters DotReplacementString = "--dot--" // UnderscorePrefix/Suffix for encoding consecutive underscores // __ → --uu--, ___ → --uuu--, etc. UnderscorePrefix = "--" UnderscoreSuffix = "--" CollectionRegex = "^([a-z0-9_-]*[a-z0-9])?$" GroupRegex = `^(--dot--)?[a-zA-Z0-9]+([a-zA-Z0-9_-]*[a-zA-Z0-9]+)?(/[a-zA-Z0-9]+([a-zA-Z0-9_-]*[a-zA-Z0-9]+)?)*$` SecretNameRegex = "^[A-Za-z0-9_-]+$" // MaxCollectionLength is the maximum length of a collection name MaxCollectionLength = 50 // GcpMaxNameLength is the maximum length for a GSM secret name GcpMaxNameLength = 255 )
Variables ¶
This section is empty.
Functions ¶
func DecodeMountFileName ¶
DecodeMountFileName decodes a GSM-encoded mount filename (field name or `as` alias) and validates it is safe to use as a CSI SecretProviderClass file name.
func DenormalizeName ¶
DenormalizeName decodes field names back to their original form. This reverses the encoding done by NormalizeName. Decodes in reverse order of NormalizeName.
func NormalizeName ¶
NormalizeName replaces forbidden characters in names with safe replacements. This is used when migrating from Vault to GSM to handle special characters. Rules (applied in order):
- `__` (2+ consecutive underscores) → `--uu--`, `--uuu--`, etc.
- `.` → `--dot--` (dots not allowed in GSM secret names)
Examples:
- ".dockerconfigjson" → "--dot--dockerconfigjson"
- "mac_ai__base_dir" → "mac_ai--uu--base_dir"
- "some___field" → "some--uuu--field"
- "field.with__both" → "field--dot--with--uu--both"
func ValidateCollectionName ¶
ValidateCollectionName validates a GSM collection name
func ValidateGroupName ¶
func ValidateMountFileName ¶
ValidateMountFileName validates a GSM-encoded mount filename without returning the decoded value.
func ValidateSecretName ¶
ValidateSecretName validates a GSM secret name
Types ¶
This section is empty.