#pragma once // Shared by the registry, gateway and policy services: finish a mutation's // long-running operation, and the read-before-mutate existence probe. #include #include #include "google/operation.h" namespace molo::google::registry { class OperationRunner { public: // Takes the reply of a create/patch/delete call. Returns {"operation":name} // once done; polls through wait_operation (capped) when not yet done. static clients::body::Json finish(GoogleClient& client, const ServiceEndpoint& endpoint, const clients::body::Json& reply, const Sleeper& sleeper); // True when `probe` returns, false on HTTP 404, rethrows anything else. static bool exists(const std::function& probe); }; } // namespace molo::google::registry