azure: Change the typings of the created clients#2193
azure: Change the typings of the created clients#2193bwateratmsft wants to merge 6 commits intomainfrom
Conversation
| const authClient = await createAuthorizationManagementClient([context, subContext]); | ||
|
|
||
| if (isProfileAuthorizationManagementClient(authClient)) { | ||
| throw new Error('TODO: no can do boss'); |
There was a problem hiding this comment.
TODO: Do. The Azure Stack SDK does not have the client.roleAssignments.listForSubscription() method.
| export async function createStorageClient(context: InternalAzExtClientContext): Promise<CommonStorageManagementClient> { | ||
| if (parseClientContext(context).isCustomCloud) { | ||
| return <StorageManagementClient><unknown>createAzureClient(context, (await import('@azure/arm-storage-profile-2020-09-01-hybrid')).StorageManagementClient); | ||
| return createAzureClient(context, (await import('@azure/arm-storage-profile-2020-09-01-hybrid')).StorageManagementClient); |
There was a problem hiding this comment.
The casts become unnecessary, by declaring that the return type is a union of the two--that way the callers don't use something that exists on the normal SDK but not on the Azure Stack one.
| export type CommonAuthorizationManagementClient = AuthorizationManagementClient | PAMC; | ||
| export type CommonResourcesClient = ResourceManagementClient | PRMC; | ||
| export type CommonStorageManagementClient = StorageManagementClient | PSMC; |
There was a problem hiding this comment.
These aren't in index.d.ts, should add them...
| { | ||
| roleDefinitionId, // Regular SDK wants this | ||
| principalId, // Regular SDK wants this | ||
| properties: { // Azure Stack SDK wants this instead |
There was a problem hiding this comment.
So does this mean the regular SDK doesn't care about having the Stack SDK properties present (in that shape) and vice versa?
There was a problem hiding this comment.
I hope so! I expect that either they won't get serialized into the request or the service will ignore them.
This would have build-time effects so I'm revving the major...shouldn't have any runtime impact, other than throwing a better error when using Azure Stack +
createRoleDefinitionsItems().