@@ -73,6 +73,12 @@ var newRemoteCredentials = func(sess *session.Session) *credentials.Credentials
7373 return credentials .NewCredentials (defaults .RemoteCredProvider (* sess .Config , sess .Handlers ))
7474}
7575
76+ type GetSessionConfig struct {
77+ Settings AWSDatasourceSettings
78+ HTTPClient * http.Client
79+ UserAgentName * string
80+ }
81+
7682type SessionConfig struct {
7783 Settings AWSDatasourceSettings
7884 HTTPClient * http.Client
@@ -100,7 +106,7 @@ func isOptInRegion(region string) bool {
100106 return regions [region ]
101107}
102108
103- // GetSession returns a session from the config and possible region overrides -- implements AmazonSessionProvider
109+ // Deprecated: use GetSessionWithAuthSettings instead
104110func (sc * SessionCache ) GetSession (c SessionConfig ) (* session.Session , error ) {
105111 if c .Settings .Region == "" && c .Settings .DefaultRegion != "" {
106112 // DefaultRegion is deprecated, Region should be used instead
@@ -289,6 +295,16 @@ func (sc *SessionCache) GetSession(c SessionConfig) (*session.Session, error) {
289295 return sess , nil
290296}
291297
298+ // AuthSettings can be grabed from the datasource instance's context with ReadSettingsFromContext
299+ func (sc * SessionCache ) GetSessionWithAuthSettings (c GetSessionConfig , as AuthSettings ) (* session.Session , error ) {
300+ return sc .GetSession (SessionConfig {
301+ Settings : c .Settings ,
302+ HTTPClient : c .HTTPClient ,
303+ UserAgentName : c .UserAgentName ,
304+ AuthSettings : & as ,
305+ })
306+ }
307+
292308// getSTSEndpoint returns true if the set endpoint is a fips endpoint
293309func isFIPSEndpoint (endpoint string ) bool {
294310 return strings .Contains (endpoint , "fips" ) ||
0 commit comments