Files
moloapp/src/google/sessions/operation_names.h
T
retoorandClaude Sonnet 5.5 a3396bfc68 feat(clients): sessions+registry+optimize+armor: close gaps, loud list truncation, shared Gemini adapter
sessions: operations get/list/cancel/delete/wait for engine, session, memory and
serving profile; servingProfiles CRUD. registry: ListResult with truncated flag,
v1alpha twins, gateway/policy operations, authz IAM, deny policy update, boundary
patch/bindings. optimize: make_gemini_model over models::VertexModel (DirectModel
removed), generateSyntheticData, online evaluator operations, trace/log writers.
armor: SecurityAdmin for all SCC v2 methods (attack exposure excluded), documented
agent threat categories, floor settings fixed to location global after live run.
check_discovery.py of all four enforce coverage.

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

45 lines
1.8 KiB
C++

#pragma once
// A validated long-running operation name and the table row that serves each
// verb for it. Discovery lists the same five operations methods (get, list,
// cancel, delete, wait) under the Agent Engine, under each session, under
// each memory and under each serving profile; the owner is read from the
// name so a caller can never reach an operation outside the root it passed.
#include <string>
#include "google/sessions/calls.h"
namespace molo::google::sessions {
enum class OperationOwner { kEngine, kSession, kMemory, kServingProfile };
enum class OperationVerb { kGet, kCancel, kList, kDelete, kWait };
class OperationName {
public:
// `root` is an engine name (owners engine, session, memory) or a location
// name "projects/{p}/locations/{l}" (owner serving profile). `name` must be
// "{root}[/{sessions|memories|servingProfiles}/{id}]/operations/{op}".
// Throws GoogleError::invalid otherwise.
static OperationName parse(const std::string& root, const std::string& name);
// A list parent: "{root}", "{root}/sessions/{id}", "{root}/memories/{id}" or
// "{root}/servingProfiles/{id}". Same validation, no trailing operation.
static OperationName parse_parent(const std::string& root, const std::string& parent);
const std::string& str() const { return full_; }
OperationOwner owner() const { return owner_; }
// The table row serving a verb for this owner.
Call call(OperationVerb verb) const;
private:
OperationName(std::string full, OperationOwner owner)
: full_(std::move(full)), owner_(owner) {}
static OperationName classify(const std::string& root, const std::string& rest,
const std::string& full, bool want_operation);
std::string full_;
OperationOwner owner_;
};
} // namespace molo::google::sessions