Files
moloapp/src/google/ops/cloud_tasks.h
T
retoorandClaude Sonnet 5.5 18ec8b720e feat(clients): ops: 20 Google Cloud operations APIs, 418 Discovery-derived calls
Compute, Cloud Run, Functions, GKE, Build, Artifact Registry, IAM, IAM
Credentials, Resource Manager, Service Usage, Logging, Monitoring, Scheduler,
Tasks, Workflows, Eventarc, Billing, Asset, Org Policy. Generated call table
checked against Discovery, validated plans, dry-run default for writes
(enable/disable never live), /google/ops demo routes, live read-only probe.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 15:23:56 +01:00

60 lines
2.5 KiB
C++

#pragma once
// Cloud Tasks v2. `parent` is projects/{p}/locations/{l}; tasks hang off a
// full queue name.
#include "google/ops/ops_product.h"
namespace molo::google::ops {
class CloudTasks : public OpsProduct {
public:
using Json = clients::body::Json;
explicit CloudTasks(std::shared_ptr<GoogleClient> c, Sleeper s = nullptr)
: OpsProduct(std::move(c), "cloudtasks", std::move(s)) {}
Json queues(const std::string& parent) const {
return list("cloudtasks.projects.locations.queues.list", at("parent", parent));
}
Json queue(const std::string& name) const {
return read("cloudtasks.projects.locations.queues.get", at("name", name));
}
Json tasks(const std::string& queue_name) const {
return list("cloudtasks.projects.locations.queues.tasks.list", at("parent", queue_name));
}
Json task(const std::string& name) const {
return read("cloudtasks.projects.locations.queues.tasks.get", at("name", name));
}
Outcome create_queue(const std::string& parent, const Json& queue, bool confirm = false) const {
return call("cloudtasks.projects.locations.queues.create", at("parent", parent).body(queue),
confirm);
}
Outcome pause_queue(const std::string& name, bool confirm = false) const {
return call("cloudtasks.projects.locations.queues.pause", at("name", name), confirm);
}
Outcome resume_queue(const std::string& name, bool confirm = false) const {
return call("cloudtasks.projects.locations.queues.resume", at("name", name), confirm);
}
Outcome create_task(const std::string& queue_name, const Json& task, bool confirm = false) const {
Args a = at("parent", queue_name);
a.field("task", task);
return call("cloudtasks.projects.locations.queues.tasks.create", a, confirm);
}
Outcome run_task(const std::string& name, bool confirm = false) const {
return call("cloudtasks.projects.locations.queues.tasks.run", at("name", name), confirm);
}
// Destructive: no default.
Outcome purge_queue(const std::string& name, bool confirm) const {
return call("cloudtasks.projects.locations.queues.purge", at("name", name), confirm);
}
Outcome delete_queue(const std::string& name, bool confirm) const {
return call("cloudtasks.projects.locations.queues.delete", at("name", name), confirm);
}
Outcome delete_task(const std::string& name, bool confirm) const {
return call("cloudtasks.projects.locations.queues.tasks.delete", at("name", name), confirm);
}
};
} // namespace molo::google::ops