refactor: one place for Key Vault collections and paging in the providers
CI / Checks (pull_request) Successful in 40s
PR title / Conventional title (pull_request) Successful in 1s

- ObjectType.Collection names a type's segment in Key Vault URLs and links (secrets, keys, certificates), instead of four copies in ref, azure and fake.
- Azure lists through one pager helper instead of eight hand-written page loops; Value is VersionedValue without the version, rather than the two calling each other.
- Databricks' Key Vault fallback check lives in fallbackVault.
- The repo provider reads .lazysecrets.yaml in one place, builds plain and sops objects in one loop, and parses a file's sops metadata from the bytes Objects already read.
This commit is contained in:
keb committed 2026-10-15 10:40:41 +02:00
1 parent 6842c72662
commit 114478d2f2
9 files changed
+209 -212

No files matched your search

+11 -7
View File
@@ -71,13 +71,10 @@ func graphInfo(m map[string]any) vaultInfo {
// armInfo reads a vault's settings from the management API.
func armInfo(v *armkeyvault.Vault) vaultInfo {
info := vaultInfo{location: deref(v.Location), tags: map[string]string{}}
info := vaultInfo{location: deref(v.Location), tags: tags(v.Tags)}
if id, err := arm.ParseResourceID(deref(v.ID)); err == nil {
info.group = id.ResourceGroupName
}
for k, t := range v.Tags {
info.tags[k] = deref(t)
}
pr := v.Properties
if pr == nil {
return info
@@ -123,7 +120,11 @@ func (v vaultInfo) attrs() []provider.Attr {
} else {
add("soft delete", "off")
}
add("purge prot.", map[bool]string{true: "on", false: "off"}[on(v.purge, false)])
if on(v.purge, false) {
add("purge prot.", "on")
} else {
add("purge prot.", "off")
}
switch {
case strings.EqualFold(v.publicAccess, "disabled"):
add("network", "private endpoints only")
@@ -132,8 +133,11 @@ func (v vaultInfo) attrs() []provider.Attr {
default:
add("network", "all networks")
}
if v.endpoints > 0 {
add("private", fmt.Sprintf("%d endpoint%s", v.endpoints, map[bool]string{true: "s"}[v.endpoints > 1]))
switch {
case v.endpoints == 1:
add("private", "1 endpoint")
case v.endpoints > 1:
add("private", fmt.Sprintf("%d endpoints", v.endpoints))
}
for i, k := range slices.Sorted(maps.Keys(v.tags)) {
label := ""