Skip to main content

Module cloud_api

Module cloud_api 

Source
Expand description

Cloud-friendly entry points for invoking bench, conformance, OWASP, security-payload, WAFBench, and CRUD-flow runs programmatically.

The CLI in command.rs is the primary user-facing surface, but it assumes the caller can supply paths on disk and is OK with stdout reporting. Cloud callers (the registry server) need to:

  1. Pass the OpenAPI spec as raw bytes (no filesystem coordination).
  2. Receive every artifact that was written to the run’s output directory as in-memory bytes, so they can be persisted to Postgres / Tigris.
  3. Read structured K6Results without re-parsing summary.json.

This module provides exactly that. Each run_* function:

  • Creates a private tempdir,
  • Writes the supplied spec bytes into it,
  • Builds a BenchCommand with cloud-appropriate defaults,
  • Executes the run,
  • Slurps every file produced under the output dir into a CloudRunArtifacts map.

The CLI is unchanged — it still uses BenchCommand directly. Progress reporting (TerminalReporter) still goes to stdout; suppressing or redirecting it is intentionally out of scope for this module and will be handled by a follow-up that introduces a ProgressSink.

Structs§

CloudBenchInputs
Inputs for run_bench — a k6 load test against an external URL.
CloudConformanceInputs
Inputs for run_conformance — OpenAPI 3.0.0 conformance testing against an external URL.
CloudCrudFlowInputs
Inputs for run_crud_flow — CRUD chain testing (Create → Read → Update → Delete sequences with cross-step ID extraction).
CloudOwaspInputs
Inputs for run_owasp — OWASP API Security Top 10 testing.
CloudRunArtifacts
Every artifact produced by a cloud run.
CloudSecurityInputs
Inputs for run_security — payload-injection security testing layered on a standard k6 bench run.
CloudWafBenchInputs
Inputs for run_wafbench — Microsoft WAFBench-style coverage tests using the OWASP Core Rule Set attack patterns.

Enums§

SpecFormat
Format hint for OpenAPI specs supplied as raw bytes.

Functions§

run_bench
Run a k6 load test against CloudBenchInputs::target_url and return all produced artifacts in memory.
run_conformance
Run an OpenAPI 3.0.0 conformance test against CloudConformanceInputs::target_url.
run_crud_flow
Run a CRUD flow test against CloudCrudFlowInputs::target_url.
run_owasp
Run an OWASP API Security Top 10 test.
run_security
Run a payload-injection security test layered on a standard k6 bench.
run_wafbench
Run a WAFBench (OWASP CRS) coverage test.