refactor: one place for Key Vault collections and paging in the providers
CI / Checks (pull_request) Successful in 38s
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 08:54:22 +02:00
1 parent b1eda53d5d
commit 05d507e7bd
9 files changed
+209 -212

No files matched your search

+11 -7
View File
@@ -70,13 +70,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
@@ -122,7 +119,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")
@@ -131,8 +132,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))
}
keys := make([]string, 0, len(v.tags))
for k := range v.tags {