Mounts: API, path validation and mountable engine types
Adds create/tune/delete for secrets engine mounts, the KV v2 settings that live on the mount, and an impact summary for deletes. Mount lists now carry description and explicit lease TTLs: sys/mounts/<path>/tune reports the effective value, which would pin the system default if it were saved back, so edits prefill from the list instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fd20caa525
commit
66aa86028a
6 files changed
+376
-5
No files matched your search
+26
-5
@@ -21,16 +21,37 @@ export interface Mount {
|
||||
type: string
|
||||
/** KV version ("1" | "2") when the engine is KV. */
|
||||
version?: string
|
||||
description?: string
|
||||
/**
|
||||
* Seconds explicitly set on this mount, 0 when it uses the system default. (sys/mounts/<path>/tune reports the
|
||||
* effective value instead, which would pin the default if it were saved back.)
|
||||
*/
|
||||
defaultLeaseTtl?: number
|
||||
maxLeaseTtl?: number
|
||||
}
|
||||
|
||||
/** Every secrets engine mount visible to the token, sorted by path. */
|
||||
export async function listMounts(c: BaoClient): Promise<Mount[]> {
|
||||
const res = await c.request<{ data: Record<string, { type: string; options?: { version?: string } | null }> }>(
|
||||
'GET',
|
||||
'sys/mounts',
|
||||
)
|
||||
const res = await c.request<{
|
||||
data: Record<
|
||||
string,
|
||||
{
|
||||
type: string
|
||||
description?: string
|
||||
options?: { version?: string } | null
|
||||
config?: { default_lease_ttl?: number; max_lease_ttl?: number }
|
||||
}
|
||||
>
|
||||
}>('GET', 'sys/mounts')
|
||||
return Object.entries(res.data)
|
||||
.map(([path, m]) => ({ path, type: m.type, version: m.options?.version }))
|
||||
.map(([path, m]) => ({
|
||||
path,
|
||||
type: m.type,
|
||||
version: m.options?.version,
|
||||
description: m.description,
|
||||
defaultLeaseTtl: m.config?.default_lease_ttl,
|
||||
maxLeaseTtl: m.config?.max_lease_ttl,
|
||||
}))
|
||||
.sort((a, b) => a.path.localeCompare(b.path))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user