feat: add provider profile removal

This commit is contained in:
Codex
2026-06-08 05:29:11 +08:00
parent 509c2aa6fd
commit 601d8190d0
8 changed files with 121 additions and 12 deletions
+7
View File
@@ -42,6 +42,7 @@ async function dispatch(args: ParsedArgs): Promise<JsonValue> {
if (group === "provider-profiles" && command === "list") return client(args).get("/api/v1/provider-profiles");
if (group === "provider-profiles" && command === "show" && id) return client(args).get(`/api/v1/provider-profiles/${encodeURIComponent(normalizeProfile(id))}`);
if (group === "provider-profiles" && command === "config" && id) return client(args).get(`/api/v1/provider-profiles/${encodeURIComponent(normalizeProfile(id))}/config`);
if (group === "provider-profiles" && (command === "remove" || command === "delete" || command === "rm") && id) return removeProviderProfileCli(id, args);
if (group === "provider-profiles" && command === "set-key" && id) return setProviderProfileKey(args, id);
if (group === "provider-profiles" && command === "set-config" && id) return setProviderProfileConfig(args, id);
if (group === "provider-profiles" && command === "validate" && id) return validateProviderProfileCli(args, id);
@@ -438,6 +439,11 @@ async function setProviderProfileConfig(args: ParsedArgs, profileValue: string):
}) as JsonRecord;
}
async function removeProviderProfileCli(profileValue: string, args: ParsedArgs): Promise<JsonRecord> {
const profile = normalizeProfile(profileValue);
return await client(args).delete(`/api/v1/provider-profiles/${encodeURIComponent(profile)}`) as JsonRecord;
}
async function validateProviderProfileCli(args: ParsedArgs, profileValue: string): Promise<JsonRecord> {
const profile = normalizeProfile(profileValue);
const started = await client(args).post(`/api/v1/provider-profiles/${encodeURIComponent(profile)}/validate`, {}) as JsonRecord;
@@ -790,6 +796,7 @@ function help(): JsonRecord {
"provider-profiles list",
"provider-profiles show <profile>",
"provider-profiles config <profile>",
"provider-profiles remove <profile>",
"provider-profiles set-key <profile> --key-stdin [--model <model>] [--base-url <url>]",
"provider-profiles set-config <profile> --config-stdin",
"provider-profiles validate <profile> [--wait] [--timeout-ms <ms>]",
+1 -1
View File
@@ -367,7 +367,7 @@ metadata:
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "get", "list", "patch", "update"]
verbs: ["create", "delete", "get", "list", "patch", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding