-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: Add List Azure Tenants command #341
Conversation
Signed-off-by: Darren Murray <[email protected]>
Signed-off-by: Darren Murray <[email protected]>
cli/cmd/compliance_azure.go
Outdated
Long: `List all Azure Tenants.`, | ||
Args: cobra.NoArgs, | ||
RunE: func(_ *cobra.Command, _ []string) error { | ||
response, err := cli.LwApi.Compliance.ListAzureTenants() |
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.
Interesting way to do this but, I'm afraid it doesn't follow the standard we put in compliance for AWS. Also, we are creating "an API that doesn't exist in the platform itself" and that goes against the principle to match 100% the Lacework API. I think we should add this functionality to the CLI alone, just like the command to list AWS accounts.
Signed-off-by: Darren Murray <[email protected]>
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.
We need to check the size of the Data
field, check how we did it in AWS config. Lets print a message for a user to know what to do to add new integrations.
cli/cmd/compliance_azure.go
Outdated
} | ||
|
||
if cli.JSONOutput() { | ||
return cli.OutputJSON(response.Data[0]) |
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.
If an account doesn't have any Azure CFG integrations, we will panic here!
lacework comp az list --json -p mini
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/lacework/go-sdk/cli/cmd.glob..func8(0x1d49f80, 0xc0004fcf60, 0x0, 0x3, 0x0, 0x0)
/Users/salimmaya/go/src/github.com/lacework/go-sdk/cli/cmd/compliance_azure.go:85 +0x48f
github.com/spf13/cobra.(*Command).execute(0x1d49f80, 0xc0004fcf30, 0x3, 0x3, 0x1d49f80, 0xc0004fcf30)
/Users/salimmaya/go/src/github.com/lacework/go-sdk/vendor/github.com/spf13/cobra/command.go:842 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x1d4cc20, 0x16529cc, 0xc000607700, 0x1d58b22)
/Users/salimmaya/go/src/github.com/lacework/go-sdk/vendor/github.com/spf13/cobra/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/Users/salimmaya/go/src/github.com/lacework/go-sdk/vendor/github.com/spf13/cobra/command.go:887
github.com/lacework/go-sdk/cli/cmd.Execute(0x0, 0x0)
/Users/salimmaya/go/src/github.com/lacework/go-sdk/cli/cmd/root.go:100 +0x85
main.main()
/Users/salimmaya/go/src/github.com/lacework/go-sdk/cli/main.go:29 +0x26
Signed-off-by: Salim Afiune Maya <[email protected]>
785bbd5
to
515ad42
Compare
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.
Add new command to list Azure Tenants
Usage:
$ lacework compliance azure list-tenants
Output:
Signed-off-by: Darren Murray [email protected]