Files
retoorandClaude Sonnet 5.5 cb70bb1116 feat(clients): registry: Agent Registry, Agent Gateway, Agent Identity from discovery call table
86-row call table checked against Google discovery documents, typed
services, local approval ledger, live read-only tests, /agent/registry demo.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 04:42:00 +02:00

26 lines
1.3 KiB
C++

// Route: POST /agent/registry/identity/principal (local builder, no credential needed)
#include "support/GoogleRig.hpp"
#include <cstdlib>
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
const std::string json = "application/json";
GoogleRig rig(false);
Fixture f(rig.client);
auto res = f.client->post("/agent/registry/identity/principal",
"{\"org_id\":\"123\",\"project_number\":\"456\",\"agent\":\"engine-1\"}", json);
check(res.status == 200, "status 200 without a credential");
check(contains(res.body, "principal://agents.global.org-123.system.id.goog/aiplatform/engine-1"), "principal built");
check(contains(res.body, "attribute.platformContainer/aiplatform/projects/456"), "project set built");
check(contains(res.body, "attribute.platform/aiplatform"), "org set built");
check(f.client->post("/agent/registry/identity/principal", "{\"org_id\":\"12x\"}", json).status == 422,
"non numeric org is 422");
check(f.client->post("/agent/registry/identity/principal", "{\"org_id\":\"1\",\"agent\":\"a/b\"}", json).status == 422,
"bad agent name is 422");
check(f.client->get("/agent/registry/identity/principal").status == 405, "get is 405");
check(rig.mock->send_count() == 0, "side effect: no upstream traffic");
return finish("agent/registry/identity/principal");
}