-
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(cli): add lacework generate cloud-account oci subcommand #1359
Changes from 12 commits
2b842a6
355f2f0
065ae0c
093b58e
626d4a2
d892cff
ec69065
13be2c9
f3709d3
3ea0a97
62e623c
9f09e08
993d5e6
50b94fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2,6 +2,7 @@ package cmd | |||
|
||||
import ( | ||||
"fmt" | ||||
"net/mail" | ||||
"os" | ||||
"path/filepath" | ||||
"regexp" | ||||
|
@@ -44,9 +45,11 @@ func init() { | |||
initGenerateAwsTfCommandFlags() | ||||
initGenerateGcpTfCommandFlags() | ||||
initGenerateAzureTfCommandFlags() | ||||
initGenerateOciTfCommandFlags() | ||||
iacGenerateTfCommand.AddCommand(generateAwsTfCommand) | ||||
iacGenerateTfCommand.AddCommand(generateGcpTfCommand) | ||||
iacGenerateTfCommand.AddCommand(generateAzureTfCommand) | ||||
iacGenerateTfCommand.AddCommand(generateOciTfCommand) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Deprecated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! |
||||
|
||||
// aws subcommands | ||||
generateAwsTfCommand.AddCommand(generateAwsControlTowerTfCommand) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you do a favour and move this line to @dmurray-lacework to double check this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||
|
@@ -252,6 +255,20 @@ func validateStringWithRegex(val interface{}, regex string, errorString string) | |||
return nil | ||||
} | ||||
|
||||
func validateEmailAddress(val interface{}) error { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you move this into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great idea, will do! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||
switch value := val.(type) { | ||||
case string: | ||||
// This validates the email format against RFC 5322 | ||||
_, err := mail.ParseAddress(value) | ||||
kolbeinn marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
if err != nil { | ||||
return errors.Wrap(err, "supplied email address is not a valid email address format") | ||||
} | ||||
default: | ||||
return errors.New("value must be a string") | ||||
} | ||||
return nil | ||||
} | ||||
|
||||
// Used to test if path supplied for output exists | ||||
func validPathExists(val interface{}) error { | ||||
switch value := val.(type) { | ||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -22,8 +22,10 @@ func init() { | |||||
// initGenerateAwsTfCommandFlags() | ||||||
// initGenerateGcpTfCommandFlags() | ||||||
// initGenerateAzureTfCommandFlags() | ||||||
// initGenerateOciTfCommandFlags() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Setup flags here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||
|
||||||
generateCloudAccountCommand.AddCommand(generateAwsTfCommand) | ||||||
generateCloudAccountCommand.AddCommand(generateGcpTfCommand) | ||||||
generateCloudAccountCommand.AddCommand(generateAzureTfCommand) | ||||||
generateCloudAccountCommand.AddCommand(generateOciTfCommand) | ||||||
} |
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.
Can you remove this. These lines are deprecated and will be removed in future. This is the old location for these commands
lacework cloud-account iac-generate aws
etc.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.
Ooo what's the new location @jon-stewart
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.
Done