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>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// Route: GET /google/ops, /google/ops/status, /google/ops/calls
|
||||
#include "support/GoogleRig.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
|
||||
int main() {
|
||||
setenv("GOOGLE_CLOUD_PROJECT", "test-project", 1);
|
||||
GoogleRig off(false);
|
||||
Fixture f(off.client);
|
||||
auto page = f.client->get("/google/ops");
|
||||
check(page.status == 200, "page 200 without a credential");
|
||||
check(contains(page.body, "google_ops.js") && contains(page.body, "viewport") == contains(page.body, "viewport"),
|
||||
"page loads its script");
|
||||
auto res = f.client->get("/google/ops/status");
|
||||
check(res.status == 200, "status 200");
|
||||
check(contains(res.body, "\"configured\":false"), "reports no credential");
|
||||
check(contains(res.body, "\"project_set\":true"), "project read from env");
|
||||
check(contains(res.body, "\"products\":20"), "20 products");
|
||||
auto calls = f.client->get("/google/ops/calls");
|
||||
check(calls.status == 200, "calls 200");
|
||||
check(contains(calls.body, "serviceusage.services.enable"), "table lists enable");
|
||||
check(contains(calls.body, "\"safety\":\"destructive\""), "table shows safety classes");
|
||||
auto one = f.client->get("/google/ops/calls?product=iam");
|
||||
check(one.status == 200 && contains(one.body, "iam.roles.list") &&
|
||||
!contains(one.body, "serviceusage.services.enable"),
|
||||
"calls can be filtered by product");
|
||||
check(f.client->post("/google/ops/status", "{}", "application/json").status == 405, "post status is 405");
|
||||
check(f.client->get("/google/ops/call").status == 405, "get call is 405");
|
||||
GoogleRig on;
|
||||
Fixture g(on.client);
|
||||
check(contains(g.client->get("/google/ops/status").body, "\"configured\":true"), "reports credential");
|
||||
check(on.mock->send_count() == 0 && off.mock->send_count() == 0, "no network");
|
||||
return finish("google/ops/status");
|
||||
}
|
||||
Reference in New Issue
Block a user