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.
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.
Suggested change
| Type: "virtual-machine", | |
| Type: "web-server", |
virtual machine is not in the list of accepted OSCAL types (yet).
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.
No description provided.