-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Cross Account - sourceArn #19
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -29,6 +29,9 @@ var ( | |
user = flag.String("u", "", "Authentication username") | ||
allowFrom = flag.String("l", "", "Allowed sender emails regular expression") | ||
denyTo = flag.String("d", "", "Denied recipient emails regular expression") | ||
sourceArn = flag.String("f", "", "The SourceARN (when using with cross accounts) ") | ||
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. Would change the description of all three flags to the following (for consistency with
|
||
fromArn = flag.String("o", "", "The FromARN (when using with cross accounts)") | ||
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. Would switch the flags for |
||
rPathArn = flag.String("p", "", "The ReturnPathARN (when using with cross accounts)") | ||
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. For consistency, we should call this variable |
||
) | ||
|
||
var ipMap map[string]bool | ||
|
@@ -79,11 +82,27 @@ func configure() error { | |
return errors.New("Denied recipient emails: " + err.Error()) | ||
} | ||
} | ||
if *sourceArn != "" { | ||
if *fromArn == "" { | ||
fromArn = sourceArn | ||
} | ||
if *rPathArn == "" { | ||
rPathArn = sourceArn | ||
} | ||
} else { | ||
sourceArn = nil | ||
} | ||
if *fromArn == "" { | ||
fromArn = nil | ||
} | ||
if *rPathArn == "" { | ||
rPathArn = nil | ||
} | ||
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 elaborate on why you're setting the variables to |
||
switch *relayAPI { | ||
case "pinpoint": | ||
relayClient = pinpointrelay.New(setName, allowFromRegExp, denyToRegExp) | ||
case "ses": | ||
relayClient = sesrelay.New(setName, allowFromRegExp, denyToRegExp) | ||
relayClient = sesrelay.New(setName, allowFromRegExp, denyToRegExp, sourceArn, fromArn, rPathArn) | ||
default: | ||
return errors.New("Invalid relay API: " + *relayAPI) | ||
} | ||
|
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.
I think it might be better to create a struct called
arns
that consists of those three arns and add that as member to this struct. Makes handling the arguments for a lot of the function calls a bit simpler.