#pragma once // Operations of online evaluators (aiplatform v1 // projects.locations.onlineEvaluators.operations: get, list, cancel, delete, // wait). An online evaluator's activate, suspend and create calls return // long-running operations that live under the evaluator. #include #include #include "google/operation.h" #include "google/optimize/optimize_service.h" #include "google/resource.h" namespace molo::google::optimize { struct OperationPage { std::vector operations; bool truncated = false; // More existed past the page/item caps. std::string next_page_token; // Continues a truncated list. }; class OnlineEvaluatorOperations : public OptimizeService { public: OnlineEvaluatorOperations(std::shared_ptr client, CloudContext context); // Names: projects/{p}/locations/{l}/onlineEvaluators/{id}/operations/{op}. static bool is_operation_name(const std::string& name); clients::body::Json get(const std::string& operation_name) const; // Operations under projects/{p}/locations/{l}/onlineEvaluators/{id}. OperationPage list(const std::string& evaluator_name, const std::string& filter = "", int page_size = 0) const; void cancel(const std::string& operation_name) const; // Destructive: removes the operation record only. void remove(const std::string& operation_name) const; // One server-side wait, 1..OptimizeCaps::kMaxServerWaitSeconds; the reply // may be not done. A failed operation throws. Operation wait_server(const std::string& operation_name, int timeout_seconds) const; }; } // namespace molo::google::optimize