-
Notifications
You must be signed in to change notification settings - Fork 23
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
[RFC] Allow use of profiles #57
base: master
Are you sure you want to change the base?
Conversation
This will enable separation of session creation from new resource instantiation. It also allows callers with custom session needs to bring their own session.
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
- Coverage 42.2% 41.48% -0.72%
==========================================
Files 59 59
Lines 4109 4180 +71
==========================================
Hits 1734 1734
- Misses 2264 2335 +71
Partials 111 111
Continue to review full report at Codecov.
|
1 similar comment
@DavidGamba Thank you for your patience and suggestion! It's a good idea to use the session that you want. /* config.go */
type Config struct {
Session *session.Session
AccessKey string
...
}
// Session creates AWS session from the Config values.
func (c Config) Session() (*session.Session, error) {
if c.Session != nil {
return c.Session, nil
}
return session.NewSession(c.AWSConfig())
} /* sqs.go */
// New returns initialized *SQS.
func New(conf config.Config) (*SQS, error) {
sess, err := conf.Session()
if err != nil {
return nil, err
}
...
} |
Hi @evalphobia sorry for the long delay in answering. It looks good, I need to give it a try but I wont be able to get to that in a couple of weeks. |
This one is to just get your eyes on it.
The way you are doing your session creation doesn't allow for many options.
Our setup is a multi account setup where we use access keys defined in the root account and assume roles to access multiple other accounts.
In other cases we use ec2 instances with instance profiles to run our automation from.
Splitting the session creation from the resource creation allows the caller to bring custom session needs.