Skip to content

feat: Add Flow Operation Rule REST APIs#2286

Open
kunzhao-nv wants to merge 5 commits into
NVIDIA:mainfrom
kunzhao-nv:feat/rest-api-rule-crud
Open

feat: Add Flow Operation Rule REST APIs#2286
kunzhao-nv wants to merge 5 commits into
NVIDIA:mainfrom
kunzhao-nv:feat/rest-api-rule-crud

Conversation

@kunzhao-nv
Copy link
Copy Markdown
Contributor

@kunzhao-nv kunzhao-nv commented Jun 7, 2026

Description

Adds an Operation Rule CRUD API under /v2/org/{org}/nico/rule and lets every rack/tray operation API accept an optional ruleId so callers can pin a specific rule instead of relying on Flow's default rule resolution.

1. Operation Rule CRUD API — 5 site-scoped endpoints, backed by Flow's OperationRule gRPC:

Method Path Purpose
POST /v2/org/{org}/nico/rule create
GET /v2/org/{org}/nico/rule list (filter by siteId, operationType, isDefault)
GET /v2/org/{org}/nico/rule/{id} get
PATCH /v2/org/{org}/nico/rule/{id} update
DELETE /v2/org/{org}/nico/rule/{id} delete

2. Optional ruleId on rack/tray operation APIs — added to 8 request schemas (power/firmware/bring-up, single + batch, rack + tray). When set, the value is forwarded to Flow's rule_id proto field via the three shared Execute* helpers in handler/util/common/common.go. When omitted, Flow falls back to its default rule resolution — no behavior change for existing callers.

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Related Issues (Optional)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

Followups:

  1. Support promoting a rule to default
  2. Add REST api for rule-rack association

Wire 5 site-scoped endpoints (POST/GET/LIST/PATCH/DELETE /v2/org/{org}/nico/rule)
backed by Flow's OperationRule gRPC, with matching Temporal workflows/activities,
typed OpenAPI schemas, and unit tests across model/handler/workflow/activity layers.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Adds optional ruleId to power/firmware/bring-up request models (single +
batch, rack + tray) and forwards it to Flow's rule_id proto field via
the shared Execute* helpers. UUID-validated at the model layer.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Catches up `docs/index.html` and `sdk/standard/**` for the two preceding
spec changes (Rule CRUD endpoints in c73d4f9 and the rack/tray ruleId
field in 4bf84d0), which both shipped without their generated
artifacts.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
@kunzhao-nv kunzhao-nv requested a review from a team as a code owner June 7, 2026 05:07
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 7, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 541b5269-8c7d-4037-ab29-df3cb6f0dff1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-06-07 05:09:58 UTC | Commit: dd435f1

Keep the surface minimal; can be reintroduced alongside default-rule
management.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Covers 8464a1e (drop isDefault list filter); also adds SPDX headers to
the rule SDK files that the previous regen missed.

Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
nico-flow 116 13 50 41 4 8
nico-nsm 133 11 45 66 11 0
nico-psm 118 13 52 41 4 8
nico-rest-api 182 16 84 67 7 8
nico-rest-cert-manager 95 5 47 32 3 8
nico-rest-db 116 13 50 41 4 8
nico-rest-site-agent 115 13 50 41 3 8
nico-rest-site-manager 102 6 48 37 3 8
nico-rest-workflow 118 13 52 41 4 8
TOTAL 1095 103 478 407 43 64

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant