zhaohai666 opened a new pull request, #1039:
URL: https://github.com/apache/rocketmq-dashboard/pull/1039

   # PR: Cloud-Vendor MetadataProvider SPI (RIP-1 T6 / META-01 M3)
   
   - **Branch:** `feature/studio-rip1-cloud-metadata-spi`
   - **Base:** `upstream/rocketmq-studio` @ `a8d263e` (#1025)
   - **Track:** #RIP-1 — META-01 M3 (cloud-vendor metadata SPI, phase 1)
   - **Status:** ready for review; auto-mergeable against current 
`rocketmq-studio`
   
   ---
   
   ## 1. Motivation
   
   The RIP-1 acceptance signal **META-01 M3** requires the Studio control plane 
to
   expose a pluggable SPI for cloud-vendor (Alibaba Cloud / Tencent Cloud / 
Huawei
   Cloud) metadata discovery. The current `rocketmq-studio` tree contained a 
class
   named `CloudMetadataProvider` under `instance.topic`, but it was:
   
   - an **unreferenced stub** of the unrelated topic-level `MetadataProvider`
     interface (it threw `UnsupportedOperationException` everywhere),
   - **not** a Spring bean, only referenced by its own test, and
   - **not** the cloud-vendor SPI the META-01 M3 signal asks for.
   
   This PR delivers the real META-01 M3 SPI — interfaces + a safe default + REST
   endpoints + tests — and removes the misleading dead stub so the signal is no
   longer obscured.
   
   ## 2. Scope
   
   **Phase 1 = contract + safe default only.** Per the RIP-1 plan, this PR
   publishes the SPI and a `NoopCloudMetadataProvider` fallback. Concrete
   cloud control-plane adapters are intentionally deferred to a later phase; 
when
   they land, they implement `CloudMetadataProvider` and are picked up by the
   existing `CloudService` / `CloudController` with **zero changes** to the
   endpoint or service layers.
   
   ## 3. Changes
   
   ### New package `server/.../cluster/cloud`
   
   | File | Purpose |
   |---|---|
   | `CloudVendor.java` | Vendor enum `ALIBABA_CLOUD` / `TENCENT_CLOUD` / 
`HUAWEI_CLOUD` / `UNKNOWN` with `providerType` codes (`acs` / `qcloud` / 
`hwcloud`) and case-insensitive `fromProviderType(...)`. |
   | `CloudMetadataProvider.java` | The SPI: `getVendor()`, 
`listInstances(region)`, `describeEndpoints(instanceId)`, `isAvailable()`. |
   | `NoopCloudMetadataProvider.java` | `@Primary @Component` default — returns 
empty instances / unavailable endpoints so the platform can depend on the SPI 
unconditionally. |
   | `CloudService.java` | Facade over the active provider; exposes vendor 
catalog, instance discovery, endpoint resolution (400 on blank `instanceId`). |
   | `CloudController.java` | `RestController` at `/api/cloud`: `GET /vendors`, 
`GET /instances?region=`, `GET /endpoints?instanceId=`. |
   | VOs: `CloudVendorVO`, `CloudInstanceVO`, `CloudEndpointVO` | Response 
models. |
   
   ### Removed
   
   - `instance/topic/CloudMetadataProvider.java` — dead stub (not the cloud 
SPI).
   - `instance/topic/CloudMetadataProviderTest.java` — its test.
   
   ## 4. REST contract
   
   ```
   GET /api/cloud/vendors      -> Result<List<CloudVendorVO>>
   GET /api/cloud/instances?region=cn-hangzhou -> Result<List<CloudInstanceVO>>
   GET /api/cloud/endpoints?instanceId=rmq-1   -> Result<CloudEndpointVO>
   ```
   
   With the `NoopCloudMetadataProvider` default, `/vendors` lists all four 
vendors
   (`available=false` for the real ones), `/instances` returns `[]`, and
   `/endpoints` returns an unavailable endpoint. No 5xx is ever thrown by the
   default path.
   
   ## 5. Tests
   
   13 new unit + slice tests, all passing; Checkstyle clean.
   
   - `CloudVendorTest` (3) — provider-type resolution, unknown/blank handling.
   - `NoopCloudMetadataProviderTest` (3) — default behavior.
   - `CloudServiceTest` (4) — vendor catalog, instances, endpoints, 400 on 
blank id.
   - `CloudControllerTest` (3) — `@WebMvcTest` verifying JSON shape & 
`code=200`.
   
   ```
   mvn -o test 
-Dtest='CloudVendorTest,NoopCloudMetadataProviderTest,CloudServiceTest,CloudControllerTest'
   Tests run: 13, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   ## 6. Risk / review notes
   
   - **No production behavior change** for existing clusters: the only live 
bean is
     the `Noop` default, which returns empty/absent data.
   - **No frontend change** in this PR; the endpoints are ready for a future 
cloud
     vendor picker page.
   - Removing the dead stub is safe — `grep` confirms it was referenced only by 
its
     own test.
   
   ## 7. How this maps to RIP-1 scoring
   
   META-01 M3 is one of the explicit RIP-1 acceptance signals. This PR closes 
the
   "cloud-vendor SPI exists" requirement as a clean, self-contained, mergeable
   change (the competition scores merged PRs), and leaves a clear extension 
point
   for the real adapters.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to