feat(vsphere): add location, template and disk-type commands - #19
Merged
Merged
Conversation
Add the vsphere command group with paged read-only lists backed by the go-anxcloud legacy provisioning clients. Filters and path identifiers are escaped before reaching the clients, which interpolate them raw.
Unpaged list commands checked pagination support only inside the fetch callback, after the API client was built. Running such a list with --page 2 and no token exited with the auth code instead of the usage code. Check paging support before building the client and share the error with the fetch path.
The Engine template endpoint is not paginated; the legacy client sent --page values the API ignored, so --page 2 repeated page 1 and --all looped. Use the generic vspherev1.Template spec, which handles the unpaged endpoint and adds template get. Validate --location as an identifier, fall back to the country code when a location has no country name, align column headers with the rest of the CLI and pin paging, escaping, not-found and usage behaviour in tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Starts the
vspheregroup from the roadmap with the read-only provisioning lookups needed beforevm createcan exist:anexia vsphere location list(--code,--organizationfilters, paged)anexia vsphere template list|get(--location,--type templates|from_scratch)anexia vsphere disk-type list(--location, paged)Location and disk-type use the legacy go-anxcloud provisioning clients, which interpolate filters and path segments raw, so values are escaped on the CLI side and pinned by tests. Template uses the generic
vspherev1.Templatespec because the Engine template endpoint is not paginated: the legacy client sent--pagevalues the API ignored.Also fixes a pre-existing ordering bug in the generic list command: unpaged lists with
--page 2and no token exited with the auth code instead of the usage code.README coverage table and
docs/cli-design.mdinventory updated.Test plan
make ci(fmt, lint,go test -race ./...) green--all/--pagebehaviour covered ininternal/cli/vsphere_test.go