From aef7cf2efa90c1e0db3dff24b065dc7314d5acaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A0=CF=85=CE=B1=CE=B7=20=D7=A0=CF=85=CE=B1=CE=B7=D1=95?= =?UTF-8?q?=CF=83=CE=B7?= Date: Fri, 27 Nov 2026 16:51:19 -0800 Subject: [PATCH] fix(secret): add create; update of absent is 404 CONTRIBUTING says one endpoint does not both create and update, a POST creates with the name in the body, and an update of a thing that is absent is an error. file update and secret update both created. - PUT /api/file/{name} of a name that is not there is 404. file upload is the create. The same content answers changed false, never 201. - POST /api/secret/{vault} with {key, value} (osapi client secret create, SDK Secret.Create) makes a key as version 1: 201 with a Location header. Create on an existing key always conflicts: 409, from the list of the vault's keys. - PUT /api/secret/{vault}/{key} of a key that is not there is 404. - Location takes several fields, joined by / and escaped, so the secret's is /api/secret/{vault}/{key}. The DSL term and dslcheck say so. - The UI writes a key in the list with PUT and a new key with POST. - The integration scenario and the audit test write with create. The generated CLI, pages, SDK, UI client, catalog and contract golden are regenerated. The secrets page and the agent skills say create. Closes #1666 Co-Authored-By: Claude Opus 5.5 --- .../docs/gen/api/get-catalog.StatusCodes.json | 2 +- docs/docs/gen/api/get-catalog.api.mdx | 2 +- .../gen/api/post-secret.ParamsDetails.json | 1 + .../gen/api/post-secret.RequestSchema.json | 1 + .../docs/gen/api/post-secret.StatusCodes.json | 1 + docs/docs/gen/api/post-secret.api.mdx | 69 ++++++ .../gen/api/put-file-by-name.StatusCodes.json | 2 +- docs/docs/gen/api/put-file-by-name.api.mdx | 6 +- docs/docs/gen/api/put-secret.StatusCodes.json | 2 +- docs/docs/gen/api/put-secret.api.mdx | 12 +- docs/docs/gen/api/sidebar.ts | 9 +- docs/docs/sidebar/development/dsl/endpoint.md | 8 +- docs/docs/sidebar/operate/secure/secrets.md | 17 +- docs/docs/sidebar/reference/cli/_catalog.mdx | 7 +- .../sidebar/reference/endpoints/_catalog.mdx | 2 +- .../reference/endpoints/secrets/secret.md | 6 +- docs/docs/sidebar/sdk/fleet/catalog.md | 14 +- docs/docs/sidebar/sdk/objectstore/file.md | 3 +- docs/docs/sidebar/sdk/secrets/secret.md | 47 +++- .../sidebar/usage/cli/client/file/update.md | 5 +- .../sidebar/usage/cli/client/secret/create.md | 72 ++++++ .../sidebar/usage/cli/client/secret/update.md | 6 +- examples/sdk/client/secret.go | 18 ++ internal/apicontract/testdata/joined.golden | 7 +- internal/controller/api/gen/api.yaml | 134 +++++++++-- internal/controller/endpoint/endpoint.go | 17 +- .../endpoint/endpoint_public_test.go | 2 +- internal/controller/endpoint/openapi.go | 2 +- internal/controller/endpoint/server/server.go | 10 +- .../endpoint/server/server_public_test.go | 27 +++ internal/controller/endpoint/spec.go | 6 +- .../controller/endpoint/spec_public_test.go | 2 +- internal/controller/endpoint/validate.go | 8 +- .../controller/endpoints/catalog/gen/api.yaml | 1 + internal/controller/endpoints/file/file.go | 22 +- .../controller/endpoints/file/gen/api.yaml | 21 +- internal/controller/endpoints/file/gen/cli.go | 2 +- internal/controller/endpoints/file/methods.go | 19 +- .../endpoints/file/methods_public_test.go | 40 ++- .../controller/endpoints/secret/gen/api.go | 6 + .../controller/endpoints/secret/gen/api.yaml | 112 ++++++++- .../controller/endpoints/secret/gen/cli.go | 35 ++- .../controller/endpoints/secret/gen/decode.go | 18 ++ .../controller/endpoints/secret/methods.go | 45 +++- .../endpoints/secret/methods_public_test.go | 227 +++++++++++++++--- .../controller/endpoints/secret/samples.go | 17 ++ .../controller/endpoints/secret/secret.go | 51 +++- internal/controller/endpoints/secret/types.go | 22 +- internal/dslcheck/testdata/strings.txt | 2 +- .../osapi-operations/references/fleet.md | 3 +- .../skills/resources/skills/osapi/SKILL.md | 5 +- pkg/sdk/client/catalog_types.gen.go | 1 + pkg/sdk/client/file_upload.go | 4 +- pkg/sdk/client/secret.gen.go | 35 ++- pkg/sdk/client/spec.gen.go | 10 +- test/integration/authz_allow_test.go | 16 +- test/integration/scenarios_test.go | 2 +- ui/src/pages/secrets.tsx | 11 +- .../file-management-api-file-operations.ts | 16 +- ui/src/sdk/gen/schemas/index.ts | 1 + ui/src/sdk/gen/schemas/operationID.ts | 1 + ui/src/sdk/gen/schemas/secretCreateRequest.ts | 20 ++ ...secret-management-api-secret-operations.ts | 74 +++++- 63 files changed, 1156 insertions(+), 210 deletions(-) create mode 100644 docs/docs/gen/api/post-secret.ParamsDetails.json create mode 100644 docs/docs/gen/api/post-secret.RequestSchema.json create mode 100644 docs/docs/gen/api/post-secret.StatusCodes.json create mode 100644 docs/docs/gen/api/post-secret.api.mdx create mode 100644 docs/docs/sidebar/usage/cli/client/secret/create.md create mode 100644 ui/src/sdk/gen/schemas/secretCreateRequest.ts diff --git a/docs/docs/gen/api/get-catalog.StatusCodes.json b/docs/docs/gen/api/get-catalog.StatusCodes.json index 63b7fa528c..ee2fab39d7 100644 --- a/docs/docs/gen/api/get-catalog.StatusCodes.json +++ b/docs/docs/gen/api/get-catalog.StatusCodes.json @@ -1 +1 @@ -{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"areas":{"description":"Each area, in order, with its label.","items":{"properties":{"label":{"description":"The label of the area.","example":"Networking","type":"string"},"name":{"description":"The name of the area.","example":"networking","type":"string"}},"required":["name","label"],"type":"object","title":"CatalogArea"},"type":"array"},"behaviors":{"description":"Each behavior that the API serves, and each internal behavior, in the order of the registry.","items":{"properties":{"area":{"description":"The area of the behavior, or empty for an internal behavior.","example":"networking","type":"string"},"chain":{"description":"The chain of the behavior, as osapi dsl chain list prints it.","type":"string"},"doc":{"description":"What the behavior manages.","type":"string"},"internal":{"description":"Only other behaviors call it: it has no route.","type":"boolean"},"methods":{"description":"The methods of the behavior.","items":{"properties":{"calls":{"description":"The calls that the examples of the method make to other behaviors.","items":{"properties":{"behavior":{"description":"The behavior that is called.","example":"package","type":"string"},"calls":{"description":"The calls that the call makes.","items":"circular(CatalogCall)","type":"array"},"method":{"description":"The method that is called.","example":"get","type":"string"}},"required":["behavior","method"],"type":"object","title":"CatalogCall"},"type":"array"},"columns":{"description":"The fields of the rows that the method answers, as the CLI's output reads them.","items":{"properties":{"columns":{"description":"The columns of an object, or of a list of objects.","items":"circular(CatalogColumn)","type":"array"},"doc":{"description":"What the field is.","type":"string"},"kind":{"description":"ColumnKind is what a field of an answer holds.","enum":["value","values","object","list"],"type":"string","title":"ColumnKind"},"label":{"description":"The label of the field.","example":"Total","type":"string"},"name":{"description":"The json name of the field.","example":"total","type":"string"},"render":{"description":"The render tag of the field, such as bytes.","example":"bytes","type":"string"}},"required":["name","label","doc","kind"],"type":"object","title":"CatalogColumn"},"type":"array"},"disruption":{"description":"What the method interrupts.","type":"string"},"disruptive":{"description":"The method can interrupt a host, such as a reboot.","type":"boolean"},"doc":{"description":"What the method does.","type":"string"},"examples":{"description":"The examples of the method.","items":{"properties":{"doc":{"description":"What the example does.","type":"string"},"input":{"description":"The input of the example."},"output":{"description":"The output of the example."}},"required":["doc","input"],"type":"object","title":"CatalogExample"},"type":"array"},"fields":{"description":"The fields of the input.","items":{"properties":{"doc":{"description":"What the field is.","type":"string"},"in":{"description":"FieldIn is where a field of a request goes.","enum":["path","query","body"],"type":"string","title":"FieldIn"},"kind":{"description":"FieldKind is how a form takes the value of a field.","enum":["string","number","bool","list","object"],"type":"string","title":"FieldKind"},"name":{"description":"The json name of the field.","example":"servers","type":"string"},"options":{"description":"The values that the field takes: those of its type with enum, or of its oneof rule.","items":{"type":"string"},"type":"array"},"required":{"description":"The request needs the field.","type":"boolean"},"secret":{"description":"The field is a secret.","type":"boolean"}},"required":["name","in","kind","required","doc"],"type":"object","title":"CatalogField"},"type":"array"},"http_method":{"description":"The HTTP method of the route. An internal behavior has no route.","example":"PUT","type":"string"},"input":{"description":"The input type and its fields, a required one marked *.","type":"string"},"kind":{"description":"What a method does to a host, by the verb of its permission: read, write or action.","enum":["read","write","action"],"type":"string","title":"MethodKind"},"long":{"description":"The rest of what the method does.","type":"string"},"name":{"description":"The name of the method.","example":"update","type":"string"},"output":{"description":"The output type and its fields.","type":"string"},"path":{"description":"The path of the route.","type":"string"},"permission":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"},"platforms":{"description":"The platforms that the method runs on: those that its On limits it to, else each platform of the behavior.","items":{"type":"string"},"type":"array"},"runs_on":{"description":"The host platforms that the method runs on, as the agent decides, and * for a Linux host whose platform gohai has no family for.","items":{"type":"string"},"type":"array"}},"required":["name","kind","doc","platforms","runs_on","input","output","fields","columns","calls","examples"],"type":"object","title":"CatalogMethod"},"type":"array"},"name":{"description":"The name of the behavior.","example":"dns","type":"string"},"parent":{"description":"The behavior that the behavior is under, such as user for sshkey.","type":"string"},"platforms":{"description":"The platforms of the providers of the behavior.","items":{"type":"string"},"type":"array"},"title":{"description":"The title of the behavior.","example":"DNS","type":"string"},"used_by":{"description":"The behaviors that call the behavior.","items":{"type":"string"},"type":"array"},"uses":{"description":"The behaviors that the behavior calls.","items":{"type":"string"},"type":"array"}},"required":["name","title","area","doc","internal","platforms","uses","used_by","chain","methods"],"type":"object","title":"CatalogBehavior"},"type":"array"},"controller":{"description":"Each method of an endpoint group of the Object Store area: a call of the controller that takes no target.","items":{"properties":{"doc":{"description":"What the method does, in one line.","type":"string"},"group":{"description":"The endpoint group.","example":"file","type":"string"},"method":{"description":"The method.","example":"list","type":"string"},"operation":{"description":"An operationId of an operation that needs a permission.","enum":["AdmitMachine","DeleteFileByName","DeleteJobByID","DeleteMachine","DeleteNodeCertificate","DeleteNodeDns","DeleteNodeDocker","DeleteNodeFile","DeleteNodeGroup","DeleteNodeImage","DeleteNodeInterface","DeleteNodeInterfaceRoute","DeleteNodeNtp","DeleteNodePackage","DeleteNodeSchedule","DeleteNodeService","DeleteNodeSysctl","DeleteNodeUser","DeleteNodeUserSshkey","DeleteSecret","DrainAgent","GetAdmission","GetAdmissions","GetAgentConfig","GetAgentDetails","GetAgentFacts","GetAgents","GetAuditExport","GetAuditLogByID","GetAuditLogs","GetCatalog","GetFileByName","GetFileStale","GetFiles","GetHealthStatus","GetJobByID","GetJobs","GetNodeCertificate","GetNodeCertificateByKey","GetNodeDisk","GetNodeDnsByKey","GetNodeDocker","GetNodeDockerByKey","GetNodeFile","GetNodeGroup","GetNodeGroupByKey","GetNodeHostname","GetNodeImage","GetNodeInterface","GetNodeInterfaceByKey","GetNodeInterfaceRoute","GetNodeLoad","GetNodeLog","GetNodeLogSource","GetNodeMemory","GetNodeNtp","GetNodeOs","GetNodePackage","GetNodePackageByKey","GetNodePackageUpdates","GetNodeProcess","GetNodeProcessByKey","GetNodeSchedule","GetNodeScheduleByKey","GetNodeService","GetNodeServiceByKey","GetNodeStatus","GetNodeSysctl","GetNodeSysctlByKey","GetNodeTimezone","GetNodeUptime","GetNodeUser","GetNodeUserByKey","GetNodeUserSshkey","GetPKICert","GetPKIKeyRotation","GetPKINATSCertRotation","GetSecret","GetSecretValue","GetSecretVaults","GetSecrets","GetTrace","ListDeadLetters","ListPKICerts","PostFile","PostNodeCertificate","PostNodeCommandExec","PostNodeCommandShell","PostNodeConnectivityPing","PostNodeDocker","PostNodeDockerExec","PostNodeDockerStart","PostNodeDockerStop","PostNodeGroup","PostNodeImagePull","PostNodeInterface","PostNodeInterfaceRoute","PostNodeNtp","PostNodePackage","PostNodePowerReboot","PostNodePowerShutdown","PostNodeProcessSignal","PostNodeSchedule","PostNodeService","PostNodeServiceDisable","PostNodeServiceEnable","PostNodeServiceRestart","PostNodeServiceStart","PostNodeServiceStop","PostNodeSysctl","PostNodeUser","PostNodeUserSshkey","PutAgentConfig","PutFileByName","PutNodeCertificate","PutNodeDns","PutNodeFile","PutNodeGroup","PutNodeHostname","PutNodeInterface","PutNodeInterfaceRoute","PutNodeNtp","PutNodePackageUpdates","PutNodeSchedule","PutNodeService","PutNodeSysctl","PutNodeTimezone","PutNodeUser","PutNodeUserPassword","PutSecret","RejectMachine","RetryJobByID","RevokeMachine","RotatePKIKey","RotatePKINATSCert","UndrainAgent"],"type":"string","title":"OperationID"},"permission":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"}},"required":["group","method","doc","operation","permission"],"type":"object","title":"CatalogControllerMethod"},"type":"array"},"count_tones":{"additionalProperties":{"type":"string"},"description":"The tone of a count above zero, by what it counts: ok, warn or err.","type":"object"},"host_families":{"description":"The host platforms that gohai names. A method's runs_on has * for any other Linux.","items":{"type":"string"},"type":"array"},"operations":{"description":"The permission of each operation that needs one, in the order of the operationIds.","items":{"properties":{"id":{"description":"An operationId of an operation that needs a permission.","enum":["AdmitMachine","DeleteFileByName","DeleteJobByID","DeleteMachine","DeleteNodeCertificate","DeleteNodeDns","DeleteNodeDocker","DeleteNodeFile","DeleteNodeGroup","DeleteNodeImage","DeleteNodeInterface","DeleteNodeInterfaceRoute","DeleteNodeNtp","DeleteNodePackage","DeleteNodeSchedule","DeleteNodeService","DeleteNodeSysctl","DeleteNodeUser","DeleteNodeUserSshkey","DeleteSecret","DrainAgent","GetAdmission","GetAdmissions","GetAgentConfig","GetAgentDetails","GetAgentFacts","GetAgents","GetAuditExport","GetAuditLogByID","GetAuditLogs","GetCatalog","GetFileByName","GetFileStale","GetFiles","GetHealthStatus","GetJobByID","GetJobs","GetNodeCertificate","GetNodeCertificateByKey","GetNodeDisk","GetNodeDnsByKey","GetNodeDocker","GetNodeDockerByKey","GetNodeFile","GetNodeGroup","GetNodeGroupByKey","GetNodeHostname","GetNodeImage","GetNodeInterface","GetNodeInterfaceByKey","GetNodeInterfaceRoute","GetNodeLoad","GetNodeLog","GetNodeLogSource","GetNodeMemory","GetNodeNtp","GetNodeOs","GetNodePackage","GetNodePackageByKey","GetNodePackageUpdates","GetNodeProcess","GetNodeProcessByKey","GetNodeSchedule","GetNodeScheduleByKey","GetNodeService","GetNodeServiceByKey","GetNodeStatus","GetNodeSysctl","GetNodeSysctlByKey","GetNodeTimezone","GetNodeUptime","GetNodeUser","GetNodeUserByKey","GetNodeUserSshkey","GetPKICert","GetPKIKeyRotation","GetPKINATSCertRotation","GetSecret","GetSecretValue","GetSecretVaults","GetSecrets","GetTrace","ListDeadLetters","ListPKICerts","PostFile","PostNodeCertificate","PostNodeCommandExec","PostNodeCommandShell","PostNodeConnectivityPing","PostNodeDocker","PostNodeDockerExec","PostNodeDockerStart","PostNodeDockerStop","PostNodeGroup","PostNodeImagePull","PostNodeInterface","PostNodeInterfaceRoute","PostNodeNtp","PostNodePackage","PostNodePowerReboot","PostNodePowerShutdown","PostNodeProcessSignal","PostNodeSchedule","PostNodeService","PostNodeServiceDisable","PostNodeServiceEnable","PostNodeServiceRestart","PostNodeServiceStart","PostNodeServiceStop","PostNodeSysctl","PostNodeUser","PostNodeUserSshkey","PutAgentConfig","PutFileByName","PutNodeCertificate","PutNodeDns","PutNodeFile","PutNodeGroup","PutNodeHostname","PutNodeInterface","PutNodeInterfaceRoute","PutNodeNtp","PutNodePackageUpdates","PutNodeSchedule","PutNodeService","PutNodeSysctl","PutNodeTimezone","PutNodeUser","PutNodeUserPassword","PutSecret","RejectMachine","RetryJobByID","RevokeMachine","RotatePKIKey","RotatePKINATSCert","UndrainAgent"],"type":"string","title":"OperationID"},"permission":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"}},"required":["id","permission"],"type":"object","title":"CatalogOperation"},"type":"array"},"outcomes":{"description":"The outcomes of a host, from the best to the worst, as the CLI's summary orders them.","items":{"type":"string"},"type":"array"},"permissions":{"description":"Each permission that osapi knows.","items":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"},"type":"array"},"render_tags":{"description":"The render tags of an output field, as the CLI reads them. short= takes a number, such as short=12.","items":{"type":"string"},"type":"array"},"roles":{"description":"The built-in roles, in order, with the permissions of each.","items":{"properties":{"description":{"description":"Who the role is for.","type":"string"},"name":{"description":"The name of the role, as a token names it.","example":"operator","type":"string"},"permissions":{"description":"The permissions of the role.","items":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"},"type":"array"}},"required":["name","description","permissions"],"type":"object","title":"CatalogRole"},"type":"array"},"status_tones":{"additionalProperties":{"type":"string"},"description":"The tone of each status word, as the CLI colors it: ok, warn or err.","type":"object"},"targets":{"description":"The targets that name no host: each agent, or any one agent.","items":{"properties":{"doc":{"description":"What it sends the job to.","type":"string"},"label":{"description":"Its label.","example":"All agents","type":"string"},"value":{"description":"The target, as a method takes it.","example":"_all","type":"string"}},"required":["value","label","doc"],"type":"object","title":"CatalogTarget"},"type":"array"}},"required":["behaviors","areas","permissions","roles","operations","status_tones","count_tones","host_families","targets","controller","render_tags","outcomes"],"type":"object","title":"CatalogResponse"}}},"description":"The catalog."},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Unauthorized - API key required"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Forbidden - Insufficient permissions"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"An error on the controller."}}} \ No newline at end of file +{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"areas":{"description":"Each area, in order, with its label.","items":{"properties":{"label":{"description":"The label of the area.","example":"Networking","type":"string"},"name":{"description":"The name of the area.","example":"networking","type":"string"}},"required":["name","label"],"type":"object","title":"CatalogArea"},"type":"array"},"behaviors":{"description":"Each behavior that the API serves, and each internal behavior, in the order of the registry.","items":{"properties":{"area":{"description":"The area of the behavior, or empty for an internal behavior.","example":"networking","type":"string"},"chain":{"description":"The chain of the behavior, as osapi dsl chain list prints it.","type":"string"},"doc":{"description":"What the behavior manages.","type":"string"},"internal":{"description":"Only other behaviors call it: it has no route.","type":"boolean"},"methods":{"description":"The methods of the behavior.","items":{"properties":{"calls":{"description":"The calls that the examples of the method make to other behaviors.","items":{"properties":{"behavior":{"description":"The behavior that is called.","example":"package","type":"string"},"calls":{"description":"The calls that the call makes.","items":"circular(CatalogCall)","type":"array"},"method":{"description":"The method that is called.","example":"get","type":"string"}},"required":["behavior","method"],"type":"object","title":"CatalogCall"},"type":"array"},"columns":{"description":"The fields of the rows that the method answers, as the CLI's output reads them.","items":{"properties":{"columns":{"description":"The columns of an object, or of a list of objects.","items":"circular(CatalogColumn)","type":"array"},"doc":{"description":"What the field is.","type":"string"},"kind":{"description":"ColumnKind is what a field of an answer holds.","enum":["value","values","object","list"],"type":"string","title":"ColumnKind"},"label":{"description":"The label of the field.","example":"Total","type":"string"},"name":{"description":"The json name of the field.","example":"total","type":"string"},"render":{"description":"The render tag of the field, such as bytes.","example":"bytes","type":"string"}},"required":["name","label","doc","kind"],"type":"object","title":"CatalogColumn"},"type":"array"},"disruption":{"description":"What the method interrupts.","type":"string"},"disruptive":{"description":"The method can interrupt a host, such as a reboot.","type":"boolean"},"doc":{"description":"What the method does.","type":"string"},"examples":{"description":"The examples of the method.","items":{"properties":{"doc":{"description":"What the example does.","type":"string"},"input":{"description":"The input of the example."},"output":{"description":"The output of the example."}},"required":["doc","input"],"type":"object","title":"CatalogExample"},"type":"array"},"fields":{"description":"The fields of the input.","items":{"properties":{"doc":{"description":"What the field is.","type":"string"},"in":{"description":"FieldIn is where a field of a request goes.","enum":["path","query","body"],"type":"string","title":"FieldIn"},"kind":{"description":"FieldKind is how a form takes the value of a field.","enum":["string","number","bool","list","object"],"type":"string","title":"FieldKind"},"name":{"description":"The json name of the field.","example":"servers","type":"string"},"options":{"description":"The values that the field takes: those of its type with enum, or of its oneof rule.","items":{"type":"string"},"type":"array"},"required":{"description":"The request needs the field.","type":"boolean"},"secret":{"description":"The field is a secret.","type":"boolean"}},"required":["name","in","kind","required","doc"],"type":"object","title":"CatalogField"},"type":"array"},"http_method":{"description":"The HTTP method of the route. An internal behavior has no route.","example":"PUT","type":"string"},"input":{"description":"The input type and its fields, a required one marked *.","type":"string"},"kind":{"description":"What a method does to a host, by the verb of its permission: read, write or action.","enum":["read","write","action"],"type":"string","title":"MethodKind"},"long":{"description":"The rest of what the method does.","type":"string"},"name":{"description":"The name of the method.","example":"update","type":"string"},"output":{"description":"The output type and its fields.","type":"string"},"path":{"description":"The path of the route.","type":"string"},"permission":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"},"platforms":{"description":"The platforms that the method runs on: those that its On limits it to, else each platform of the behavior.","items":{"type":"string"},"type":"array"},"runs_on":{"description":"The host platforms that the method runs on, as the agent decides, and * for a Linux host whose platform gohai has no family for.","items":{"type":"string"},"type":"array"}},"required":["name","kind","doc","platforms","runs_on","input","output","fields","columns","calls","examples"],"type":"object","title":"CatalogMethod"},"type":"array"},"name":{"description":"The name of the behavior.","example":"dns","type":"string"},"parent":{"description":"The behavior that the behavior is under, such as user for sshkey.","type":"string"},"platforms":{"description":"The platforms of the providers of the behavior.","items":{"type":"string"},"type":"array"},"title":{"description":"The title of the behavior.","example":"DNS","type":"string"},"used_by":{"description":"The behaviors that call the behavior.","items":{"type":"string"},"type":"array"},"uses":{"description":"The behaviors that the behavior calls.","items":{"type":"string"},"type":"array"}},"required":["name","title","area","doc","internal","platforms","uses","used_by","chain","methods"],"type":"object","title":"CatalogBehavior"},"type":"array"},"controller":{"description":"Each method of an endpoint group of the Object Store area: a call of the controller that takes no target.","items":{"properties":{"doc":{"description":"What the method does, in one line.","type":"string"},"group":{"description":"The endpoint group.","example":"file","type":"string"},"method":{"description":"The method.","example":"list","type":"string"},"operation":{"description":"An operationId of an operation that needs a permission.","enum":["AdmitMachine","DeleteFileByName","DeleteJobByID","DeleteMachine","DeleteNodeCertificate","DeleteNodeDns","DeleteNodeDocker","DeleteNodeFile","DeleteNodeGroup","DeleteNodeImage","DeleteNodeInterface","DeleteNodeInterfaceRoute","DeleteNodeNtp","DeleteNodePackage","DeleteNodeSchedule","DeleteNodeService","DeleteNodeSysctl","DeleteNodeUser","DeleteNodeUserSshkey","DeleteSecret","DrainAgent","GetAdmission","GetAdmissions","GetAgentConfig","GetAgentDetails","GetAgentFacts","GetAgents","GetAuditExport","GetAuditLogByID","GetAuditLogs","GetCatalog","GetFileByName","GetFileStale","GetFiles","GetHealthStatus","GetJobByID","GetJobs","GetNodeCertificate","GetNodeCertificateByKey","GetNodeDisk","GetNodeDnsByKey","GetNodeDocker","GetNodeDockerByKey","GetNodeFile","GetNodeGroup","GetNodeGroupByKey","GetNodeHostname","GetNodeImage","GetNodeInterface","GetNodeInterfaceByKey","GetNodeInterfaceRoute","GetNodeLoad","GetNodeLog","GetNodeLogSource","GetNodeMemory","GetNodeNtp","GetNodeOs","GetNodePackage","GetNodePackageByKey","GetNodePackageUpdates","GetNodeProcess","GetNodeProcessByKey","GetNodeSchedule","GetNodeScheduleByKey","GetNodeService","GetNodeServiceByKey","GetNodeStatus","GetNodeSysctl","GetNodeSysctlByKey","GetNodeTimezone","GetNodeUptime","GetNodeUser","GetNodeUserByKey","GetNodeUserSshkey","GetPKICert","GetPKIKeyRotation","GetPKINATSCertRotation","GetSecret","GetSecretValue","GetSecretVaults","GetSecrets","GetTrace","ListDeadLetters","ListPKICerts","PostFile","PostNodeCertificate","PostNodeCommandExec","PostNodeCommandShell","PostNodeConnectivityPing","PostNodeDocker","PostNodeDockerExec","PostNodeDockerStart","PostNodeDockerStop","PostNodeGroup","PostNodeImagePull","PostNodeInterface","PostNodeInterfaceRoute","PostNodeNtp","PostNodePackage","PostNodePowerReboot","PostNodePowerShutdown","PostNodeProcessSignal","PostNodeSchedule","PostNodeService","PostNodeServiceDisable","PostNodeServiceEnable","PostNodeServiceRestart","PostNodeServiceStart","PostNodeServiceStop","PostNodeSysctl","PostNodeUser","PostNodeUserSshkey","PostSecret","PutAgentConfig","PutFileByName","PutNodeCertificate","PutNodeDns","PutNodeFile","PutNodeGroup","PutNodeHostname","PutNodeInterface","PutNodeInterfaceRoute","PutNodeNtp","PutNodePackageUpdates","PutNodeSchedule","PutNodeService","PutNodeSysctl","PutNodeTimezone","PutNodeUser","PutNodeUserPassword","PutSecret","RejectMachine","RetryJobByID","RevokeMachine","RotatePKIKey","RotatePKINATSCert","UndrainAgent"],"type":"string","title":"OperationID"},"permission":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"}},"required":["group","method","doc","operation","permission"],"type":"object","title":"CatalogControllerMethod"},"type":"array"},"count_tones":{"additionalProperties":{"type":"string"},"description":"The tone of a count above zero, by what it counts: ok, warn or err.","type":"object"},"host_families":{"description":"The host platforms that gohai names. A method's runs_on has * for any other Linux.","items":{"type":"string"},"type":"array"},"operations":{"description":"The permission of each operation that needs one, in the order of the operationIds.","items":{"properties":{"id":{"description":"An operationId of an operation that needs a permission.","enum":["AdmitMachine","DeleteFileByName","DeleteJobByID","DeleteMachine","DeleteNodeCertificate","DeleteNodeDns","DeleteNodeDocker","DeleteNodeFile","DeleteNodeGroup","DeleteNodeImage","DeleteNodeInterface","DeleteNodeInterfaceRoute","DeleteNodeNtp","DeleteNodePackage","DeleteNodeSchedule","DeleteNodeService","DeleteNodeSysctl","DeleteNodeUser","DeleteNodeUserSshkey","DeleteSecret","DrainAgent","GetAdmission","GetAdmissions","GetAgentConfig","GetAgentDetails","GetAgentFacts","GetAgents","GetAuditExport","GetAuditLogByID","GetAuditLogs","GetCatalog","GetFileByName","GetFileStale","GetFiles","GetHealthStatus","GetJobByID","GetJobs","GetNodeCertificate","GetNodeCertificateByKey","GetNodeDisk","GetNodeDnsByKey","GetNodeDocker","GetNodeDockerByKey","GetNodeFile","GetNodeGroup","GetNodeGroupByKey","GetNodeHostname","GetNodeImage","GetNodeInterface","GetNodeInterfaceByKey","GetNodeInterfaceRoute","GetNodeLoad","GetNodeLog","GetNodeLogSource","GetNodeMemory","GetNodeNtp","GetNodeOs","GetNodePackage","GetNodePackageByKey","GetNodePackageUpdates","GetNodeProcess","GetNodeProcessByKey","GetNodeSchedule","GetNodeScheduleByKey","GetNodeService","GetNodeServiceByKey","GetNodeStatus","GetNodeSysctl","GetNodeSysctlByKey","GetNodeTimezone","GetNodeUptime","GetNodeUser","GetNodeUserByKey","GetNodeUserSshkey","GetPKICert","GetPKIKeyRotation","GetPKINATSCertRotation","GetSecret","GetSecretValue","GetSecretVaults","GetSecrets","GetTrace","ListDeadLetters","ListPKICerts","PostFile","PostNodeCertificate","PostNodeCommandExec","PostNodeCommandShell","PostNodeConnectivityPing","PostNodeDocker","PostNodeDockerExec","PostNodeDockerStart","PostNodeDockerStop","PostNodeGroup","PostNodeImagePull","PostNodeInterface","PostNodeInterfaceRoute","PostNodeNtp","PostNodePackage","PostNodePowerReboot","PostNodePowerShutdown","PostNodeProcessSignal","PostNodeSchedule","PostNodeService","PostNodeServiceDisable","PostNodeServiceEnable","PostNodeServiceRestart","PostNodeServiceStart","PostNodeServiceStop","PostNodeSysctl","PostNodeUser","PostNodeUserSshkey","PostSecret","PutAgentConfig","PutFileByName","PutNodeCertificate","PutNodeDns","PutNodeFile","PutNodeGroup","PutNodeHostname","PutNodeInterface","PutNodeInterfaceRoute","PutNodeNtp","PutNodePackageUpdates","PutNodeSchedule","PutNodeService","PutNodeSysctl","PutNodeTimezone","PutNodeUser","PutNodeUserPassword","PutSecret","RejectMachine","RetryJobByID","RevokeMachine","RotatePKIKey","RotatePKINATSCert","UndrainAgent"],"type":"string","title":"OperationID"},"permission":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"}},"required":["id","permission"],"type":"object","title":"CatalogOperation"},"type":"array"},"outcomes":{"description":"The outcomes of a host, from the best to the worst, as the CLI's summary orders them.","items":{"type":"string"},"type":"array"},"permissions":{"description":"Each permission that osapi knows.","items":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"},"type":"array"},"render_tags":{"description":"The render tags of an output field, as the CLI reads them. short= takes a number, such as short=12.","items":{"type":"string"},"type":"array"},"roles":{"description":"The built-in roles, in order, with the permissions of each.","items":{"properties":{"description":{"description":"Who the role is for.","type":"string"},"name":{"description":"The name of the role, as a token names it.","example":"operator","type":"string"},"permissions":{"description":"The permissions of the role.","items":{"description":"A permission that osapi knows, as resource:verb.","enum":["health:read","trace:read","secret:use","secret:reveal","certificate:read","certificate:write","command:execute","command:shell","connectivity:execute","disk:read","dns:read","dns:write","docker:read","docker:write","docker:execute","docker:exec","file:read","file:write","group:read","group:write","hostname:read","hostname:write","image:read","image:execute","image:write","interface:read","interface:write","load:read","log:read","memory:read","ntp:read","ntp:write","os:read","package:read","package:write","power:execute","process:read","process:execute","schedule:read","schedule:write","service:read","service:write","service:execute","status:read","sysctl:read","sysctl:write","timezone:read","timezone:write","uptime:read","user:read","user:write","admission:read","admission:write","agent:read","agent:write","audit:read","catalog:read","job:read","job:write","pki:read","pki:write","secret:read","secret:write"],"type":"string","title":"Permission"},"type":"array"}},"required":["name","description","permissions"],"type":"object","title":"CatalogRole"},"type":"array"},"status_tones":{"additionalProperties":{"type":"string"},"description":"The tone of each status word, as the CLI colors it: ok, warn or err.","type":"object"},"targets":{"description":"The targets that name no host: each agent, or any one agent.","items":{"properties":{"doc":{"description":"What it sends the job to.","type":"string"},"label":{"description":"Its label.","example":"All agents","type":"string"},"value":{"description":"The target, as a method takes it.","example":"_all","type":"string"}},"required":["value","label","doc"],"type":"object","title":"CatalogTarget"},"type":"array"}},"required":["behaviors","areas","permissions","roles","operations","status_tones","count_tones","host_families","targets","controller","render_tags","outcomes"],"type":"object","title":"CatalogResponse"}}},"description":"The catalog."},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Unauthorized - API key required"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Forbidden - Insufficient permissions"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"An error on the controller."}}} \ No newline at end of file diff --git a/docs/docs/gen/api/get-catalog.api.mdx b/docs/docs/gen/api/get-catalog.api.mdx index 23c1725b81..7033dfdb5a 100644 --- a/docs/docs/gen/api/get-catalog.api.mdx +++ b/docs/docs/gen/api/get-catalog.api.mdx @@ -5,7 +5,7 @@ description: "Returns each behavior with its methods, the areas, the permissions sidebar_label: "Get the catalog" hide_title: true hide_table_of_contents: true -api: eJztPU1zGzmuf4XVl022FNmzmzmstt7BiZOMd/Lhsp2dg5NyUd2QxFGL7CHZljUu/fctgB/NbrUkO/vq1Tv0ySLIBkEQAEGQhB+zAkyuRWWFktkkuwJba2kY8HzBprDg90JpthZ2wYQ1bAV2oQozYnYBjGvg/mcFeiWMEUp6wLQWpX0lJNOqhJ1GTM1cD6oCzbFr18IqCQYrsWAst7UBw7gsCJCrWloziuWFMpbN+EqUAsyY3SyAfb1gGnhhmLCMzyxoZsRcvhJyzN7RiFKy2IIblnPLSzWf4GfjbJRFii6KbJJ9APvWNchGmQZTKWnAZJPH7G+np/gnV9KCtPiTV1Upcvr25HeD3HzMTL6AFcdflUbMVriviXX4o819ohHrRkxIpnQBetQwv+RTKJFGYWFldpFS/S5S5AtVBcZiB4gGHviqKiGbZJ/BrpVeConDtJsKYcZqLG9HmeQr6EeLNfuxygNYt8jOP2qhocgmt66LkR/B99haTX+H3OLXwhJKPxlnGjhS5ptxrfkGy0Fg97E2CrRdcEtUn11eMAP6HrxckVQKaUFLXsb2NB3YnKYkjFjDXBirNwemBJnSzzqsCYiabpRmsKrshs2UZlzuUvJ0Do+yfMGF7O+dqna754YpwyvBClP6NqUwllVaSItKNe7rp1D5bi+/BQ5Hnq+45HMwvSjCOHfxfJHlhim7AB0xodKWJRN2gmqOSiwV06q2kOCeKlUCl4jcG61+TvjKLi8OzCl2vgcZVTXC5ScqInd9sRVfoqnrjupAl6FNf69tqRaOPVC0RaXi+ZLPoVdOnjwg4juSnxKb5ULndcn1C6+db3lZvsx2tdMN/9A0HBzBHOxROxIZFXs7bkyQ3D5jkquyXsk9jJkJKBup0WqdcMmPhUuzBm1IqxD89uP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W+Zqg/vbugYz9mekGEzGBn/A7GH0wm5SXA/ProWN+hIbbeYw4qIIMcq237fbrf/AZ8KkiQ= sidebar_class_name: "get api-method" info_path: gen/api/osapi custom_edit_url: null diff --git a/docs/docs/gen/api/post-secret.ParamsDetails.json b/docs/docs/gen/api/post-secret.ParamsDetails.json new file mode 100644 index 0000000000..cf4b69de77 --- /dev/null +++ b/docs/docs/gen/api/post-secret.ParamsDetails.json @@ -0,0 +1 @@ +{"parameters":[{"description":"The name of the vault, such as default.","in":"path","name":"vault","required":true,"schema":{"example":"default","maxLength":64,"pattern":"^[a-zA-Z0-9_-]+$","type":"string"},"x-oapi-codegen-extra-tags":{"validate":"required,resource_name,max=64"}}]} \ No newline at end of file diff --git a/docs/docs/gen/api/post-secret.RequestSchema.json b/docs/docs/gen/api/post-secret.RequestSchema.json new file mode 100644 index 0000000000..4db5f9cccf --- /dev/null +++ b/docs/docs/gen/api/post-secret.RequestSchema.json @@ -0,0 +1 @@ +{"title":"Body","body":{"content":{"application/json":{"schema":{"properties":{"key":{"description":"The name of the key, such as registry-token.","example":"registry-token","maxLength":128,"pattern":"^[a-zA-Z0-9_-]+$","type":"string","x-oapi-codegen-extra-tags":{"validate":"required,resource_name,max=128"}},"value":{"description":"The value of the key, which no method gives back. A secret: a reference, secret:///, or the value.","format":"password","maxLength":65536,"type":"string","writeOnly":true,"x-oapi-codegen-extra-tags":{"validate":"required,max=65536"},"x-osapi-secret":true}},"required":["key","value"],"type":"object","title":"SecretCreateRequest"}}},"required":true}} \ No newline at end of file diff --git a/docs/docs/gen/api/post-secret.StatusCodes.json b/docs/docs/gen/api/post-secret.StatusCodes.json new file mode 100644 index 0000000000..6da6e4c8cf --- /dev/null +++ b/docs/docs/gen/api/post-secret.StatusCodes.json @@ -0,0 +1 @@ +{"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"by":{"description":"Who did the last update, or empty when it is not known.","example":"ops@example.com","type":"string"},"changed":{"description":"When the last update occurred.","example":"2026-11-23T22:56:50Z","format":"date-time","type":"string"},"key":{"description":"The name of the key.","example":"registry-token","type":"string"},"vault":{"description":"The name of the vault.","example":"default","type":"string"},"version":{"description":"1 for the first value of the key, and one more for each update.","example":3,"format":"int64","type":"integer"}},"required":["vault","key","version","changed","by"],"type":"object","title":"SecretInfo"}}},"description":"The key is new.","headers":{"Location":{"description":"The URL of the resource that the request created.","schema":{"type":"string"}}}},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The request is not valid."},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Unauthorized - API key required"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Forbidden - Insufficient permissions"},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The controller has no vault with that name."},"409":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The key exists. Change it with PUT /api/secret/{vault}/{key}."},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"An error on the controller."}}} \ No newline at end of file diff --git a/docs/docs/gen/api/post-secret.api.mdx b/docs/docs/gen/api/post-secret.api.mdx new file mode 100644 index 0000000000..7851229825 --- /dev/null +++ b/docs/docs/gen/api/post-secret.api.mdx @@ -0,0 +1,69 @@ +--- +id: post-secret +title: "Create a key" +description: "Write a value as version 1 of a new key. A key that exists is 409, whatever its value: update changes it. The answer is the metadata of the key. The API never gives the value back." +sidebar_label: "Create a key" +hide_title: true +hide_table_of_contents: true +api: eJztW21v28gR/iuDRT8kKPVixzYuuuuhviBpXSSNkSgIcLZrjMiRuCdql9ldStYJ+u/F7C5FSlbzghaHFOAnU9TuvPGZZ1byo43IyKZGlk5qJUbio5GOAGGJRUWAFpZkrNQKTkBPAUHRCua07sMl/wGXowN6kNZZkBbOhs8TWOXoaEkGpLPBzgiqMkNHkOaoZmRBuj6McwJUdsULLbicYEEOM3TInvi198PLLq+vQHmTM7mksDgEOMF03heJ0CUZ5BSuMjES19q695QaciIRJRpckCNjxehmc5AuW1e4oNrlEqvCJWCrNOfkM5ryDfYgeXmJLheJ4B1iJPxikQhDnyppKBMjZypKhE1zWqAYbQQ94KIseG20JBKxwIfXpGYuF6OLMw7POTJs/F832Pv9svfrsPf8vnf35z+JRLh1yZutM1LNxDYRDz2NpeylOqMZqR49OIM9hzPL3pZYSC6zGO1CSgxZXZmU7jnmZIEPf7k4E9vtXYiarPtFZ2venGrlSDm+xLIsZOrLOfjNcp02rZxKw8V2krzPOfndn6/qnNZNTQ3NpHVm3XN6TopL21Rp/739Yp2c/vBN1fqfFOvk9Aex3SbCo+14ogGI7UxXuUxzUJoBnessgtZDFS7BemCOAMHQlAyplJL65mDwkwfVz4Of5rT+OQFtGrBzqabaLNB5JFq70iY7ANT5+bOLx4VYcVO/VcW6Rug3V8YDh41HEFreHoIONrlITR/ceFzUZbvbRaQnv1HKTeCk8w88dOkLQ+joXQCk2O7b8tb5hi21sgF1p8OT/wKzkyOQ/ZhryGTmq12gdZGx/BOgRenWsMpJgXRMVko7mCu9OkCvLu1f46t+qhfH+jcQYHbMP6lD56DTtDKGsn03p8PTi97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VLqHQfXuwQ4mn9+sMYBljKQdA7DDae8reDzZzWW09T591/Sjuq76i+o/qO6r9zqr9UsWW1OihF3xuylFZGurWXiv5CaMhcVqysuxFRoue1dOKOFZRBMHcT9Tz3b3x+C1Lu/vL66j6sv98pUy0nUEvn0BAyx/k1VjRvxAyjVlWnYiTeEQayCSqnqdELBpvK0GQgVVk5L0/lv7Ug87FgKwoYRU/stFo75ZWXg9YBBM2iGImAT8/ijlT4voqDCg72EmnM1wltk8OFu8R2i//QBB8HFBNtdsaEuRi7IpTaBg0xY0AcOQWIBjPveb6HEd5GzkZM/KtXtcrsHx/HtfaK3YZ3G9VZ7lzpscjnhneNSPdljf0vlqAR0EnWmPFIjf3hM380UsfrkieooZLQcedBA1o/zF5LVT34mbfA9O17z5m2D3+TS4K1rswtA1/x0J0WRC7xVIpgcyqK/q26VYGxCnIWUMHlFYT1gRGOmweXG13NcuCyZLeqCSmYr99G5i2p+vCSBX67VcyJCBPKcSmZ9wLHSjW7VVoBeh8J67uloqAU5MNIEk58CFP5QBF7QUpYubJy/Ui9aU7p3N4qrynczWmastZQOvhUURVF7l7uq1UGplI79bvSPpIQ8q2qpxRLo1NtMsr6t6olLByJk/6wPww86TD1XVCZImLFjgaDmXR5NWHR6SCAW+pwwSAoZEpMh6NNLVx/czWG1/FucmBKl6SCdLCvzWwQN9vBm6uxRyV3xAJVy1pQ7wJC0EPuYat1KP5//WlBbEtHD25QFigV19TXbBN54UaErrL1Tw5GgYDuEsEw4wWbzQQtfTDFdsu3P1VkeMbccdMa6aed50Np+ToToykWlj5TzCfv4n+Fn8LX/4bhaCrxJqp1i0KiurX+jQPzZ5ShtmbAixBNj/mjtffRZ5+Gey/TlEr32bVt9r1++56pchJ/orDQmRcj44p/dIGrEKcuw3QdbcK9jShQzSqc8dpgk3GLkYxjujvWjRec1dFKbDZhxZhJdrvdFSaQ7vZuu93+G0uKyXY= +sidebar_class_name: "post api-method" +info_path: gen/api/osapi +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; +import Translate from "@docusaurus/Translate"; + + + + + + + + + + +Write a value as version 1 of a new key. A key that exists is 409, whatever its value: update changes it. The answer is the metadata of the key. The API never gives the value back. + + + Request + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/gen/api/put-file-by-name.StatusCodes.json b/docs/docs/gen/api/put-file-by-name.StatusCodes.json index a51eb64d74..54611bede8 100644 --- a/docs/docs/gen/api/put-file-by-name.StatusCodes.json +++ b/docs/docs/gen/api/put-file-by-name.StatusCodes.json @@ -1 +1 @@ -{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"changed":{"description":"Whether the file content changed. False when the Object Store already held an object with the same SHA-256 digest.","example":true,"type":"boolean"},"content_type":{"description":"ContentType is how a deploy treats a file: raw writes its bytes as they are; template renders it with Go text/template and the agent's facts.","enum":["raw","template"],"type":"string","title":"ContentType"},"name":{"description":"The name of the uploaded file.","example":"nginx.conf","type":"string"},"sha256":{"description":"SHA-256 hash of the file content.","example":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","type":"string"},"size":{"description":"File size in bytes.","example":1024,"type":"integer"}},"required":["name","sha256","size","changed","content_type"],"type":"object","title":"FileUploadResponse"}}},"description":"The file existed. changed says whether its content changed."},"201":{"content":{"application/json":{"schema":{"properties":{"changed":{"description":"Whether the file content changed. False when the Object Store already held an object with the same SHA-256 digest.","example":true,"type":"boolean"},"content_type":{"description":"ContentType is how a deploy treats a file: raw writes its bytes as they are; template renders it with Go text/template and the agent's facts.","enum":["raw","template"],"type":"string","title":"ContentType"},"name":{"description":"The name of the uploaded file.","example":"nginx.conf","type":"string"},"sha256":{"description":"SHA-256 hash of the file content.","example":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","type":"string"},"size":{"description":"File size in bytes.","example":1024,"type":"integer"}},"required":["name","sha256","size","changed","content_type"],"type":"object","title":"FileUploadResponse"}}},"description":"The file is new.","headers":{"Location":{"description":"The URL of the resource that the request created.","schema":{"type":"string"}}}},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The request is not valid."},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Unauthorized - API key required"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The file is an osapi file, which a caller cannot write."},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"An error on the controller."},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The Object Store is not configured on the controller."}}} \ No newline at end of file +{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"changed":{"description":"Whether the file content changed. False when the Object Store already held an object with the same SHA-256 digest.","example":true,"type":"boolean"},"content_type":{"description":"ContentType is how a deploy treats a file: raw writes its bytes as they are; template renders it with Go text/template and the agent's facts.","enum":["raw","template"],"type":"string","title":"ContentType"},"name":{"description":"The name of the uploaded file.","example":"nginx.conf","type":"string"},"sha256":{"description":"SHA-256 hash of the file content.","example":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","type":"string"},"size":{"description":"File size in bytes.","example":1024,"type":"integer"}},"required":["name","sha256","size","changed","content_type"],"type":"object","title":"FileUploadResponse"}}},"description":"The file after the update. changed says whether its content changed."},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The request is not valid."},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"Unauthorized - API key required"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The file is an osapi file, which a caller cannot write."},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"No file has that name. Upload it with POST /api/file."},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"An error on the controller."},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"reason":{"type":"string","description":"Why the request failed, as a word that a program can branch on. The HTTP status is the class of the problem; the reason is the cause, and the error is the message for a person, which can change between releases. invalid_request: the request breaks a rule, such as a missing field (400). unauthorized: no token, or a token that is not valid (401). forbidden: the token does not have the permission (403). not_found: the host or osapi does not have what the request names (404). not_managed: the item is there, but osapi did not deploy it, so osapi does not change it (409). not_installed: the host does not have a program that the request needs (409). conflict: the state of the item blocks the request, such as a create of one that exists (409). unavailable: a part that osapi depends on is down, such as NATS (503). server_error: the controller failed; its log has the cause (500).","enum":["invalid_request","unauthorized","forbidden","not_found","not_managed","not_installed","conflict","unavailable","server_error"],"example":"not_found"}},"title":"ErrorResponse"}}},"description":"The Object Store is not configured on the controller."}}} \ No newline at end of file diff --git a/docs/docs/gen/api/put-file-by-name.api.mdx b/docs/docs/gen/api/put-file-by-name.api.mdx index 784634845a..0e39d11370 100644 --- a/docs/docs/gen/api/put-file-by-name.api.mdx +++ b/docs/docs/gen/api/put-file-by-name.api.mdx @@ -1,11 +1,11 @@ --- id: put-file-by-name title: "Replace a file" -description: "Replace a file in the Object Store, or create it when the name is new." +description: "Replace a file that exists in the Object Store. A name that is not there is 404: upload creates it." sidebar_label: "Replace a file" hide_title: true hide_table_of_contents: true -api: eJztWt+P2zYS/lcGfLkE0Nq7jp3GDvqwOTTtHpI2SBzkYTdYjKSxxa5EKiS1tmv4fz8MSVm2d5teDsUhwOnJskTOfPPrG8qercjJZkbWTmolZuI91SVmBAgLWRJIBa4g+C39nTIHH5w2lIA2kBlCRyAdrAoKaxRWBNKCotVAJELXZJCFXuViJt417rUs6dXmV6x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G9EKIOId+oN+ZoITgp+u9mkaOmzKbdbfvytIcNk/JWL3EjfMDytSMvXuZjOeU74O4Y/+xT/p/oc/srE/pOWxIeo1h3SEUmkJW8K85QoCHMyHT6Ng7cnfvJ2v/Wpqfo9zV1kGdWus/zRz40Dorv6zMSUxtn9Sue8heV6scn+cnrDGDHSWzsF3fJYvGDsT5q72YQVMz43brc76/05ks3fbv8JPytFtA== sidebar_class_name: "put api-method" info_path: gen/api/osapi custom_edit_url: null @@ -37,7 +37,7 @@ import Translate from "@docusaurus/Translate"; -Replace a file in the Object Store, or create it when the name is new. +Replace a file that exists in the Object Store. A name that is not there is 404: upload creates it. @@ -37,7 +37,7 @@ import Translate from "@docusaurus/Translate"; -Write a value as the next version of a key, or as version 1 of a new key. The answer is the metadata of the key. The API never gives the value back. +Write a value as the next version of a key that exists. A key that is not there is 404: create makes it. The answer is the metadata of the key. The API never gives the value back. /, or the value. | + ### SecretInfo | Field | Type | Description | diff --git a/docs/docs/sidebar/usage/cli/client/file/update.md b/docs/docs/sidebar/usage/cli/client/file/update.md index 071bfaf267..678551b0ae 100644 --- a/docs/docs/sidebar/usage/cli/client/file/update.md +++ b/docs/docs/sidebar/usage/cli/client/file/update.md @@ -2,8 +2,9 @@ Replace a file in the Object Store. -The command replaces the content of a stored file, or stores it when the name is -new. The same content changes nothing (`Changed: false`). +The command replaces the content of a stored file. The same content changes +nothing (`Changed: false`). A name that is not there is refused with 404: +`file upload` creates it. ```bash osapi client file update [flags] diff --git a/docs/docs/sidebar/usage/cli/client/secret/create.md b/docs/docs/sidebar/usage/cli/client/secret/create.md new file mode 100644 index 0000000000..5ad5f04b6e --- /dev/null +++ b/docs/docs/sidebar/usage/cli/client/secret/create.md @@ -0,0 +1,72 @@ +# Create + +Create a key in a vault. + +The command reads the value from standard input with --value -, so the value is +not in the shell history. A key that exists is refused with 409 Conflict: secret +update changes it. A request then uses the key as +secret://<vault>/<key>. + +```bash +osapi client secret create [flags] +``` + +## Examples + +```bash +# Read the value from standard input +osapi client secret create --vault default --key registry-token --value - +``` + +## Result + +Read the value from standard input: + +```ansi +$ osapi client secret create --vault default --key registry-token --value - +Secret: + + trace 26e448c9dbe1c4a8d216a98c675079c9 + Vault: default + Key: registry-token + Version: 1 + Changed: 2026-01-15 10:00:00 + By: ops@example.com +``` + +With `--json`, the API's response: + +```json +{ + "vault": "default", + "key": "registry-token", + "version": 1, + "changed": "2026-01-15T10:00:00Z", + "by": "ops@example.com" +} +``` + +## Permission + +It needs the `secret:write` permission. +`osapi controller role get --name ` shows what a role grants. + +## Flags + +| Flag | Description | Default | +| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| `--key` | The name of the key, such as registry-token (required) | | +| `--value` | The value of the key, which no method gives back (a secret: secret://<vault>/<key>, or - to read it from standard input) (required) | | +| `--vault` | The name of the vault, such as default (required) | | + +## Global flags + +| Flag | Description | Default | +| ------------------ | -------------------------------------------------------------------------------- | ------------------------ | +| `-d, --debug` | Enable or disable debug mode | | +| `-j, --json` | Enable JSON output | | +| `-f, --osapi-file` | Path to config file; without one at the default path, osapi runs on the defaults | `/etc/osapi/osapi.yaml` | +| `--url` | Base URL the CLI client connects to (controller.client.url) | `https://localhost:8080` | + +[Output](../../output.md) tells how the result is printed, and what `--json` +gives. diff --git a/docs/docs/sidebar/usage/cli/client/secret/update.md b/docs/docs/sidebar/usage/cli/client/secret/update.md index 2c380c4054..1c77cc1ba1 100644 --- a/docs/docs/sidebar/usage/cli/client/secret/update.md +++ b/docs/docs/sidebar/usage/cli/client/secret/update.md @@ -1,10 +1,10 @@ # Update -Write the value of a key. +Change the value of a key. The command reads the value from standard input with --value -, so the value is -not in the shell history. A request then uses the key as -secret://<vault>/<key>. +not in the shell history. A key that is not there is refused with 404: secret +create makes it. ```bash osapi client secret update [flags] diff --git a/examples/sdk/client/secret.go b/examples/sdk/client/secret.go index 8f4e67da82..239474c8ca 100644 --- a/examples/sdk/client/secret.go +++ b/examples/sdk/client/secret.go @@ -30,6 +30,7 @@ var examples = []struct { }{ {"vaults", "List the vaults", runVaults}, {"list", "List the keys of a vault", runList}, + {"create", "Read the value from standard input", runCreate}, {"get", "Get the metadata of a key", runGet}, {"update", "Read the value from standard input", runUpdate}, {"delete", "Delete a key", runDelete}, @@ -62,6 +63,23 @@ func runList( return show(resp.Data) } +// runCreate runs the example create: read the value from standard input. +func runCreate( + ctx context.Context, + c *client.Client, +) error { + resp, err := c.Secret.Create(ctx, client.SecretCreateInput{ + Key: "registry-token", + Value: "-", + Vault: "default", + }) + if err != nil { + return err + } + + return show(resp.Data) +} + // runGet runs the example get: get the metadata of a key. func runGet( ctx context.Context, diff --git a/internal/apicontract/testdata/joined.golden b/internal/apicontract/testdata/joined.golden index 84a7c236df..2a8d4eead7 100644 --- a/internal/apicontract/testdata/joined.golden +++ b/internal/apicontract/testdata/joined.golden @@ -119,8 +119,9 @@ op POST /api/node/{hostname}/user id=PostNodeUser tags=[User_API_user_operations op POST /api/node/{hostname}/user/{name}/sshkey id=PostNodeUserSshkey tags=[Sshkey_API_sshkey_operations] auth=BearerAuth:user:write params=[path:hostname!:string path:name!:string] body=application/json:UserSshkeyCreateRequest! responses=[200=application/json:UserSshkeyCreateResponse 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 404=application/json:ErrorResponse 409=application/json:ErrorResponse 500=application/json:ErrorResponse] op POST /api/pki/key id=RotatePKIKey tags=[PKI_API_pki_operations] auth=BearerAuth:pki:write params=[] body= responses=[200=application/json:PKIKeyRotation 401=application/json:ErrorResponse 403=application/json:ErrorResponse 500=application/json:ErrorResponse] op POST /api/pki/nats id=RotatePKINATSCert tags=[PKI_API_pki_operations] auth=BearerAuth:pki:write params=[] body= responses=[200=application/json:PKINATSCertRotation 401=application/json:ErrorResponse 403=application/json:ErrorResponse 409=application/json:ErrorResponse 500=application/json:ErrorResponse] +op POST /api/secret/{vault} id=PostSecret tags=[Secret_Management_API_secret_operations] auth=BearerAuth:secret:write params=[path:vault!:string] body=application/json:SecretCreateRequest! responses=[201=application/json:SecretInfo 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 404=application/json:ErrorResponse 409=application/json:ErrorResponse 500=application/json:ErrorResponse] op PUT /api/agent/config/{hostname} id=PutAgentConfig tags=[Agent_Management_API_agent_operations] auth=BearerAuth:agent:write params=[path:hostname!:string] body=application/json:AgentConfigRequest! responses=[200=application/json:AgentConfigResponse 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 404=application/json:ErrorResponse 500=application/json:ErrorResponse] -op PUT /api/file/{name} id=PutFileByName tags=[File_Management_API_file_operations] auth=BearerAuth:file:write params=[path:name!:string] body=multipart/form-data:{content_type:ContentType,file!:string/binary}! responses=[200=application/json:FileUploadResponse 201=application/json:FileUploadResponse 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 500=application/json:ErrorResponse 503=application/json:ErrorResponse] +op PUT /api/file/{name} id=PutFileByName tags=[File_Management_API_file_operations] auth=BearerAuth:file:write params=[path:name!:string] body=multipart/form-data:{content_type:ContentType,file!:string/binary}! responses=[200=application/json:FileUploadResponse 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 404=application/json:ErrorResponse 500=application/json:ErrorResponse 503=application/json:ErrorResponse] op PUT /api/node/{hostname}/certificate/{name} id=PutNodeCertificate tags=[Certificate_API_certificate_operations] auth=BearerAuth:certificate:write params=[path:hostname!:string path:name!:string] body=application/json:CertificateUpdateRequest! responses=[200=application/json:CertificateUpdateResponse 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 404=application/json:ErrorResponse 409=application/json:ErrorResponse 500=application/json:ErrorResponse] op PUT /api/node/{hostname}/dns/{interface_name} id=PutNodeDns tags=[Dns_API_dns_operations] auth=BearerAuth:dns:write params=[path:hostname!:string path:interface_name!:string] body=application/json:DnsUpdateRequest! responses=[200=application/json:DnsUpdateResponse 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 404=application/json:ErrorResponse 409=application/json:ErrorResponse 500=application/json:ErrorResponse] op PUT /api/node/{hostname}/file id=PutNodeFile tags=[File_API_file_operations] auth=BearerAuth:file:write params=[path:hostname!:string] body=application/json:FileUpdateRequest! responses=[200=application/json:FileUpdateResponse 400=application/json:ErrorResponse 401=application/json:ErrorResponse 403=application/json:ErrorResponse 404=application/json:ErrorResponse 409=application/json:ErrorResponse 500=application/json:ErrorResponse] @@ -820,7 +821,7 @@ schema OSInfoResponse.family = string schema OSInfoResponse.version! = string schema ObjectStoreInfo.name! = string schema ObjectStoreInfo.size! = integer -schema OperationID = string(AdmitMachine|DeleteFileByName|DeleteJobByID|DeleteMachine|DeleteNodeCertificate|DeleteNodeDns|DeleteNodeDocker|DeleteNodeFile|DeleteNodeGroup|DeleteNodeImage|DeleteNodeInterface|DeleteNodeInterfaceRoute|DeleteNodeNtp|DeleteNodePackage|DeleteNodeSchedule|DeleteNodeService|DeleteNodeSysctl|DeleteNodeUser|DeleteNodeUserSshkey|DeleteSecret|DrainAgent|GetAdmission|GetAdmissions|GetAgentConfig|GetAgentDetails|GetAgentFacts|GetAgents|GetAuditExport|GetAuditLogByID|GetAuditLogs|GetCatalog|GetFileByName|GetFileStale|GetFiles|GetHealthStatus|GetJobByID|GetJobs|GetNodeCertificate|GetNodeCertificateByKey|GetNodeDisk|GetNodeDnsByKey|GetNodeDocker|GetNodeDockerByKey|GetNodeFile|GetNodeGroup|GetNodeGroupByKey|GetNodeHostname|GetNodeImage|GetNodeInterface|GetNodeInterfaceByKey|GetNodeInterfaceRoute|GetNodeLoad|GetNodeLog|GetNodeLogSource|GetNodeMemory|GetNodeNtp|GetNodeOs|GetNodePackage|GetNodePackageByKey|GetNodePackageUpdates|GetNodeProcess|GetNodeProcessByKey|GetNodeSchedule|GetNodeScheduleByKey|GetNodeService|GetNodeServiceByKey|GetNodeStatus|GetNodeSysctl|GetNodeSysctlByKey|GetNodeTimezone|GetNodeUptime|GetNodeUser|GetNodeUserByKey|GetNodeUserSshkey|GetPKICert|GetPKIKeyRotation|GetPKINATSCertRotation|GetSecret|GetSecretValue|GetSecretVaults|GetSecrets|GetTrace|ListDeadLetters|ListPKICerts|PostFile|PostNodeCertificate|PostNodeCommandExec|PostNodeCommandShell|PostNodeConnectivityPing|PostNodeDocker|PostNodeDockerExec|PostNodeDockerStart|PostNodeDockerStop|PostNodeGroup|PostNodeImagePull|PostNodeInterface|PostNodeInterfaceRoute|PostNodeNtp|PostNodePackage|PostNodePowerReboot|PostNodePowerShutdown|PostNodeProcessSignal|PostNodeSchedule|PostNodeService|PostNodeServiceDisable|PostNodeServiceEnable|PostNodeServiceRestart|PostNodeServiceStart|PostNodeServiceStop|PostNodeSysctl|PostNodeUser|PostNodeUserSshkey|PutAgentConfig|PutFileByName|PutNodeCertificate|PutNodeDns|PutNodeFile|PutNodeGroup|PutNodeHostname|PutNodeInterface|PutNodeInterfaceRoute|PutNodeNtp|PutNodePackageUpdates|PutNodeSchedule|PutNodeService|PutNodeSysctl|PutNodeTimezone|PutNodeUser|PutNodeUserPassword|PutSecret|RejectMachine|RetryJobByID|RevokeMachine|RotatePKIKey|RotatePKINATSCert|UndrainAgent) +schema OperationID = string(AdmitMachine|DeleteFileByName|DeleteJobByID|DeleteMachine|DeleteNodeCertificate|DeleteNodeDns|DeleteNodeDocker|DeleteNodeFile|DeleteNodeGroup|DeleteNodeImage|DeleteNodeInterface|DeleteNodeInterfaceRoute|DeleteNodeNtp|DeleteNodePackage|DeleteNodeSchedule|DeleteNodeService|DeleteNodeSysctl|DeleteNodeUser|DeleteNodeUserSshkey|DeleteSecret|DrainAgent|GetAdmission|GetAdmissions|GetAgentConfig|GetAgentDetails|GetAgentFacts|GetAgents|GetAuditExport|GetAuditLogByID|GetAuditLogs|GetCatalog|GetFileByName|GetFileStale|GetFiles|GetHealthStatus|GetJobByID|GetJobs|GetNodeCertificate|GetNodeCertificateByKey|GetNodeDisk|GetNodeDnsByKey|GetNodeDocker|GetNodeDockerByKey|GetNodeFile|GetNodeGroup|GetNodeGroupByKey|GetNodeHostname|GetNodeImage|GetNodeInterface|GetNodeInterfaceByKey|GetNodeInterfaceRoute|GetNodeLoad|GetNodeLog|GetNodeLogSource|GetNodeMemory|GetNodeNtp|GetNodeOs|GetNodePackage|GetNodePackageByKey|GetNodePackageUpdates|GetNodeProcess|GetNodeProcessByKey|GetNodeSchedule|GetNodeScheduleByKey|GetNodeService|GetNodeServiceByKey|GetNodeStatus|GetNodeSysctl|GetNodeSysctlByKey|GetNodeTimezone|GetNodeUptime|GetNodeUser|GetNodeUserByKey|GetNodeUserSshkey|GetPKICert|GetPKIKeyRotation|GetPKINATSCertRotation|GetSecret|GetSecretValue|GetSecretVaults|GetSecrets|GetTrace|ListDeadLetters|ListPKICerts|PostFile|PostNodeCertificate|PostNodeCommandExec|PostNodeCommandShell|PostNodeConnectivityPing|PostNodeDocker|PostNodeDockerExec|PostNodeDockerStart|PostNodeDockerStop|PostNodeGroup|PostNodeImagePull|PostNodeInterface|PostNodeInterfaceRoute|PostNodeNtp|PostNodePackage|PostNodePowerReboot|PostNodePowerShutdown|PostNodeProcessSignal|PostNodeSchedule|PostNodeService|PostNodeServiceDisable|PostNodeServiceEnable|PostNodeServiceRestart|PostNodeServiceStart|PostNodeServiceStop|PostNodeSysctl|PostNodeUser|PostNodeUserSshkey|PostSecret|PutAgentConfig|PutFileByName|PutNodeCertificate|PutNodeDns|PutNodeFile|PutNodeGroup|PutNodeHostname|PutNodeInterface|PutNodeInterfaceRoute|PutNodeNtp|PutNodePackageUpdates|PutNodeSchedule|PutNodeService|PutNodeSysctl|PutNodeTimezone|PutNodeUser|PutNodeUserPassword|PutSecret|RejectMachine|RetryJobByID|RevokeMachine|RotatePKIKey|RotatePKINATSCert|UndrainAgent) schema OsEntry.error = string schema OsEntry.hostname! = string schema OsEntry.os_info = Release @@ -985,6 +986,8 @@ schema ScheduleUpdateRequest.user = string schema ScheduleUpdateRequest.vars = map[string] schema ScheduleUpdateResponse.job_id = string/uuid schema ScheduleUpdateResponse.results! = [ScheduleResult] +schema SecretCreateRequest.key! = string +schema SecretCreateRequest.value! = string/password schema SecretInfo.by! = string schema SecretInfo.changed! = string/date-time schema SecretInfo.key! = string diff --git a/internal/controller/api/gen/api.yaml b/internal/controller/api/gen/api.yaml index 06e3afd60f..c05854093f 100644 --- a/internal/controller/api/gen/api.yaml +++ b/internal/controller/api/gen/api.yaml @@ -1622,7 +1622,7 @@ paths: name: app.conf x-osapi-method: get put: - description: Replace a file in the Object Store, or create it when the name is new. + description: 'Replace a file that exists in the Object Store. A name that is not there is 404: upload creates it.' operationId: PutFileByName parameters: - description: The name of the file in the Object Store. @@ -1659,18 +1659,7 @@ paths: application/json: schema: $ref: '#/components/schemas/FileUploadResponse' - description: The file existed. changed says whether its content changed. - "201": - content: - application/json: - schema: - $ref: '#/components/schemas/FileUploadResponse' - description: The file is new. - headers: - Location: - description: The URL of the resource that the request created. - schema: - type: string + description: The file after the update. changed says whether its content changed. "400": content: application/json: @@ -1689,6 +1678,12 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' description: The file is an osapi file, which a caller cannot write. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: No file has that name. Upload it with POST /api/file. "500": content: application/json: @@ -2617,6 +2612,89 @@ paths: input: vault: default x-osapi-method: list + post: + description: 'Write a value as version 1 of a new key. A key that exists is 409, whatever its value: update changes it. The answer is the metadata of the key. The API never gives the value back.' + operationId: PostSecret + parameters: + - description: The name of the vault, such as default. + in: path + name: vault + required: true + schema: + example: default + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + type: string + x-oapi-codegen-extra-tags: + validate: required,resource_name,max=64 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SecretCreateRequest' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/SecretInfo' + description: The key is new. + headers: + Location: + description: The URL of the resource that the request created. + schema: + type: string + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: The request is not valid. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Unauthorized - API key required + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Forbidden - Insufficient permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: The controller has no vault with that name. + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: The key exists. Change it with PUT /api/secret/{vault}/{key}. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: An error on the controller. + security: + - BearerAuth: + - secret:write + summary: Create a key + tags: + - Secret_Management_API_secret_operations + x-osapi-area: secrets + x-osapi-examples: + - doc: Read the value from standard input + input: + key: registry-token + value: '-' + vault: default + x-osapi-method: create /api/secret/{vault}/{key}: delete: description: Delete a key from its vault. A request that uses its reference after that fails. @@ -2767,7 +2845,7 @@ paths: vault: default x-osapi-method: get put: - description: Write a value as the next version of a key, or as version 1 of a new key. The answer is the metadata of the key. The API never gives the value back. + description: 'Write a value as the next version of a key that exists. A key that is not there is 404: create makes it. The answer is the metadata of the key. The API never gives the value back.' operationId: PutSecret parameters: - description: The name of the vault, such as default. @@ -2828,7 +2906,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - description: The controller has no vault with that name. + description: The vault has no key with that name. Create it with POST. "500": content: application/json: @@ -2838,7 +2916,7 @@ paths: security: - BearerAuth: - secret:write - summary: Write the value of a key + summary: Change the value of a key tags: - Secret_Management_API_secret_operations x-osapi-area: secrets @@ -10781,6 +10859,7 @@ components: - PostNodeSysctl - PostNodeUser - PostNodeUserSshkey + - PostSecret - PutAgentConfig - PutFileByName - PutNodeCertificate @@ -11721,6 +11800,29 @@ components: - machine_id - has_next type: object + SecretCreateRequest: + properties: + key: + description: The name of the key, such as registry-token. + example: registry-token + maxLength: 128 + pattern: ^[a-zA-Z0-9_-]+$ + type: string + x-oapi-codegen-extra-tags: + validate: required,resource_name,max=128 + value: + description: 'The value of the key, which no method gives back. A secret: a reference, secret:///, or the value.' + format: password + maxLength: 65536 + type: string + writeOnly: true + x-oapi-codegen-extra-tags: + validate: required,max=65536 + x-osapi-secret: true + required: + - key + - value + type: object SecretInfo: properties: by: diff --git a/internal/controller/endpoint/endpoint.go b/internal/controller/endpoint/endpoint.go index d3b149d0dc..91bfb49bd5 100644 --- a/internal/controller/endpoint/endpoint.go +++ b/internal/controller/endpoint/endpoint.go @@ -473,7 +473,7 @@ type Method struct { adminOnly bool handler any cmdShort string - location string + location []string cmdUse string cmdLong string examples []CommandExample @@ -875,19 +875,20 @@ func (m *Method) CommandName() string { return m.Name } -// Location names the field of the output that holds the ID of the resource -// a 201 created, such as job_id: the answer's Location header is the -// group's path and that ID, such as /api/job/7c9e6679-.... +// Location names the fields of the output that hold the ID of the +// resource a 201 created, such as job_id: the answer's Location header is +// the group's path and the value of each field, joined by /, such as +// /api/job/7c9e6679-... or /api/secret/default/registry-token. func (m *Method) Location( - field string, + fields ...string, ) *Method { - m.location = field + m.location = fields return m } -// LocationField is the field Location named, or "". -func (m *Method) LocationField() string { +// LocationFields are the fields Location named, or none. +func (m *Method) LocationFields() []string { return m.location } diff --git a/internal/controller/endpoint/endpoint_public_test.go b/internal/controller/endpoint/endpoint_public_test.go index 8ad1891bbe..5d8a31c650 100644 --- a/internal/controller/endpoint/endpoint_public_test.go +++ b/internal/controller/endpoint/endpoint_public_test.go @@ -594,7 +594,7 @@ func (s *EndpointPublicTestSuite) TestReadBack() { func (s *EndpointPublicTestSuite) TestLocation() { m := endpoint.Post[noInput, Node]("make").Status(http.StatusCreated).Location("name") - s.Equal("name", m.LocationField()) + s.Equal([]string{"name"}, m.LocationFields()) doc, err := endpoint.OpenAPI(endpoint.Define("node", "The nodes", m)) s.Require().NoError(err) diff --git a/internal/controller/endpoint/openapi.go b/internal/controller/endpoint/openapi.go index ad55e8ea3a..757e7561dd 100644 --- a/internal/controller/endpoint/openapi.go +++ b/internal/controller/endpoint/openapi.go @@ -268,7 +268,7 @@ func (b *builder) operation( return nil, fmt.Errorf("response: %w", err) } success = success.WithJSONSchemaRef(out) - if m.location != "" { + if len(m.location) > 0 { success.Headers = openapi3.Headers{"Location": &openapi3.HeaderRef{ Value: &openapi3.Header{Parameter: openapi3.Parameter{ Description: "The URL of the resource that the request created.", diff --git a/internal/controller/endpoint/server/server.go b/internal/controller/endpoint/server/server.go index edcc975762..cb8bd8dd3c 100644 --- a/internal/controller/endpoint/server/server.go +++ b/internal/controller/endpoint/server/server.go @@ -31,6 +31,7 @@ import ( "fmt" "log/slog" "net/http" + "net/url" "reflect" "strings" @@ -227,8 +228,13 @@ func Serve[D, In, Out any]( } respspan.Handled(c) - if f := m.LocationField(); f != "" { - c.Response().Header().Set("Location", "/api/"+g.Name+"/"+field(out, f)) + if fs := m.LocationFields(); len(fs) > 0 { + parts := make([]string, 0, len(fs)+1) + parts = append(parts, "/api/"+g.Name) + for _, f := range fs { + parts = append(parts, url.PathEscape(field(out, f))) + } + c.Response().Header().Set("Location", strings.Join(parts, "/")) } if m.SuccessStatus() == http.StatusNoContent { return c.NoContent(http.StatusNoContent) diff --git a/internal/controller/endpoint/server/server_public_test.go b/internal/controller/endpoint/server/server_public_test.go index 0d0104806d..66b0d2985e 100644 --- a/internal/controller/endpoint/server/server_public_test.go +++ b/internal/controller/endpoint/server/server_public_test.go @@ -70,6 +70,20 @@ func get( return thing{Name: in.Name + d.result}, d.err } +// pair is an output whose ID is two fields, such as a vault and a key. +type pair struct { + Vault string `json:"vault"` + Key string `json:"key"` +} + +func makePair( + _ context.Context, + d deps, + in getInput, +) (pair, error) { + return pair{Vault: "default", Key: in.Name + d.result}, d.err +} + func remove( _ context.Context, d deps, @@ -103,6 +117,8 @@ var group = endpoint.Define("thing", "Things", endpoint.Delete[getInput, struct{}]("remove").Handle(remove).Status(http.StatusNoContent), endpoint.Post[getInput, thing]("make").Sub("make").Handle(get).Public(). Status(http.StatusCreated).Location("name"), + endpoint.Post[getInput, pair]("pair").Sub("pair").Handle(makePair).Public(). + Status(http.StatusCreated).Location("vault", "key"), endpoint.Get[getInput, thing]("open").Sub("open").Handle(get).Public(). Answers(http.StatusServiceUnavailable, "Not ready."), ) @@ -140,6 +156,8 @@ func (s *ServerPublicTestSuite) serve( switch m.Name { case "remove": r.Handler = server.Serve(srv, group, m.Name, remove, decodeGet) + case "pair": + r.Handler = server.Serve(srv, group, m.Name, makePair, decodeGet) default: r.Handler = server.Serve(srv, group, m.Name, get, decodeGet) } @@ -177,6 +195,15 @@ func (s *ServerPublicTestSuite) TestServe() { wantBody: `{"name":"web7"}`, wantLoc: "/api/thing/web7", }, + { + name: "when the ID of a resource is two fields, the Location header joins them, escaped", + deps: deps{result: " x"}, + method: http.MethodPost, + path: "/api/thing/pair/web", + wantCode: http.StatusCreated, + wantBody: `{"vault":"default","key":"web x"}`, + wantLoc: "/api/thing/default/web%20x", + }, { name: "when the token grants the permission, the handler's output is the body", deps: deps{result: "!"}, diff --git a/internal/controller/endpoint/spec.go b/internal/controller/endpoint/spec.go index 5955fd4570..0c42f1b185 100644 --- a/internal/controller/endpoint/spec.go +++ b/internal/controller/endpoint/spec.go @@ -264,9 +264,9 @@ var Spec = guide.Spec{ }, { Kind: KindRefine, - Name: `.Location("field")`, - Does: "Gives a 201 the Location header: the group's path and the value of the output's field with that json name.", - When: "For each method that creates a resource and answers 201, such as job retry with job_id.", + Name: `.Location("field", ...)`, + Does: "Gives a 201 the Location header: the group's path, then the value of each output field with that json name, joined by / and escaped.", + When: "For each method that creates a resource and answers 201, such as job retry with job_id, or secret create with vault and key.", }, { Kind: KindRefine, diff --git a/internal/controller/endpoint/spec_public_test.go b/internal/controller/endpoint/spec_public_test.go index 229197a59d..6b3d654bce 100644 --- a/internal/controller/endpoint/spec_public_test.go +++ b/internal/controller/endpoint/spec_public_test.go @@ -59,7 +59,7 @@ var notDSL = map[string]bool{ "Handler": true, "Mapped": true, "SuccessStatus": true, - "LocationField": true, + "LocationFields": true, "Answering": true, "Saying": true, "Output": true, diff --git a/internal/controller/endpoint/validate.go b/internal/controller/endpoint/validate.go index 9210971af6..5715b5f646 100644 --- a/internal/controller/endpoint/validate.go +++ b/internal/controller/endpoint/validate.go @@ -371,9 +371,11 @@ func Validate( )) } } - if l := m.location; l != "" && !hasField(m.Out, l) { - add(m.Name, RuleField, fmt.Sprintf( - "Location names %s, which is not a json field of %s.", l, m.Out)) + for _, l := range m.location { + if !hasField(m.Out, l) { + add(m.Name, RuleField, fmt.Sprintf( + "Location names %s, which is not a json field of %s.", l, m.Out)) + } } paths := map[string]reflect.StructField{} diff --git a/internal/controller/endpoints/catalog/gen/api.yaml b/internal/controller/endpoints/catalog/gen/api.yaml index 55b21c97ad..eda8513f16 100644 --- a/internal/controller/endpoints/catalog/gen/api.yaml +++ b/internal/controller/endpoints/catalog/gen/api.yaml @@ -562,6 +562,7 @@ components: - PostNodeSysctl - PostNodeUser - PostNodeUserSshkey + - PostSecret - PutAgentConfig - PutFileByName - PutNodeCertificate diff --git a/internal/controller/endpoints/file/file.go b/internal/controller/endpoints/file/file.go index 8da9e4246d..2024acf791 100644 --- a/internal/controller/endpoints/file/file.go +++ b/internal/controller/endpoints/file/file.go @@ -118,26 +118,26 @@ var Group = endpoint.Register(endpoint.Define( Example("--name app.conf --json"). Errors(endpoint.NotFound(ErrNotFound, "File not found."), noStore503), endpoint.Put[UpdateInput, UploadResponse]("update"). - Fails("no file", UpdateInput{Name: "app.conf"}). - Fails("a name over 255 characters", UpdateInput{Name: long, File: content}). - Fails("a content type that is not raw or template", UpdateInput{Name: "app.conf", ContentType: notAContentType, File: content}). - Fails("an empty file", UpdateInput{Name: "app.conf", File: []byte{}}). Handle(Update). ID("PutFileByName"). Describe("Replace a file"). - Explain("Replace a file in the Object Store, or create it when the name is new."). - Returns("The file is new."). - Status(http.StatusCreated). - Location("name"). - Answers(http.StatusOK, "The file existed. changed says whether its content changed."). + Explain("Replace a file that exists in the Object Store. A name that is not there is "+ + "404: upload creates it."). + Returns("The file after the update. changed says whether its content changed."). Command("Replace a file in the Object Store", - "The command replaces the content of a stored file, or stores it when the\n"+ - "name is new. The same content changes nothing (`Changed: false`)."). + "The command replaces the content of a stored file. The same content\n"+ + "changes nothing (`Changed: false`). A name that is not there is refused\n"+ + "with 404: `file upload` creates it."). Example("--name app.conf --file /tmp/app.conf"). Prints(sampleUpload). Check("client file get", "--name app.conf", "name", "app.conf", "sha256", "{out.sha256}", "content_type", "raw"). + Fails("no file", UpdateInput{Name: "app.conf"}). + Fails("a name over 255 characters", UpdateInput{Name: long, File: content}). + Fails("a content type that is not raw or template", UpdateInput{Name: "app.conf", ContentType: notAContentType, File: content}). + Fails("an empty file", UpdateInput{Name: "app.conf", File: []byte{}}). Errors( + endpoint.NotFound(ErrNotFound, "No file has that name. Upload it with POST /api/file."), endpoint.Forbidden(ErrProtected, "The file is an osapi file, which a caller cannot write."), noStore503, ), diff --git a/internal/controller/endpoints/file/gen/api.yaml b/internal/controller/endpoints/file/gen/api.yaml index 89a41cd2c2..eee9856a75 100644 --- a/internal/controller/endpoints/file/gen/api.yaml +++ b/internal/controller/endpoints/file/gen/api.yaml @@ -470,7 +470,7 @@ paths: name: app.conf x-osapi-method: get put: - description: Replace a file in the Object Store, or create it when the name is new. + description: 'Replace a file that exists in the Object Store. A name that is not there is 404: upload creates it.' operationId: PutFileByName parameters: - description: The name of the file in the Object Store. @@ -507,18 +507,7 @@ paths: application/json: schema: $ref: '#/components/schemas/FileUploadResponse' - description: The file existed. changed says whether its content changed. - "201": - content: - application/json: - schema: - $ref: '#/components/schemas/FileUploadResponse' - description: The file is new. - headers: - Location: - description: The URL of the resource that the request created. - schema: - type: string + description: The file after the update. changed says whether its content changed. "400": content: application/json: @@ -537,6 +526,12 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' description: The file is an osapi file, which a caller cannot write. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: No file has that name. Upload it with POST /api/file. "500": content: application/json: diff --git a/internal/controller/endpoints/file/gen/cli.go b/internal/controller/endpoints/file/gen/cli.go index c16ecc8f59..7fabe548ba 100644 --- a/internal/controller/endpoints/file/gen/cli.go +++ b/internal/controller/endpoints/file/gen/cli.go @@ -74,7 +74,7 @@ var fileUpdateCmd = &cobra.Command{ }, Args: cobra.NoArgs, Example: " osapi client file update --name app.conf --file /tmp/app.conf", - Long: "The command replaces the content of a stored file, or stores it when the\nname is new. The same content changes nothing (`Changed: false`).", + Long: "The command replaces the content of a stored file. The same content\nchanges nothing (`Changed: false`). A name that is not there is refused\nwith 404: `file upload` creates it.", Run: func(cmd *cobra.Command, _ []string) { name, _ := cmd.Flags().GetString("name") contentType, _ := cmd.Flags().GetString("content-type") diff --git a/internal/controller/endpoints/file/methods.go b/internal/controller/endpoints/file/methods.go index 277f01e523..7adfc8c0a1 100644 --- a/internal/controller/endpoints/file/methods.go +++ b/internal/controller/endpoints/file/methods.go @@ -140,8 +140,9 @@ func Upload( return w.result(true), nil } -// Update replaces a file, or creates it when the name is new. The same -// content answers 200 and writes nothing. +// Update replaces a file that exists. A name that is not there is +// ErrNotFound: upload creates it. The same content answers with changed +// false and writes nothing. func Update( ctx context.Context, d Deps, @@ -157,20 +158,20 @@ func Update( w := write{name: in.Name, contentType: in.ContentType, data: in.File} existing, err := d.Objects.Info(ctx, in.Name) - if err != nil && !errors.Is(err, jetstream.ErrObjectNotFound) { + if errors.Is(err, jetstream.ErrObjectNotFound) || (err == nil && existing == nil) { + return UploadResponse{}, endpoint.Errorf(ErrNotFound, + "no file %s; upload it with file upload", in.Name) + } + if err != nil { return UploadResponse{}, endpoint.Internal("failed to get file info", err) } - existed := err == nil && existing != nil - if existed && existing.Digest == w.digest() { - return w.result(false), endpoint.Answer(200) + if existing.Digest == w.digest() { + return w.result(false), nil } if err := w.store(ctx, d.Objects); err != nil { return UploadResponse{}, err } - if existed { - return w.result(true), endpoint.Answer(200) - } return w.result(true), nil } diff --git a/internal/controller/endpoints/file/methods_public_test.go b/internal/controller/endpoints/file/methods_public_test.go index aa6feabfae..0869b997b5 100644 --- a/internal/controller/endpoints/file/methods_public_test.go +++ b/internal/controller/endpoints/file/methods_public_test.go @@ -322,21 +322,27 @@ func (s *MethodsPublicTestSuite) TestUploadAndUpdate() { wantErr: errBoom, }, { - name: "when an update names a new file, it is stored: 201", + name: "when an update names a file that is not there, it is ErrNotFound and writes nothing", update: true, fileName: "nginx.conf", setup: func() { s.objects.EXPECT(). Info(gomock.Any(), "nginx.conf"). Return(nil, jetstream.ErrObjectNotFound) - s.objects.EXPECT(). - Put(gomock.Any(), gomock.Any(), gomock.Any()). - Return(&jetstream.ObjectInfo{}, nil) }, - changed: true, + wantErr: file.ErrNotFound, }, { - name: "when an update has other content, it is replaced: 200", + name: "when the store has no info and no error, the update is ErrNotFound", + update: true, + fileName: "nginx.conf", + setup: func() { + s.objects.EXPECT().Info(gomock.Any(), "nginx.conf").Return(nil, nil) + }, + wantErr: file.ErrNotFound, + }, + { + name: "when an update has other content, it is replaced", update: true, fileName: "nginx.conf", setup: func() { @@ -345,17 +351,15 @@ func (s *MethodsPublicTestSuite) TestUploadAndUpdate() { Put(gomock.Any(), gomock.Any(), gomock.Any()). Return(&jetstream.ObjectInfo{}, nil) }, - wantCode: http.StatusOK, - changed: true, + changed: true, }, { - name: "when an update has the same content, nothing is written: 200", + name: "when an update has the same content, nothing is written", update: true, fileName: "nginx.conf", setup: func() { s.objects.EXPECT().Info(gomock.Any(), "nginx.conf").Return(exists, nil) }, - wantCode: http.StatusOK, }, { name: "when an update names an osapi file, it is ErrProtected", @@ -367,9 +371,7 @@ func (s *MethodsPublicTestSuite) TestUploadAndUpdate() { { name: "when the store fails, the update is a 500", update: true, fileName: "nginx.conf", setup: func() { - s.objects.EXPECT(). - Info(gomock.Any(), "nginx.conf"). - Return(nil, jetstream.ErrObjectNotFound) + s.objects.EXPECT().Info(gomock.Any(), "nginx.conf").Return(other, nil) s.objects.EXPECT(). Put(gomock.Any(), gomock.Any(), gomock.Any()). Return(nil, errBoom) @@ -776,6 +778,18 @@ func (s *MethodsPublicTestSuite) TestRoutes() { }, wantCode: http.StatusOK, }, + { + name: "when an update names a file that is not there, it is a 404", + method: http.MethodPut, + path: "/api/file/nginx.conf", + data: content, + token: token("file:write"), + setup: func() { + s.objects.EXPECT().Info(gomock.Any(), "nginx.conf"). + Return(nil, jetstream.ErrObjectNotFound) + }, + wantCode: http.StatusNotFound, + }, { name: "when the token has only file:read, an update is a 403", method: http.MethodPut, path: "/api/file/nginx.conf", data: content, token: token("file:read"), diff --git a/internal/controller/endpoints/secret/gen/api.go b/internal/controller/endpoints/secret/gen/api.go index 809724e76a..605b3d957b 100644 --- a/internal/controller/endpoints/secret/gen/api.go +++ b/internal/controller/endpoints/secret/gen/api.go @@ -38,6 +38,12 @@ func Routes( Permission: "secret:reveal", Handler: server.Serve(s, secret.Group, "reveal", secret.Reveal, decodeReveal), }, + { + Method: http.MethodPost, + Path: "/api/secret/:vault", + Permission: "secret:write", + Handler: server.Serve(s, secret.Group, "create", secret.Create, decodeCreate), + }, { Method: http.MethodPut, Path: "/api/secret/:vault/:key", diff --git a/internal/controller/endpoints/secret/gen/api.yaml b/internal/controller/endpoints/secret/gen/api.yaml index c2a01ce110..4752f8bfea 100644 --- a/internal/controller/endpoints/secret/gen/api.yaml +++ b/internal/controller/endpoints/secret/gen/api.yaml @@ -26,6 +26,29 @@ components: example: not_found type: string type: object + SecretCreateRequest: + properties: + key: + description: The name of the key, such as registry-token. + example: registry-token + maxLength: 128 + pattern: ^[a-zA-Z0-9_-]+$ + type: string + x-oapi-codegen-extra-tags: + validate: required,resource_name,max=128 + value: + description: 'The value of the key, which no method gives back. A secret: a reference, secret:///, or the value.' + format: password + maxLength: 65536 + type: string + writeOnly: true + x-oapi-codegen-extra-tags: + validate: required,max=65536 + x-osapi-secret: true + required: + - key + - value + type: object SecretInfo: properties: by: @@ -250,6 +273,89 @@ paths: input: vault: default x-osapi-method: list + post: + description: 'Write a value as version 1 of a new key. A key that exists is 409, whatever its value: update changes it. The answer is the metadata of the key. The API never gives the value back.' + operationId: PostSecret + parameters: + - description: The name of the vault, such as default. + in: path + name: vault + required: true + schema: + example: default + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + type: string + x-oapi-codegen-extra-tags: + validate: required,resource_name,max=64 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SecretCreateRequest' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/SecretInfo' + description: The key is new. + headers: + Location: + description: The URL of the resource that the request created. + schema: + type: string + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: The request is not valid. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Unauthorized - API key required + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Forbidden - Insufficient permissions + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: The controller has no vault with that name. + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: The key exists. Change it with PUT /api/secret/{vault}/{key}. + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: An error on the controller. + security: + - BearerAuth: + - secret:write + summary: Create a key + tags: + - secret_operations + x-osapi-area: secrets + x-osapi-examples: + - doc: Read the value from standard input + input: + key: registry-token + value: '-' + vault: default + x-osapi-method: create /api/secret/{vault}/{key}: delete: description: Delete a key from its vault. A request that uses its reference after that fails. @@ -400,7 +506,7 @@ paths: vault: default x-osapi-method: get put: - description: Write a value as the next version of a key, or as version 1 of a new key. The answer is the metadata of the key. The API never gives the value back. + description: 'Write a value as the next version of a key that exists. A key that is not there is 404: create makes it. The answer is the metadata of the key. The API never gives the value back.' operationId: PutSecret parameters: - description: The name of the vault, such as default. @@ -461,7 +567,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - description: The controller has no vault with that name. + description: The vault has no key with that name. Create it with POST. "500": content: application/json: @@ -471,7 +577,7 @@ paths: security: - BearerAuth: - secret:write - summary: Write the value of a key + summary: Change the value of a key tags: - secret_operations x-osapi-area: secrets diff --git a/internal/controller/endpoints/secret/gen/cli.go b/internal/controller/endpoints/secret/gen/cli.go index b238acfc8b..6461befbe0 100644 --- a/internal/controller/endpoints/secret/gen/cli.go +++ b/internal/controller/endpoints/secret/gen/cli.go @@ -80,6 +80,29 @@ var secretRevealCmd = &cobra.Command{ Use: "reveal", } +var secretCreateCmd = &cobra.Command{ + Annotations: map[string]string{ + reference.Permission: "secret:write", + reference.Result: "Read the value from standard input:\n\n```ansi\n$ osapi client secret create --vault default --key registry-token --value -\n\x1b[1;38;2;0;213;255mSecret:\x1b[0m\n\n \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n \x1b[38;2;10;143;176mVault:\x1b[0m default\n \x1b[38;2;10;143;176mKey:\x1b[0m registry-token\n \x1b[38;2;10;143;176mVersion:\x1b[0m 1\n \x1b[38;2;10;143;176mChanged:\x1b[0m 2026-01-15 10:00:00\n \x1b[38;2;10;143;176mBy:\x1b[0m ops@example.com\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"vault\": \"default\",\n \"key\": \"registry-token\",\n \"version\": 1,\n \"changed\": \"2026-01-15T10:00:00Z\",\n \"by\": \"ops@example.com\"\n}\n```", + }, + Args: cobra.NoArgs, + Example: " # Read the value from standard input\n osapi client secret create --vault default --key registry-token --value -", + Long: "The command reads the value from standard input with --value -, so the\nvalue is not in the shell history. A key that exists is refused with 409\nConflict: secret update changes it. A request then uses the key as\nsecret:///.", + Run: func(cmd *cobra.Command, _ []string) { + vault, _ := cmd.Flags().GetString("vault") + key, _ := cmd.Flags().GetString("key") + value, _ := cmd.Flags().GetString("value") + valueValue, ok := clicommand.Secret(cmd, "value", value) + if !ok { + return + } + + endpointcommand.Run(cmd, secret.Group, "create", secret.CreateInput{Vault: vault, Body: secret.CreateRequest{Key: key, Value: valueValue}}) + }, + Short: "Create a key in a vault", + Use: "create", +} + var secretUpdateCmd = &cobra.Command{ Annotations: map[string]string{ reference.Permission: "secret:write", @@ -87,7 +110,7 @@ var secretUpdateCmd = &cobra.Command{ }, Args: cobra.NoArgs, Example: " # Read the value from standard input\n osapi client secret update --vault default --key registry-token --value -", - Long: "The command reads the value from standard input with --value -, so the\nvalue is not in the shell history. A request then uses the key as\nsecret:///.", + Long: "The command reads the value from standard input with --value -, so the\nvalue is not in the shell history. A key that is not there is refused\nwith 404: secret create makes it.", Run: func(cmd *cobra.Command, _ []string) { vault, _ := cmd.Flags().GetString("vault") key, _ := cmd.Flags().GetString("key") @@ -99,7 +122,7 @@ var secretUpdateCmd = &cobra.Command{ endpointcommand.Run(cmd, secret.Group, "update", secret.UpdateInput{Vault: vault, Key: key, Body: secret.UpdateRequest{Value: valueValue}}) }, - Short: "Write the value of a key", + Short: "Change the value of a key", Use: "update", } @@ -132,6 +155,12 @@ func init() { _ = secretRevealCmd.MarkFlagRequired("vault") secretRevealCmd.Flags().String("key", "", "The name of the key, such as registry-token") _ = secretRevealCmd.MarkFlagRequired("key") + secretCreateCmd.Flags().String("vault", "", "The name of the vault, such as default") + _ = secretCreateCmd.MarkFlagRequired("vault") + secretCreateCmd.Flags().String("key", "", "The name of the key, such as registry-token") + _ = secretCreateCmd.MarkFlagRequired("key") + secretCreateCmd.Flags().String("value", "", "The value of the key, which no method gives back (a secret: secret:///, or - to read it from standard input)") + _ = secretCreateCmd.MarkFlagRequired("value") secretUpdateCmd.Flags().String("vault", "", "The name of the vault, such as default") _ = secretUpdateCmd.MarkFlagRequired("vault") secretUpdateCmd.Flags().String("key", "", "The name of the key, such as registry-token") @@ -142,5 +171,5 @@ func init() { _ = secretDeleteCmd.MarkFlagRequired("vault") secretDeleteCmd.Flags().String("key", "", "The name of the key, such as registry-token") _ = secretDeleteCmd.MarkFlagRequired("key") - clicommand.AddCommands(secret.Group, secretVaultsCmd, secretListCmd, secretGetCmd, secretRevealCmd, secretUpdateCmd, secretDeleteCmd) + clicommand.AddCommands(secret.Group, secretVaultsCmd, secretListCmd, secretGetCmd, secretRevealCmd, secretCreateCmd, secretUpdateCmd, secretDeleteCmd) } diff --git a/internal/controller/endpoints/secret/gen/decode.go b/internal/controller/endpoints/secret/gen/decode.go index aca1bdacb0..0935cdd365 100644 --- a/internal/controller/endpoints/secret/gen/decode.go +++ b/internal/controller/endpoints/secret/gen/decode.go @@ -69,6 +69,24 @@ func decodeReveal( return in, "", true } +// decodeCreate reads the create method's input from the request. +func decodeCreate( + c *echo.Context, +) (secret.CreateInput, string, bool) { + var in secret.CreateInput + if msg, ok := server.Body(c, &in.Body); !ok { + return in, msg, false + } + if msg, ok := server.Param(c, "vault", &in.Vault); !ok { + return in, msg, false + } + if msg, ok := server.Valid(c, in); !ok { + return in, msg, false + } + + return in, "", true +} + // decodeUpdate reads the update method's input from the request. func decodeUpdate( c *echo.Context, diff --git a/internal/controller/endpoints/secret/methods.go b/internal/controller/endpoints/secret/methods.go index 40fc3b51d5..7f14c7b035 100644 --- a/internal/controller/endpoints/secret/methods.go +++ b/internal/controller/endpoints/secret/methods.go @@ -121,8 +121,42 @@ func Reveal( return Value{Value: string(value)}, nil } -// Update writes the value as the next version of the key, and records the -// subject of the token as who changed it. The answer is the metadata. +// Create writes the value as version 1 of a new key, and records the +// subject of the token as who wrote it. A key that exists is ErrExists, +// whatever its value: update changes it. Create checks only that the key +// exists, from the list of the vault, and never reads a value. The answer +// is the metadata. +func Create( + ctx context.Context, + d Deps, + in CreateInput, +) (Info, error) { + v, err := open(d, in.Vault) + if err != nil { + return Info{}, err + } + + _, err = find(ctx, v, in.Vault, in.Body.Key) + switch { + case err == nil: + return Info{}, endpoint.Errorf(ErrExists, + "vault %s has key %s; change it with secret update", in.Vault, in.Body.Key) + case !errors.Is(err, ErrNoKey): + return Info{}, err + } + + ctx = vault.WithActor(ctx, authtoken.SubjectFrom(ctx)) + m, err := v.Put(ctx, in.Body.Key, []byte(in.Body.Value.Reveal())) + if err != nil { + return Info{}, endpoint.Internal("failed to write the key", err) + } + + return info(in.Vault, m), nil +} + +// Update writes the value as the next version of a key that exists, and +// records the subject of the token as who changed it. A key that is not +// there is ErrNoKey: create makes it. The answer is the metadata. func Update( ctx context.Context, d Deps, @@ -132,6 +166,13 @@ func Update( if err != nil { return Info{}, err } + if _, _, err := v.Get(ctx, in.Key); errors.Is(err, vault.ErrNotFound) { + return Info{}, endpoint.Errorf(ErrNoKey, + "vault %s has no key %s; make it with secret create", in.Vault, in.Key) + } else if err != nil { + return Info{}, endpoint.Internal("failed to read the key", err) + } + ctx = vault.WithActor(ctx, authtoken.SubjectFrom(ctx)) m, err := v.Put(ctx, in.Key, []byte(in.Body.Value.Reveal())) if err != nil { diff --git a/internal/controller/endpoints/secret/methods_public_test.go b/internal/controller/endpoints/secret/methods_public_test.go index a762dcadb2..c3589b262c 100644 --- a/internal/controller/endpoints/secret/methods_public_test.go +++ b/internal/controller/endpoints/secret/methods_public_test.go @@ -90,6 +90,10 @@ func (s *MethodsPublicTestSuite) TestNoVault() { _, err := secret.Get(ctx, d, secret.GetInput{Vault: "default", Key: "k"}) return err }, + func() error { + _, err := secret.Create(ctx, d, secret.CreateInput{Vault: "default", Body: secret.CreateRequest{Key: "k", Value: "v"}}) + return err + }, func() error { _, err := secret.Update(ctx, d, secret.UpdateInput{Vault: "default", Key: "k", Body: secret.UpdateRequest{Value: "v"}}) return err @@ -276,19 +280,109 @@ func (s *MethodsPublicTestSuite) TestGet() { } } -func (s *MethodsPublicTestSuite) TestUpdate() { +func (s *MethodsPublicTestSuite) TestCreate() { tests := []struct { - name string - setup func() - wantErr string + name string + setup func() + validateFunc func(got secret.Info, err error) }{ { - name: "when the vault writes the value, the answer is the metadata, with the subject as who", + name: "when the key is new, the vault writes version 1, with the subject as who", setup: func() { + s.vault.EXPECT().List(gomock.Any()).Return(nil, nil) s.vault.EXPECT().Put(gomock.Any(), "registry-token", []byte("s3cret")). DoAndReturn(func(ctx context.Context, key string, _ []byte) (vault.Meta, error) { - s.Equal("ops@example.com", vault.Actor(ctx), "the vault records who") + return vault.Meta{ + Key: key, + Version: 1, + Changed: changed, + By: vault.Actor(ctx), + }, nil + }) + }, + validateFunc: func(got secret.Info, err error) { + s.Require().NoError(err) + s.Equal(secret.Info{ + Vault: "default", + Key: "registry-token", + Version: 1, + Changed: changed, + By: "ops@example.com", + }, got) + }, + }, + { + name: "when the key exists with the same value, it is ErrExists, and no value is read or written", + setup: func() { + s.vault.EXPECT().List(gomock.Any()).Return([]vault.Meta{meta}, nil) + }, + validateFunc: func(_ secret.Info, err error) { + s.ErrorIs(err, secret.ErrExists) + s.ErrorContains(err, "change it with secret update") + s.NotContains(err.Error(), "s3cret") + }, + }, + { + name: "when the key exists with a different value, it is ErrExists, and no value is read or written", + setup: func() { + s.vault.EXPECT().List(gomock.Any()).Return([]vault.Meta{meta}, nil) + }, + validateFunc: func(_ secret.Info, err error) { + s.ErrorIs(err, secret.ErrExists) + s.NotContains(err.Error(), "s3cret") + }, + }, + { + name: "when the vault cannot list its keys, it is a failure of the controller", + setup: func() { + s.vault.EXPECT().List(gomock.Any()).Return(nil, errBoom) + }, + validateFunc: func(_ secret.Info, err error) { + s.ErrorContains(err, "failed to list the keys of the vault") + s.NotContains(err.Error(), "s3cret") + }, + }, + { + name: "when the vault cannot write, it is a failure of the controller", + setup: func() { + s.vault.EXPECT().List(gomock.Any()).Return(nil, nil) + s.vault.EXPECT().Put(gomock.Any(), "registry-token", gomock.Any()). + Return(vault.Meta{}, errBoom) + }, + validateFunc: func(_ secret.Info, err error) { + s.ErrorContains(err, "failed to write the key") + s.NotContains(err.Error(), "s3cret") + }, + }, + } + for _, tc := range tests { + s.Run(tc.name, func() { + s.hasDefault() + tc.setup() + ctx := authtoken.WithSubject(context.Background(), "ops@example.com") + got, err := secret.Create(ctx, s.deps(), secret.CreateInput{ + Vault: "default", + Body: secret.CreateRequest{Key: "registry-token", Value: "s3cret"}, + }) + tc.validateFunc(got, err) + }) + } +} +func (s *MethodsPublicTestSuite) TestUpdate() { + tests := []struct { + name string + setup func() + validateFunc func(got secret.Info, err error) + }{ + { + name: "when the key exists, the vault writes the next version, with the subject as who", + setup: func() { + s.vault.EXPECT(). + Get(gomock.Any(), "registry-token"). + Return([]byte("old"), meta, nil) + s.vault.EXPECT().Put(gomock.Any(), "registry-token", []byte("s3cret")). + DoAndReturn(func(ctx context.Context, key string, _ []byte) (vault.Meta, error) { return vault.Meta{ Key: key, Version: 4, @@ -297,14 +391,53 @@ func (s *MethodsPublicTestSuite) TestUpdate() { }, nil }) }, + validateFunc: func(got secret.Info, err error) { + s.Require().NoError(err) + s.Equal(secret.Info{ + Vault: "default", + Key: "registry-token", + Version: 4, + Changed: changed, + By: "ops@example.com", + }, got) + }, }, { - name: "when the vault fails, it is a failure of the controller", + name: "when the key is not there, it is ErrNoKey, and nothing is written", + setup: func() { + s.vault.EXPECT().Get(gomock.Any(), "registry-token"). + Return(nil, vault.Meta{}, vault.ErrNotFound) + }, + validateFunc: func(_ secret.Info, err error) { + s.ErrorIs(err, secret.ErrNoKey) + s.ErrorContains(err, "make it with secret create") + s.NotContains(err.Error(), "s3cret") + }, + }, + { + name: "when the vault cannot read the key, it is a failure of the controller", + setup: func() { + s.vault.EXPECT().Get(gomock.Any(), "registry-token"). + Return(nil, vault.Meta{}, errBoom) + }, + validateFunc: func(_ secret.Info, err error) { + s.ErrorContains(err, "failed to read the key") + s.NotContains(err.Error(), "s3cret") + }, + }, + { + name: "when the vault cannot write, it is a failure of the controller", setup: func() { + s.vault.EXPECT(). + Get(gomock.Any(), "registry-token"). + Return([]byte("old"), meta, nil) s.vault.EXPECT().Put(gomock.Any(), "registry-token", gomock.Any()). Return(vault.Meta{}, errBoom) }, - wantErr: "failed to write the key", + validateFunc: func(_ secret.Info, err error) { + s.ErrorContains(err, "failed to write the key") + s.NotContains(err.Error(), "s3cret") + }, }, } for _, tc := range tests { @@ -312,29 +445,12 @@ func (s *MethodsPublicTestSuite) TestUpdate() { s.hasDefault() tc.setup() ctx := authtoken.WithSubject(context.Background(), "ops@example.com") - got, err := secret.Update( - ctx, - s.deps(), - secret.UpdateInput{ - Vault: "default", - Key: "registry-token", - Body: secret.UpdateRequest{Value: "s3cret"}, - }, - ) - if tc.wantErr != "" { - s.ErrorContains(err, tc.wantErr) - s.NotContains(err.Error(), "s3cret") - - return - } - s.Require().NoError(err) - s.Equal(secret.Info{ - Vault: "default", - Key: "registry-token", - Version: 4, - Changed: changed, - By: "ops@example.com", - }, got) + got, err := secret.Update(ctx, s.deps(), secret.UpdateInput{ + Vault: "default", + Key: "registry-token", + Body: secret.UpdateRequest{Value: "s3cret"}, + }) + tc.validateFunc(got, err) }) } } @@ -488,13 +604,60 @@ func (s *MethodsPublicTestSuite) TestRoutes() { token: token("secret:write"), setup: func() { s.hasDefault() + s.vault.EXPECT(). + Get(gomock.Any(), "registry-token"). + Return([]byte("old"), meta, nil) s.vault.EXPECT().Put(gomock.Any(), "registry-token", []byte("s3cret")). - Return(vault.Meta{Key: "registry-token", Version: 1, Changed: changed, By: "test"}, nil) + Return(vault.Meta{Key: "registry-token", Version: 4, Changed: changed, By: "test"}, nil) }, wantCode: http.StatusOK, wantBody: `"by":"test"`, notBody: "s3cret", }, + { + name: "when a caller updates a key that is not there, it is a 404", + method: http.MethodPut, + path: "/api/secret/default/registry-token", + body: `{"value":"s3cret"}`, + token: token("secret:write"), + setup: func() { + s.hasDefault() + s.vault.EXPECT().Get(gomock.Any(), "registry-token"). + Return(nil, vault.Meta{}, vault.ErrNotFound) + }, + wantCode: http.StatusNotFound, + wantBody: "make it with secret create", + notBody: "s3cret", + }, + { + name: "when a caller creates a key, it is a 201 with no value", + method: http.MethodPost, + path: "/api/secret/default", + body: `{"key":"registry-token","value":"s3cret"}`, + token: token("secret:write"), + setup: func() { + s.hasDefault() + s.vault.EXPECT().List(gomock.Any()).Return(nil, nil) + s.vault.EXPECT().Put(gomock.Any(), "registry-token", []byte("s3cret")). + Return(vault.Meta{Key: "registry-token", Version: 1, Changed: changed, By: "test"}, nil) + }, + wantCode: http.StatusCreated, + wantBody: `"version":1`, + notBody: "s3cret", + }, + { + name: "when a caller creates a key that exists, it is a 409", + method: http.MethodPost, + path: "/api/secret/default", + body: `{"key":"registry-token","value":"s3cret"}`, + token: token("secret:write"), + setup: func() { + s.hasDefault() + s.vault.EXPECT().List(gomock.Any()).Return([]vault.Meta{meta}, nil) + }, + wantCode: http.StatusConflict, + notBody: "s3cret", + }, { name: "when a value is a reference, it is a 400 and nothing is written", method: http.MethodPut, diff --git a/internal/controller/endpoints/secret/samples.go b/internal/controller/endpoints/secret/samples.go index 1d25bf44f3..83afd0b783 100644 --- a/internal/controller/endpoints/secret/samples.go +++ b/internal/controller/endpoints/secret/samples.go @@ -65,6 +65,14 @@ var ( sampleValue = Value{Value: "glpat-xxxxxxxxxxxxxxxxxxxx"} + sampleCreate = Info{ + Vault: "default", + Key: "registry-token", + Version: 1, + Changed: time.Date(2026, 1, 15, 10, 0, 0, 0, time.UTC), + By: "ops@example.com", + } + sampleUpdate = Info{ Vault: "default", Key: "registry-token", @@ -80,3 +88,12 @@ func body( ) UpdateRequest { return UpdateRequest{Value: secretvalue.Value(strings.Repeat("v", n))} } + +// create is a create of key with a value of n bytes, for the inputs that +// Fails declares. +func create( + key string, + n int, +) CreateRequest { + return CreateRequest{Key: key, Value: secretvalue.Value(strings.Repeat("v", n))} +} diff --git a/internal/controller/endpoints/secret/secret.go b/internal/controller/endpoints/secret/secret.go index 1abedfc42c..5d962ec98d 100644 --- a/internal/controller/endpoints/secret/secret.go +++ b/internal/controller/endpoints/secret/secret.go @@ -40,6 +40,8 @@ var ( ErrNoVault = errors.New("vault not found") // ErrNoKey is a key that is not in its vault. ErrNoKey = errors.New("key not found") + // ErrExists is a key that exists. + ErrExists = errors.New("key exists") ) // noVault404 is the 404 of each method that names a vault. @@ -133,18 +135,53 @@ var Group = endpoint.Register(endpoint.Define( Fails("a key that is not letters, digits, - or _", RevealInput{Vault: "default", Key: "a.b"}). Fails("a key over 128 characters", RevealInput{Vault: "default", Key: long(129)}). Errors(noVault404, endpoint.NotFound(ErrNoKey, "The vault has no key with that name.")), + endpoint.Post[CreateInput, Info]("create"). + Handle(Create). + Key("vault"). + ID("PostSecret"). + Describe("Create a key"). + Explain("Write a value as version 1 of a new key. A key that exists is 409, whatever its "+ + "value: update changes it. The answer is the metadata of the key. The API never "+ + "gives the value back."). + Returns("The key is new."). + Status(http.StatusCreated). + Location("vault", "key"). + Command("Create a key in a vault", + "The command reads the value from standard input with --value -, so the\n"+ + "value is not in the shell history. A key that exists is refused with 409\n"+ + "Conflict: secret update changes it. A request then uses the key as\n"+ + "secret:///."). + Example("--vault default --key registry-token --value -", + "Read the value from standard input"). + Prints(sampleCreate). + Check("client secret get", "--vault default --key registry-token", + "vault", "default", "key", "registry-token", "version", "{out.version}", "value", command.Absent). + Check("client secret reveal", "--vault default --key registry-token", "value", "int-cli-value"). + Fails("no key", CreateInput{Vault: "default", Body: CreateRequest{Value: "v"}}). + Fails("no value", CreateInput{Vault: "default", Body: CreateRequest{Key: "k"}}). + Fails("a value over 64 KiB", CreateInput{Vault: "default", Body: create("k", 65537)}). + Fails("a vault name that is not letters, digits, - or _", CreateInput{Vault: "a.b", Body: create("k", 1)}). + Fails("a vault name over 64 characters", CreateInput{Vault: long(65), Body: create("k", 1)}). + Fails("a key that is not letters, digits, - or _", CreateInput{Vault: "default", Body: create("a.b", 1)}). + Fails("a key over 128 characters", CreateInput{Vault: "default", Body: create(long(129), 1)}). + Errors( + noVault404, + endpoint.Conflict(ErrExists, + "The key exists. Change it with PUT /api/secret/{vault}/{key}."), + ), endpoint.Put[UpdateInput, Info]("update"). Handle(Update). Key("vault", "key"). ID("PutSecret"). - Describe("Write the value of a key"). - Explain("Write a value as the next version of a key, or as version 1 of a new key. "+ - "The answer is the metadata of the key. The API never gives the value back."). + Describe("Change the value of a key"). + Explain("Write a value as the next version of a key that exists. A key that is not "+ + "there is 404: create makes it. The answer is the metadata of the key. The "+ + "API never gives the value back."). Returns("The metadata of the key after the write."). - Command("Write the value of a key", + Command("Change the value of a key", "The command reads the value from standard input with --value -, so the\n"+ - "value is not in the shell history. A request then uses the key as\n"+ - "secret:///."). + "value is not in the shell history. A key that is not there is refused\n"+ + "with 404: secret create makes it."). Example("--vault default --key registry-token --value -", "Read the value from standard input"). Prints(sampleUpdate). @@ -157,7 +194,7 @@ var Group = endpoint.Register(endpoint.Define( Fails("a vault name over 64 characters", UpdateInput{Vault: long(65), Key: "k", Body: body(1)}). Fails("a key that is not letters, digits, - or _", UpdateInput{Vault: "default", Key: "a.b", Body: body(1)}). Fails("a key over 128 characters", UpdateInput{Vault: "default", Key: long(129), Body: body(1)}). - Errors(noVault404), + Errors(noVault404, endpoint.NotFound(ErrNoKey, "The vault has no key with that name. Create it with POST.")), endpoint.Delete[DeleteInput, struct{}]("delete"). Handle(Delete). Key("vault", "key"). diff --git a/internal/controller/endpoints/secret/types.go b/internal/controller/endpoints/secret/types.go index 9bbe4d8f94..786f6d2468 100644 --- a/internal/controller/endpoints/secret/types.go +++ b/internal/controller/endpoints/secret/types.go @@ -60,14 +60,30 @@ type DeleteInput struct { Key string `json:"key" in:"path" validate:"required,resource_name,max=128" doc:"The name of the key, such as registry-token." example:"registry-token"` } -// UpdateInput is the key to write, and its new value. +// CreateInput is the vault of the new key, and the key with its first +// value. +type CreateInput struct { + Vault string `json:"vault" in:"path" validate:"required,resource_name,max=64" doc:"The name of the vault, such as default." example:"default"` + Body CreateRequest `json:"body" in:"body" validate:"required"` +} + +// CreateRequest is the name of the new key and its first value. The API +// never gives the value back. +type CreateRequest struct { + _ struct{} `schema:"SecretCreateRequest"` + + Key string `json:"key" validate:"required,resource_name,max=128" doc:"The name of the key, such as registry-token." example:"registry-token"` + Value secretvalue.Value `json:"value" validate:"required,max=65536" doc:"The value of the key, which no method gives back"` +} + +// UpdateInput is the key to change, and its new value. type UpdateInput struct { Vault string `json:"vault" in:"path" validate:"required,resource_name,max=64" doc:"The name of the vault, such as default." example:"default"` Key string `json:"key" in:"path" validate:"required,resource_name,max=128" doc:"The name of the key, such as registry-token." example:"registry-token"` Body UpdateRequest `json:"body" in:"body" validate:"required"` } -// UpdateRequest is the value of a key. The API never gives it back. +// UpdateRequest is the new value of a key. The API never gives it back. type UpdateRequest struct { _ struct{} `schema:"SecretUpdateRequest"` @@ -104,6 +120,6 @@ type Info struct { // ListResponse is the metadata of each key of a vault. type ListResponse struct { _ struct{} `title:"Keys" schema:"SecretListResponse"` - Items []Info ` json:"items" doc:"The keys of the vault, sorted by key." empty:"The vault has no key. Add one with osapi client secret update."` + Items []Info ` json:"items" doc:"The keys of the vault, sorted by key." empty:"The vault has no key. Add one with osapi client secret create."` TotalItems int ` json:"total_items" doc:"The number of keys." example:"1"` } diff --git a/internal/dslcheck/testdata/strings.txt b/internal/dslcheck/testdata/strings.txt index 970d815e94..bdfddc818b 100644 --- a/internal/dslcheck/testdata/strings.txt +++ b/internal/dslcheck/testdata/strings.txt @@ -232,7 +232,7 @@ endpoint.Method.Explain(text string) free text prose for a page or a message endpoint.Method.Fails(doc string) free text prose for a page or a message endpoint.Method.ID(id string) identity a name that the registry, the route or the command path holds endpoint.Method.Key(fields []string) checked the path fields of the input; the key rule checks each -endpoint.Method.Location(field string) checked a json field of the output; the field rule checks it +endpoint.Method.Location(fields []string) checked json fields of the output; the field rule checks each endpoint.Method.Name string identity a name that the registry, the route or the command path holds endpoint.Method.NoCheck(why string) free text a reason that a person reads endpoint.Method.Notes(text string) free text prose for a page or a message diff --git a/internal/skills/resources/skills/osapi-operations/references/fleet.md b/internal/skills/resources/skills/osapi-operations/references/fleet.md index ad0b62fd29..db492b5ed6 100644 --- a/internal/skills/resources/skills/osapi-operations/references/fleet.md +++ b/internal/skills/resources/skills/osapi-operations/references/fleet.md @@ -31,7 +31,8 @@ osapi client file upload --name nginx.conf --file ./nginx.conf --content-type te osapi client file list --json osapi client file stale list --json # deployments whose file changed since osapi client secret vault list --json -osapi client secret update --vault default --key registry-token --value - --json # the value on standard input +osapi client secret create --vault default --key registry-token --value - --json # the value on standard input +osapi client secret update --vault default --key registry-token --value - --json # a new value for a key that exists osapi client secret list --vault default --json # names and metadata, never a value ``` diff --git a/internal/skills/resources/skills/osapi/SKILL.md b/internal/skills/resources/skills/osapi/SKILL.md index faa479f05e..61ba167f66 100644 --- a/internal/skills/resources/skills/osapi/SKILL.md +++ b/internal/skills/resources/skills/osapi/SKILL.md @@ -38,8 +38,9 @@ host. 5. **Give a secret as a reference.** A secret field, such as a password or the `--env` of a container, takes `secret:///`. Put the value in a vault first, from standard input: - `osapi client secret update --vault default --key registry-token --value - < token.txt`. - Then give `secret://default/registry-token`. + `osapi client secret create --vault default --key registry-token --value - < token.txt`. + `osapi client secret update` changes a key that exists. Then give + `secret://default/registry-token`. `osapi client secret list --vault default --json` gives the keys. Never put a value in a flag, a plan or a file: the shell history and the disk keep it. diff --git a/pkg/sdk/client/catalog_types.gen.go b/pkg/sdk/client/catalog_types.gen.go index d5900eb16f..5e0b81032c 100644 --- a/pkg/sdk/client/catalog_types.gen.go +++ b/pkg/sdk/client/catalog_types.gen.go @@ -390,6 +390,7 @@ const ( OperationIDPostNodeSysctl OperationID = "PostNodeSysctl" OperationIDPostNodeUser OperationID = "PostNodeUser" OperationIDPostNodeUserSshkey OperationID = "PostNodeUserSshkey" + OperationIDPostSecret OperationID = "PostSecret" OperationIDPutAgentConfig OperationID = "PutAgentConfig" OperationIDPutFileByName OperationID = "PutFileByName" OperationIDPutNodeCertificate OperationID = "PutNodeCertificate" diff --git a/pkg/sdk/client/file_upload.go b/pkg/sdk/client/file_upload.go index c86df2952b..7fb8696c07 100644 --- a/pkg/sdk/client/file_upload.go +++ b/pkg/sdk/client/file_upload.go @@ -75,8 +75,8 @@ func (s *FileService) Upload( return s.sendForm(ctx, http.MethodPost, "/api/file", formType, body) } -// Update replaces a file in the Object Store, or creates it when the name -// is new. +// Update replaces a file that exists in the Object Store. A name that is +// not there is a NotFoundError: Upload creates it. func (s *FileService) Update( ctx context.Context, name string, diff --git a/pkg/sdk/client/secret.gen.go b/pkg/sdk/client/secret.gen.go index 545e1becd2..7f5e5ec7fa 100644 --- a/pkg/sdk/client/secret.gen.go +++ b/pkg/sdk/client/secret.gen.go @@ -39,6 +39,34 @@ func (s *SecretService) List( return send[SecretListResponse](ctx, s.client, http.MethodGet, "/api/secret/"+url.PathEscape(vault), nil, nil) } +// SecretCreateInput is the input of SecretService.Create. A field of the path +// goes in the path, and each other field in the body. +type SecretCreateInput struct { + // The vault of the path: the name of the vault, such as default. + Vault string `json:"-"` + + // The name of the key, such as registry-token. + Key string `json:"key"` + + // The value of the key, which no method gives back. A secret: a reference, + // secret:///, or the value. + Value string `json:"value"` +} + +// Create is the operation PostSecret: create a key. +// +// Write a value as version 1 of a new key. A key that exists is 409, whatever +// its value: update changes it. The answer is the metadata of the key. The API +// never gives the value back. +// +// It sends POST /api/secret/{vault}, and needs the permission secret:write. +func (s *SecretService) Create( + ctx context.Context, + input SecretCreateInput, +) (*Response[SecretInfo], error) { + return send[SecretInfo](ctx, s.client, http.MethodPost, "/api/secret/"+url.PathEscape(input.Vault), nil, input) +} + // Get is the operation GetSecret: get the metadata of a key. // // Get the version of a key, when it changed and who changed it. The answer has @@ -68,10 +96,11 @@ type SecretUpdateInput struct { Value string `json:"value"` } -// Update is the operation PutSecret: write the value of a key. +// Update is the operation PutSecret: change the value of a key. // -// Write a value as the next version of a key, or as version 1 of a new key. -// The answer is the metadata of the key. The API never gives the value back. +// Write a value as the next version of a key that exists. A key that is not +// there is 404: create makes it. The answer is the metadata of the key. The +// API never gives the value back. // // It sends PUT /api/secret/{vault}/{key}, and needs the permission // secret:write. diff --git a/pkg/sdk/client/spec.gen.go b/pkg/sdk/client/spec.gen.go index 077aa27db5..88949e98be 100644 --- a/pkg/sdk/client/spec.gen.go +++ b/pkg/sdk/client/spec.gen.go @@ -962,6 +962,14 @@ func Services() []ServiceSpec { Name: "List", Permission: "secret:read", Result: "SecretListResponse", + }, { + Doc: "Create a key", + Examples: 1, + HTTP: "POST /api/secret/{vault}", + Input: "SecretCreateInput", + Name: "Create", + Permission: "secret:write", + Result: "SecretInfo", }, { Doc: "Get the metadata of a key", Examples: 1, @@ -970,7 +978,7 @@ func Services() []ServiceSpec { Permission: "secret:read", Result: "SecretInfo", }, { - Doc: "Write the value of a key", + Doc: "Change the value of a key", Examples: 1, HTTP: "PUT /api/secret/{vault}/{key}", Input: "SecretUpdateInput", diff --git a/test/integration/authz_allow_test.go b/test/integration/authz_allow_test.go index 584e6dc7b3..5ead3fc0c3 100644 --- a/test/integration/authz_allow_test.go +++ b/test/integration/authz_allow_test.go @@ -181,10 +181,16 @@ func (s *AuthorizationSuite) TestAuditOfAWrite() { s.Require().NoError(err) key := fmt.Sprintf("authz-%d", time.Now().UnixNano()) value := "authz-value-" + key - put := route{method: http.MethodPut, path: "/api/secret/default/" + key} - code, data := s.sendBody(put, admin, `{"value":"`+value+`"}`) + put := route{method: http.MethodPost, path: "/api/secret/default"} + code, data := s.sendBody(put, admin, `{"key":"`+key+`","value":"`+value+`"}`) s.Require().Less(code, 300, "%s", data) - defer func() { _, _ = s.sendBody(route{method: http.MethodDelete, path: put.path}, admin, "") }() + defer func() { + _, _ = s.sendBody( + route{method: http.MethodDelete, path: put.path + "/" + key}, + admin, + "", + ) + }() var log struct { Items []map[string]any `json:"items"` @@ -203,11 +209,11 @@ func (s *AuthorizationSuite) TestAuditOfAWrite() { s.Require().NotEmpty(log.Items, "the write is in the audit log") found := false for _, e := range log.Items { - if e["method"] == http.MethodPut && e["path"] == put.path { + if e["method"] == http.MethodPost && e["path"] == put.path { found = true s.Equal(user, e["user"]) } } - s.True(found, "an entry has PUT %s", put.path) + s.True(found, "an entry has POST %s", put.path) s.NotContains(string(data), value, "the audit log has no secret value") } diff --git a/test/integration/scenarios_test.go b/test/integration/scenarios_test.go index 1ffe650b90..b18cc5c295 100644 --- a/test/integration/scenarios_test.go +++ b/test/integration/scenarios_test.go @@ -622,7 +622,7 @@ func sealScenarios() []scenario { cli: []string{ "client", "secret", - "update", + "create", "--vault", "default", "--key", diff --git a/ui/src/pages/secrets.tsx b/ui/src/pages/secrets.tsx index 96a4ac42f3..5e5204641d 100644 --- a/ui/src/pages/secrets.tsx +++ b/ui/src/pages/secrets.tsx @@ -26,6 +26,7 @@ import { deleteSecret, getSecretVaults, getSecrets, + postSecret, putSecret, } from "@/sdk/gen/secret-management-api-secret-operations/secret-management-api-secret-operations"; @@ -72,8 +73,12 @@ export function Secrets() { const write = async (key: string, value: string) => { setActionError(null); - const res = await putSecret(vault, key, { value }); - if (res.status !== 200) { + // A key in the list gets a new version; a new key is created. + const exists = rows.some((r) => r.key === key); + const res = exists + ? await putSecret(vault, key, { value }) + : await postSecret(vault, { key, value }); + if (res.status !== 200 && res.status !== 201) { setActionError( (res.data as { error?: string } | undefined)?.error ?? "Failed to write the key", @@ -144,7 +149,7 @@ export function Secrets() { - {canCall("PutSecret") && ( + {(canCall("PostSecret") || canCall("PutSecret")) && (
Write a value diff --git a/ui/src/sdk/gen/file-management-api-file-operations/file-management-api-file-operations.ts b/ui/src/sdk/gen/file-management-api-file-operations/file-management-api-file-operations.ts index b0c5900154..80d1af333d 100644 --- a/ui/src/sdk/gen/file-management-api-file-operations/file-management-api-file-operations.ts +++ b/ui/src/sdk/gen/file-management-api-file-operations/file-management-api-file-operations.ts @@ -294,11 +294,6 @@ export type putFileByNameResponse200 = { status: 200 } -export type putFileByNameResponse201 = { - data: FileUploadResponse - status: 201 -} - export type putFileByNameResponse400 = { data: ErrorResponse status: 400 @@ -314,6 +309,11 @@ export type putFileByNameResponse403 = { status: 403 } +export type putFileByNameResponse404 = { + data: ErrorResponse + status: 404 +} + export type putFileByNameResponse500 = { data: ErrorResponse status: 500 @@ -324,10 +324,10 @@ export type putFileByNameResponse503 = { status: 503 } -export type putFileByNameResponseSuccess = (putFileByNameResponse200 | putFileByNameResponse201) & { +export type putFileByNameResponseSuccess = (putFileByNameResponse200) & { headers: Headers; }; -export type putFileByNameResponseError = (putFileByNameResponse400 | putFileByNameResponse401 | putFileByNameResponse403 | putFileByNameResponse500 | putFileByNameResponse503) & { +export type putFileByNameResponseError = (putFileByNameResponse400 | putFileByNameResponse401 | putFileByNameResponse403 | putFileByNameResponse404 | putFileByNameResponse500 | putFileByNameResponse503) & { headers: Headers; }; @@ -342,7 +342,7 @@ export const getPutFileByNameUrl = (name: string,) => { } /** - * Replace a file in the Object Store, or create it when the name is new. + * Replace a file that exists in the Object Store. A name that is not there is 404: upload creates it. * @summary Replace a file */ export const putFileByName = async (name: string, diff --git a/ui/src/sdk/gen/schemas/index.ts b/ui/src/sdk/gen/schemas/index.ts index 3731f4f9f6..02a931ef22 100644 --- a/ui/src/sdk/gen/schemas/index.ts +++ b/ui/src/sdk/gen/schemas/index.ts @@ -262,6 +262,7 @@ export * from './scheduleResult'; export * from './scheduleUpdateRequest'; export * from './scheduleUpdateRequestVars'; export * from './scheduleUpdateResponse'; +export * from './secretCreateRequest'; export * from './secretInfo'; export * from './secretListResponse'; export * from './secretUpdateRequest'; diff --git a/ui/src/sdk/gen/schemas/operationID.ts b/ui/src/sdk/gen/schemas/operationID.ts index 19e19ece43..9bc627f65c 100644 --- a/ui/src/sdk/gen/schemas/operationID.ts +++ b/ui/src/sdk/gen/schemas/operationID.ts @@ -124,6 +124,7 @@ export const OperationID = { PostNodeSysctl: 'PostNodeSysctl', PostNodeUser: 'PostNodeUser', PostNodeUserSshkey: 'PostNodeUserSshkey', + PostSecret: 'PostSecret', PutAgentConfig: 'PutAgentConfig', PutFileByName: 'PutFileByName', PutNodeCertificate: 'PutNodeCertificate', diff --git a/ui/src/sdk/gen/schemas/secretCreateRequest.ts b/ui/src/sdk/gen/schemas/secretCreateRequest.ts new file mode 100644 index 0000000000..5b885faea0 --- /dev/null +++ b/ui/src/sdk/gen/schemas/secretCreateRequest.ts @@ -0,0 +1,20 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * osapi + * OpenAPI spec version: 1.0.0 + */ + +export interface SecretCreateRequest { + /** + * The name of the key, such as registry-token. + * @maxLength 128 + * @pattern ^[a-zA-Z0-9_-]+$ + */ + key: string; + /** + * The value of the key, which no method gives back. A secret: a reference, secret:///, or the value. + * @maxLength 65536 + */ + value: string; +} diff --git a/ui/src/sdk/gen/secret-management-api-secret-operations/secret-management-api-secret-operations.ts b/ui/src/sdk/gen/secret-management-api-secret-operations/secret-management-api-secret-operations.ts index 661e5eefeb..6cdb5d56d6 100644 --- a/ui/src/sdk/gen/secret-management-api-secret-operations/secret-management-api-secret-operations.ts +++ b/ui/src/sdk/gen/secret-management-api-secret-operations/secret-management-api-secret-operations.ts @@ -6,6 +6,7 @@ */ import type { ErrorResponse, + SecretCreateRequest, SecretInfo, SecretListResponse, SecretUpdateRequest, @@ -151,6 +152,75 @@ export const getSecrets = async (vault: string, options?: Parameters { + + + + + return `/api/secret/${vault}` +} + +/** + * Write a value as version 1 of a new key. A key that exists is 409, whatever its value: update changes it. The answer is the metadata of the key. The API never gives the value back. + * @summary Create a key + */ +export const postSecret = async (vault: string, + secretCreateRequest: SecretCreateRequest, options?: Parameters[1]): Promise => { + + return apiFetch(getPostSecretUrl(vault), + { + ...options, + method: 'POST', + headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers), + body: JSON.stringify(secretCreateRequest) + } +);} + + export type deleteSecretResponse204 = { data: void status: 204 @@ -330,8 +400,8 @@ export const getPutSecretUrl = (vault: string, } /** - * Write a value as the next version of a key, or as version 1 of a new key. The answer is the metadata of the key. The API never gives the value back. - * @summary Write the value of a key + * Write a value as the next version of a key that exists. A key that is not there is 404: create makes it. The answer is the metadata of the key. The API never gives the value back. + * @summary Change the value of a key */ export const putSecret = async (vault: string, key: string,