-
Notifications
You must be signed in to change notification settings - Fork 0
Update the plugin to use SDK v0.2.0 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remove the findings structure to follow the 0.2.0 SDK structure, with gathering of inventory items alongside No NIC information gathered at the moment wuth the new structure of gathering data in a cleaner format and letting rego make decisions across the whole data structure instead of making decisions in the plugin code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Azure VM plugin to use SDK version 0.2.0, refactors the main evaluation logic into reusable iterators, and enhances documentation.
- Refactored
Evalto useGetVMsandGetNetworkConfigiterator functions - Introduced
GetVMsandGetNetworkConfigfor streaming VM and network data - Bumped dependencies in
go.modand updated configuration instructions inREADME.md
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| main.go | Refactored core logic to use Azure SDK v0.2.0, split VM and NIC collection into separate methods |
| go.mod | Updated plugin and configuration-service SDK versions and indirect dependencies |
| README.md | Added configuration table, build instructions, and data-structure reference |
Comments suppressed due to low confidence (6)
main.go:154
- The variable name
compoentsis misspelled and differs in type from the earliercomponentsdeclaration. Rename it tocomponentsand ensure the correct type ([]*proto.ComponentReference).
compoents := []*proto.Component{
main.go:234
- Exported method
GetVMslacks a doc comment. Add a comment explaining its purpose, parameters, and return type.
func (l *CompliancePlugin) GetVMs(ctx context.Context, client *armcompute.VirtualMachinesClient) iter.Seq2[*AzureVMInstance, error] {
main.go:272
- New method
GetNetworkConfigcontains significant logic for parsing and API calls. Consider adding unit tests to cover success and error paths.
func (l *CompliancePlugin) GetNetworkConfig(ctx context.Context, networkProfile *armcompute.NetworkProfile) ([]*AzureVMNetworkInterface, error) {
main.go:3
- The unqualified import of "iter" will not compile; please use the correct module path or alias (e.g., "github.com/yourorg/iter").
import (
main.go:3
- [nitpick] Using the standard library "slices" package requires Go 1.21+. Confirm your module's Go version or consider using "golang.org/x/exp/slices" for earlier Go versions.
import (
main.go:115
- You cannot range over a function call. Refactor to properly invoke the iterator returned by
GetVMs, for example by calling it in a loop that accepts a yield callback or channel.
for vm, err := range l.GetVMs(ctx, vmClient) {
* Change slices.Concat to append(...) * Add more labels from the VM for better searching * Spelling mistake in the actors description
main.go
Outdated
| inventory := []*proto.InventoryItem{ | ||
| { | ||
| Identifier: "azure-vm/" + vm.ID(), | ||
| Type: "virtual-machine", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Type: "virtual-machine", | |
| Type: "web-server", |
virtual machine is not in the list of accepted OSCAL types (yet).
No description provided.