mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
This reverts commit e169005571.
This commit is contained in:
@@ -39,7 +39,7 @@ export type SqlManagedInstance = AzureProduct;
|
||||
export async function getAvailableManagedInstanceProducts(account: azdata.Account, subscription: Subscription): Promise<SqlManagedInstance[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
|
||||
const result = await api.getSqlManagedInstances(account, [subscription], false);
|
||||
const result = await api.runGraphQuery<SqlManagedInstance>(account, [subscription], false, `where type == "${azureResource.AzureResourceType.sqlManagedInstance}"`);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export type SqlServer = AzureProduct;
|
||||
export async function getAvailableSqlServers(account: azdata.Account, subscription: Subscription): Promise<SqlServer[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
|
||||
const result = await api.getSqlServers(account, [subscription], false);
|
||||
const result = await api.runGraphQuery<SqlServer>(account, [subscription], false, `where type == "${azureResource.AzureResourceType.sqlServer}"`);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
@@ -55,45 +55,6 @@ export type SqlVMServer = AzureProduct;
|
||||
export async function getAvailableSqlVMs(account: azdata.Account, subscription: Subscription): Promise<SqlVMServer[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
|
||||
const result = await api.getSqlVMServers(account, [subscription], false);
|
||||
const result = await api.runGraphQuery<SqlVMServer>(account, [subscription], false, `where type == "${azureResource.AzureResourceType.virtualMachines}" and properties.storageProfile.imageReference.publisher == "microsoftsqlserver"`);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
export type StorageAccount = AzureProduct;
|
||||
export async function getAvailableStorageAccounts(account: azdata.Account, subscription: Subscription): Promise<StorageAccount[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
const result = await api.getStorageAccounts(account, [subscription], false);
|
||||
sortResourceArrayByName(result.resources);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
export async function getFileShares(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise<azureResource.FileShare[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
let result = await api.getFileShares(account, subscription, storageAccount, true);
|
||||
let fileShares = result.fileShares;
|
||||
sortResourceArrayByName(fileShares!);
|
||||
return fileShares!;
|
||||
}
|
||||
|
||||
export async function getBlobContainers(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise<azureResource.BlobContainer[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
let result = await api.getBlobContainers(account, subscription, storageAccount, true);
|
||||
let blobContainers = result.blobContainer;
|
||||
sortResourceArrayByName(blobContainers!);
|
||||
return blobContainers!;
|
||||
}
|
||||
|
||||
function sortResourceArrayByName(resourceArray: AzureProduct[] | azureResource.FileShare[] | azureResource.BlobContainer[] | undefined): void {
|
||||
if (!resourceArray) {
|
||||
return;
|
||||
}
|
||||
resourceArray.sort((a: AzureProduct | azureResource.BlobContainer | azureResource.FileShare, b: AzureProduct | azureResource.BlobContainer | azureResource.FileShare) => {
|
||||
if (a.name! < b.name!) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name! > b.name!) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user