Files
moloapp/src/google/runtime/engine.h
T

55 lines
1.5 KiB
C++
Raw Normal View History

#pragma once
// A reasoning engine (Agent Engine) as Google returns it, plus the input
// types for create and update.
#include <map>
#include <optional>
#include <string>
#include "clients/body/json.h"
#include "google/runtime/deployment_spec.h"
namespace molo::google::runtime {
struct Engine {
std::string name; // projects/{p}/locations/{l}/reasoningEngines/{id}
std::string display_name;
std::string description;
std::string etag;
std::string create_time;
std::string update_time;
std::map<std::string, std::string> labels;
EngineSpec spec;
std::string kms_key_name; // encryptionSpec.kmsKeyName
clients::body::Json raw; // the full response document
std::string id() const; // last segment of name
static Engine from_json(const clients::body::Json& doc);
};
struct EngineDraft {
std::string display_name; // required
std::string description;
std::map<std::string, std::string> labels;
EngineSpec spec;
std::string kms_key_name; // optional customer-managed key
void validate() const;
clients::body::Json to_json() const;
};
// Only the set fields are sent; updateMask is derived from them.
struct EngineUpdate {
std::optional<std::string> display_name;
std::optional<std::string> description;
std::optional<std::map<std::string, std::string>> labels;
std::optional<EngineSpec> spec;
void validate() const;
clients::body::Json to_json() const;
std::string update_mask() const; // comma separated, never empty after validate()
};
} // namespace molo::google::runtime