feat(opensearch): region adjustments and migration to new SDK structure#1474
feat(opensearch): region adjustments and migration to new SDK structure#1474SerseusWasTaken wants to merge 3 commits into
Conversation
| func GetCredentialsUsername(ctx context.Context, apiClient OpenSearchClient, projectId, instanceId, credentialsId string) (string, error) { | ||
| resp, err := apiClient.GetCredentialsExecute(ctx, projectId, instanceId, credentialsId) | ||
| func GetCredentialsUsername(ctx context.Context, apiClient OpenSearchClient, projectId, region, instanceId, credentialsId string) (string, error) { | ||
| resp, err := apiClient.GetCredentials(ctx, projectId, instanceId, region, credentialsId).Execute() |
There was a problem hiding this comment.
region must be added before instanceId
There was a problem hiding this comment.
Good catch!
| } | ||
| } | ||
|
|
||
| type OpenSearchClient interface { |
There was a problem hiding this comment.
I think we can remove this client and use the apiClient directly. Like we have done for other services
|
|
||
| var ( | ||
| testProjectId = uuid.NewString() | ||
| testRegion = "eu01" |
There was a problem hiding this comment.
can you shift this to const area?
| return req | ||
| } | ||
|
|
||
| func outputResult(p *print.Printer, outputFormat string, showPassword bool, instanceLabel string, resp *opensearch.CredentialsResponse) error { |
There was a problem hiding this comment.
nitpick: not introduced by this PR so you can just skip it :) but I think instead of outputFormat and showPassword, we can parse here the model and then read the values in the function.
There was a problem hiding this comment.
Out of curiosity: what would be the upside to that? I think it's better to keep the arguments precise. Since the function only needs these two args from the model, i think passing the whole model here would make it less clear on what the function depends on from the model.
If the function changes in the future and more fields are needed from the model then i would see the argument. But i think two args is reasonable
There was a problem hiding this comment.
I am also fine with 2 args :) It is just to align with similar service implementations. We added some checks like this
There was a problem hiding this comment.
Ah i see. In that case i'm going to adjust it
…apped region and instanceid args relates to STACKITTCLI-372
relates to STACKITTCLI-372
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
Description
Migrate opensearch to v2 SDK API
relates to STACKITCLI-372
Checklist
make fmtmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)