-
Notifications
You must be signed in to change notification settings - Fork 773
deps(smus): Upgrade sdk v2 to sdk v3 - DataZoneCustomClient #8411
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
Conversation
2890cdb to
0f08f21
Compare
|
vpbhargav
left a comment
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.
Thanks for making these changes! How are we testing and ensuring there is no regression?
| const awsCredentialProvider = async () => { | ||
| const credentials = await this.credentialProvider.getCredentials() | ||
| return { | ||
| accessKeyId: credentials.accessKeyId, | ||
| secretAccessKey: credentials.secretAccessKey, | ||
| sessionToken: credentials.sessionToken, | ||
| expiration: credentials.expiration, | ||
| } | ||
| } |
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 wrapper needed? Unable to pass this.credentialProvider directly to the clientConfig? Seems like it but just want to confirm.
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.
Yeah it is needed. I am not Typescript pro, but here is my understanding:
- passing this.credentialProvider would only pass the method,
- with the wrapper it also passes the instance
we would need the correct instance to get the credentials
Inspired by @liuzulin:
https://github.com/aws/aws-toolkit-vscode/blame/20a5e850bc483e0d649eddf1880014e2873ca565/packages/core/src/sagemakerunifiedstudio/shared/client/s3Client.ts#L159
| listDomains: sinon.stub().returns({ | ||
| promise: () => Promise.resolve(mockResponse), | ||
| }), | ||
| send: sinon.stub().resolves(mockResponse), |
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.
Are we able to be specific with which method is being called for this sub as well? listDomains in this case?
| assert.deepStrictEqual(mockDataZoneClient.getDomain.firstCall.args[0], { | ||
| identifier: mockDomainId, | ||
| }) | ||
| assert.ok(mockDataZoneClient.send.calledOnce) |
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.
These assertion are not the same. We were validating input params earlier and now we are just validating that some send call is made. Are we able to maintain the old assertions?
Same for other places in test too.
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.
Yeah you are right, the verifications are over simplified. let me add some more detailed validation
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 this is not addressed still right? I am not seeing any changes here in diff?
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.
Not sure why the diff shows nothing, maybe due to force push? I added back the old assertions, except for we are validating send.calledOnce instead of getDomain.calledOnce now
| domainId: mockDomainId, | ||
| id: 'gp_profile1', | ||
| status: 'ACTIVATED', | ||
| status: 'ASSIGNED', |
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.
Why did this need to change? Previous test was wrong?
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.
Yeah it was wrong, it would be either UNASSIGNED or ASSIGNED
I did sanity test for each of the 3 SDK upgrade PRs, I think we would also want to let the team test the prerelease vsix after the 3 PRs are merged. |
03eaff9 to
66b4f43
Compare
| */ | ||
| export class DataZoneCustomClientHelper { | ||
| private datazoneCustomClient: DataZoneCustomClient | undefined | ||
| private datazoneCustomClient: DataZone | undefined |
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.
wondering if we can import it as DataZoneCustomClient so we can keep the naming here, it aligns with the variable and cause less confusion
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'm not confidence if this is the best practice but there is my thought:
I intentionally changed this to DataZoneCustomClient -> DataZone to maintain the original type name because I think the extra step of renaming would cause more confusion. It looks cleaner to me, what do you think?
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 don't think renaming would cause more confusion: renaming keeps the change in a single place: in the import statement. and helps to keep all the rest of places same as previous. I think it cause less confusion.
And I don't think it's correct to say it's "cleaner". indeed it seems more "cleaner" in this single file. But we also have a regular DataZoneClient which also have a DataZone type. If working across both files, this actually cause more confusion.
But anyway I approved the PR as I don't think this is a blocker issue and we can loop back on this.
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.
Yeah that make sense!
| this.logger.debug( | ||
| `DataZoneCustomClientHelper: Using custom DataZone endpoint from settings: ${endpoint}` | ||
| ) | ||
| const clientConfig: any = { |
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.
avoid using any as type
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.
thanks for catching that
| .promise() | ||
| const command = new ListDomainsCommand({ | ||
| maxResults: options?.maxResults, | ||
| status: options?.status as any, |
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.
avoid using any as type, please also check other places that you changed
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.
thanks for catching that. Checked these are the only 2 any type in my change for this PR
66b4f43 to
e8ffa59
Compare
Head branch was pushed to by a user without write access
Summary
This PR migrates the DataZone custom API client from the deprecated AWS SDK v2 generator pattern to standalone AWS SDK v3-compatible packages. This migration is required as part of the broader AWS Toolkit repository migration from SDK v2 to v3.
The AWS Toolkit VSCode repository is deprecating the centralized generateServiceClient.ts script that generates TypeScript clients from service JSON definitions. The SageMaker Unified Studio (SMUS) team currently uses this v2 generator for DataZone Custom API.
Solution
feature/xbranches will not be squash-merged at release time.