Skip to content
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

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

alexradzin
Copy link
Collaborator

…parameter for system engine

@alexradzin alexradzin requested a review from a team as a code owner March 31, 2024 17:57
@@ -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());
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Contributor

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

Copy link
Collaborator Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense

@alexradzin alexradzin force-pushed the FIR-31839-account_id-system-engine branch from d542384 to b7ca622 Compare April 4, 2024 10:18
@@ -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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense

@alexradzin alexradzin force-pushed the FIR-31839-account_id-system-engine branch from 6e7813f to c9a933d Compare April 10, 2024 08:15
Copy link

@alexradzin alexradzin merged commit 068103d into master Apr 10, 2024
4 checks passed
@alexradzin alexradzin deleted the FIR-31839-account_id-system-engine branch April 10, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants