-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated aprl to add disk scanning, fixes #274
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
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) | ||
}, | ||
} |
This file contains 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
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{} | ||
} |
This file contains 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