feat: interfaces, resolve resources by name, tests#57
Merged
avirtopeanu-ionos merged 4 commits intov2from Mar 3, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive set of generic utilities and interfaces to the shared package that abstract common patterns across all generated IONOS Cloud SDK types. The additions enable type-safe, generic operations on SDK resources without requiring manual type conversions or boilerplate code.
Changes:
- Added five generic interfaces (Identifiable, HasHref, Resource, Listable[T], HasProperties[P]) that SDK types satisfy through their generated accessor methods
- Added utility functions (ExtractIDs, FindByID, ListItems, Properties) that work directly with value-type slices returned by SDK GetItems() methods
- Added Resolve() function that resolves human-readable names to resource IDs, with UUID detection to skip unnecessary API calls
- Added comprehensive test coverage with unit tests and executable documentation examples
- Added CI workflow for automated testing with race detection and coverage reporting
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| shared/interfaces.go | Defines generic interfaces (Identifiable, HasHref, Resource, Listable, HasProperties) and utility functions (ExtractIDs, FindByID, ListItems, Properties) that work with SDK value-type slices |
| shared/resolve.go | Implements UUID validation and name-to-ID resolution with clear error handling for zero/ambiguous matches |
| shared/interfaces_test.go | Comprehensive unit tests for interface utilities with mock types that mirror SDK patterns |
| shared/resolve_test.go | Unit tests covering UUID validation and all Resolve() scenarios (passthrough, single match, no match, ambiguous, errors) |
| shared/interfaces_example_test.go | Executable godoc examples demonstrating interface usage with realistic mock SDK types |
| shared/resolve_example_test.go | Executable godoc examples for UUID validation and name resolution |
| .github/workflows/shared-tests.yml | CI workflow for automated testing with race detection and coverage reporting on shared package changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…leave up to user)
|
cristiGuranIonos
approved these changes
Mar 3, 2026
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.



Example: