-
Notifications
You must be signed in to change notification settings - Fork 6
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
FIR-31838 getting account_id from the server and not sending it as a … #371
Conversation
@@ -100,15 +106,24 @@ private FireboltProperties getSessionPropertiesForSystemEngine(String accessToke | |||
String systemEngineEndpoint = fireboltGatewayUrlService.getUrl(accessToken, accountName); | |||
FireboltAccount account = fireboltAccountIdService.getValue(accessToken, accountName); | |||
infraVersion = account.getInfraVersion(); | |||
URL systemEngienUrl = UrlUtil.createUrl(systemEngineEndpoint); | |||
Map<String, String> systemEngineUrlUrlParams = UrlUtil.getQueryParameters(systemEngienUrl); | |||
String accountId = systemEngineUrlUrlParams.getOrDefault(ACCOUNT_ID.getKey(), account.getId()); |
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 the idea here is to use all parameters and not only account_id
. Yes, currently (and maybe even further) we only receive account_id
, but generally this assumes the ability to receive other parameters.
So generally, we should take all received parameters (not only account_id
) and add them when we connect to a system engine.
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.
Also, if account_id is not provided in parameters, we should not provide it either instead of getting it manually and setting it as default.
For example, we can receive a URL like https:/01hnj9r1xrx3a4t3kb1ec7qs2b.api.us-east-1.staging.firebolt.io
, where account_id is included in the endpoint itself, so there is no need to add a query parameter as well
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.
All these are supported. Please take a look on lines 112-114 that iterate over all parameters. Concerning to the account ID it should work too. Indeed if account ID is not supplied in the engine URL parametersthe value accountId
defined in line 11 will be as current account ID (account.getId()
) and therefore setting it into loginProperties in line 119 will not change the value.
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.
Ok, as for parameter makes sense, didn't see that.
As for account_id, my point is that we need to forcefully unset it (even if it was provided by a user). As I understand from the code, account_id value can still exist in the url even if it wasn't provided in system engine url response. Let me know if I'm missing someting
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.
This logic is implemented in StatemtentClientImpl: lines 310-331
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.
Ok, makes sense
src/main/java/com/firebolt/jdbc/statement/rawstatement/StatementValidatorFactory.java
Outdated
Show resolved
Hide resolved
d542384
to
b7ca622
Compare
@@ -100,15 +106,24 @@ private FireboltProperties getSessionPropertiesForSystemEngine(String accessToke | |||
String systemEngineEndpoint = fireboltGatewayUrlService.getUrl(accessToken, accountName); | |||
FireboltAccount account = fireboltAccountIdService.getValue(accessToken, accountName); | |||
infraVersion = account.getInfraVersion(); | |||
URL systemEngienUrl = UrlUtil.createUrl(systemEngineEndpoint); | |||
Map<String, String> systemEngineUrlUrlParams = UrlUtil.getQueryParameters(systemEngienUrl); | |||
String accountId = systemEngineUrlUrlParams.getOrDefault(ACCOUNT_ID.getKey(), account.getId()); |
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.
Ok, makes sense
…parameter for system engine
6e7813f
to
c9a933d
Compare
Quality Gate passedIssues Measures |
…parameter for system engine