Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use plane-scoped environment list in CLI (radius-project#5746)
# Description This change enables the plane-scoped list APIs for all resource types, adds a functional test, and updates the rad CLI to use this functionality for discovering environments in `rad init`. When I was testing this out, I found that the OpenAPI validation was blocking these API calls. I tested this before, and I'm not sure how I didn't notice the break when I was enabling the APIs. Since we don't have good coverage of this scenario I added some of the first functional tests that make direct API calls. ## Issue reference Fixes: #5609 ## Auto-generated summary <!-- GitHub Copilot for docs will auto-generate a summary of the PR --> <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at 5bb8287</samp> ### Summary 🔄🌐📜 <!-- 1. 🔄 This emoji represents the refactoring and renaming of the `ucp` package to `clients` and the `connections` package to use a new management client type. It also implies the removal of circular dependencies and the simplification of the code. 2. 🌐 This emoji represents the addition of code for testing the resource list APIs at different scopes and for listing environments at plane scope. It also implies the expansion of the functional test coverage and the support for Azure scopes. 3. 📜 This emoji represents the changes to the validator package to support multiple root scope prefixes for loading and validating specifications. It also implies the improvement of the test cases and the names for the routes and URLs. --> This pull request refactors the `ucp` package to `clients` to support both UCP and Azure scopes, updates the validator to handle multiple root scope prefixes for validating requests, and updates the CLI, frontend, and test code to use the new types and functions from the `clients` and `validator` packages. It also deletes the unused `pkg/cli/azure/resource_groups.go` file. > _Oh we're the coders of the azure sea_ > _And we work on the validator API_ > _We load the specs with multiple prefixes_ > _And we test the scopes with `LoadSpec` slices_ ### Walkthrough * Rename `ucp` package to `clients` and refactor management client type and functions to handle both UCP and Azure scopes ([link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL17-R21), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL30), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL38-R43), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL64-R64), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL88-R88), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL104-R104), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL118-R118), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL132-R132), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL147-R147), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL161-R161), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL183-R183), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL206-R206), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL221-R221), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL236-R236), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL277-R277), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL292-R292), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL299-R299), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL317-R317), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL380-R380), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL403-R425), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL425-R440), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL470-R455), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL499-R484), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL514-R499), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL533-R518), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL548-R533), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-23443c20f46bfbb5ffda2f87efc0e56ecaea1ef964ed4fc9ee06fe584fcfedcaL574-R559), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-bf4e917446c73565ee6967f28bdd8e619c0d4fa40b215f195b840c021dd36ce9L25-R26), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-bf4e917446c73565ee6967f28bdd8e619c0d4fa40b215f195b840c021dd36ce9L237-R237), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-d4132acf041f5a0725d02f79003aca9ad44bc2829ec159cb704b927f13d7b916L32), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-d4132acf041f5a0725d02f79003aca9ad44bc2829ec159cb704b927f13d7b916L178-R177), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-9e95146df57858ee34b56448b4ccf0c1d234eac1611745e623aabdc6b7262af6L37-R38), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-9e95146df57858ee34b56448b4ccf0c1d234eac1611745e623aabdc6b7262af6L695-R696)) * Change `LoadSpec` function to accept multiple root scope prefixes and update validator logic and tests accordingly ([link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-2bdfa10a8abd451bfb18e729290e9182d1b8e6280d8a9e47dd0ce70f6e8d48d6L65-R73), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-35a42847397e63ce68849a6460524de6b1e7d1758aad42fb75864bdfe7a0b94aL62-R70), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-dfb7e47b7c3b87c21cf5cf682dec097126f3276a8019a440cc0bd74855a074e7L90-R90), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L36-R51), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L51-R66), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L131-R137), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L142-R148), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L153-R159), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L160-R209), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L173-R219), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L189-R235), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L212-R258), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L235-R281), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L262-R308), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L285-R334), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L308-R357), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L331-R380), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L354-R403), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L377-R426), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-81569bb69d66820a78376e124c53f82893c72ca029646bd0acc7e6a8b27f7001L400-R449), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-9e26da263135bed45f84fb809a604e09c7b6b4fe84a9348d08058b1eb212afb2L43-R43), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-9e26da263135bed45f84fb809a604e09c7b6b4fe84a9348d08058b1eb212afb2L83-R83), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-9e26da263135bed45f84fb809a604e09c7b6b4fe84a9348d08058b1eb212afb2L89-R89), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-9e26da263135bed45f84fb809a604e09c7b6b4fe84a9348d08058b1eb212afb2L147-R153), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-7b8cf0fed92b04574159896aa3e609b874fb6822eb4943c56e1f07966c46c089L76-R76), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-40da5a0178b34c207217154cc7fa3d432882f52681d9e262e33bce27f0156b36L66-R70), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-40da5a0178b34c207217154cc7fa3d432882f52681d9e262e33bce27f0156b36L105-R121), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-72b68e1ff471fe9aca9629dd4becb6478d89f5dc5895ecc15dc6a04bb6cb2ebbR25), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-72b68e1ff471fe9aca9629dd4becb6478d89f5dc5895ecc15dc6a04bb6cb2ebbL31-R32), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-72b68e1ff471fe9aca9629dd4becb6478d89f5dc5895ecc15dc6a04bb6cb2ebbL39-R43), [link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-72b68e1ff471fe9aca9629dd4becb6478d89f5dc5895ecc15dc6a04bb6cb2ebbL55-R109)) * Add functional tests for listing resources at different scopes in `test/functional/corerp/api_test.go` ([link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-cca752b4f280ec903b138acce03f8c540f5f8505472835bafeaffbd02ff08480R1-R88)) * Delete unused file `pkg/cli/azure/resource_groups.go` ([link](https://github.com/project-radius/radius/pull/5746/files?diff=unified&w=0#diff-6d429b950191bfd1d0f0f94904e198cb9220cc76f276a7a7dc8d09b09b04463f))
- Loading branch information