Skip to content

Commit

Permalink
feat: updated aprl to add disk scanning, fixes #274
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Dec 10, 2024
1 parent 14c6c9e commit b825a5d
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
28 changes: 28 additions & 0 deletions cmd/azqr/disk.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

package azqr

import (
"github.com/Azure/azqr/internal/azqr"
iot "github.com/Azure/azqr/internal/scanners/disk"
"github.com/spf13/cobra"
)

func init() {
scanCmd.AddCommand(diskCmd)
}

var diskCmd = &cobra.Command{
Use: "disk",
Short: "Scan Disk",
Long: "Scan Disk",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
serviceScanners := []azqr.IAzureScanner{
&iot.DiskScanner{},
}

scan(cmd, serviceScanners)
},
}
2 changes: 1 addition & 1 deletion internal/aprl
Submodule aprl updated 214 files
33 changes: 33 additions & 0 deletions internal/scanners/disk/disk.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

package disk

import (
"github.com/Azure/azqr/internal/azqr"
)

// DiskScanner - Scanner for Disk
type DiskScanner struct {
config *azqr.ScannerConfig
}

// Init - Initializes the Disk Scanner
func (a *DiskScanner) Init(config *azqr.ScannerConfig) error {
a.config = config
return nil
}

// Scan - Scans all Disk in a Resource Group
func (a *DiskScanner) Scan(scanContext *azqr.ScanContext) ([]azqr.AzqrServiceResult, error) {
azqr.LogSubscriptionScan(a.config.SubscriptionID, a.ResourceTypes()[0])
return []azqr.AzqrServiceResult{}, nil
}

func (a *DiskScanner) ResourceTypes() []string {
return []string{"Microsoft.Compute/disks"}
}

func (a *DiskScanner) GetRecommendations() map[string]azqr.AzqrRecommendation {
return map[string]azqr.AzqrRecommendation{}
}
2 changes: 2 additions & 0 deletions internal/scanners/scanners_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/Azure/azqr/internal/scanners/cr"
"github.com/Azure/azqr/internal/scanners/dbw"
"github.com/Azure/azqr/internal/scanners/dec"
"github.com/Azure/azqr/internal/scanners/disk"
"github.com/Azure/azqr/internal/scanners/erc"
"github.com/Azure/azqr/internal/scanners/evgd"
"github.com/Azure/azqr/internal/scanners/evh"
Expand Down Expand Up @@ -95,6 +96,7 @@ func GetScanners() []azqr.IAzureScanner {
&cosmos.CosmosDBScanner{},
&cr.ContainerRegistryScanner{},
&dec.DataExplorerScanner{},
&disk.DiskScanner{},
&erc.ExpressRouteScanner{},
&evgd.EventGridScanner{},
&evh.EventHubScanner{},
Expand Down

0 comments on commit b825a5d

Please sign in to comment.