mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 01:25:39 -05:00
Adding support for multi cloud in azure rest api calls (#16454)
This commit is contained in:
@@ -18,7 +18,8 @@ const enum SettingIds {
|
||||
ossrdbms = 'ossrdbms',
|
||||
vault = 'vault',
|
||||
ado = 'ado',
|
||||
ala = 'ala'
|
||||
ala = 'ala',
|
||||
storage = 'storage'
|
||||
}
|
||||
|
||||
const publicAzureSettings: ProviderSettings = {
|
||||
@@ -74,6 +75,12 @@ const publicAzureSettings: ProviderSettings = {
|
||||
endpoint: 'https://api.loganalytics.io',
|
||||
azureResourceId: AzureResource.AzureLogAnalytics,
|
||||
},
|
||||
azureStorageResource: {
|
||||
id: SettingIds.storage,
|
||||
endpoint: '',
|
||||
endpointSuffix: '.core.windows.net',
|
||||
azureResourceId: AzureResource.AzureStorage
|
||||
},
|
||||
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
|
||||
scopes: [
|
||||
'openid', 'email', 'profile', 'offline_access',
|
||||
@@ -128,6 +135,12 @@ const usGovAzureSettings: ProviderSettings = {
|
||||
endpoint: 'https://api.loganalytics.us',
|
||||
azureResourceId: AzureResource.AzureLogAnalytics,
|
||||
},
|
||||
azureStorageResource: {
|
||||
id: SettingIds.storage,
|
||||
endpoint: '',
|
||||
endpointSuffix: '.core.usgovcloudapi.net',
|
||||
azureResourceId: AzureResource.AzureStorage
|
||||
},
|
||||
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
|
||||
scopes: [
|
||||
'openid', 'email', 'profile', 'offline_access',
|
||||
@@ -181,6 +194,12 @@ const usNatAzureSettings: ProviderSettings = {
|
||||
endpoint: 'https://api.loganalytics.azure.eaglex.ic.gov',
|
||||
azureResourceId: AzureResource.AzureLogAnalytics,
|
||||
},
|
||||
azureStorageResource: {
|
||||
id: SettingIds.storage,
|
||||
endpoint: '',
|
||||
endpointSuffix: '.core.eaglex.ic.gov',
|
||||
azureResourceId: AzureResource.AzureStorage
|
||||
},
|
||||
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
|
||||
scopes: [
|
||||
'openid', 'email', 'profile', 'offline_access',
|
||||
@@ -220,6 +239,12 @@ const germanyAzureSettings: ProviderSettings = {
|
||||
endpoint: 'https://vault.microsoftazure.de',
|
||||
azureResourceId: AzureResource.AzureKeyVault
|
||||
},
|
||||
azureStorageResource: {
|
||||
id: SettingIds.storage,
|
||||
endpoint: '',
|
||||
endpointSuffix: '.core.cloudapi.de',
|
||||
azureResourceId: AzureResource.AzureStorage
|
||||
},
|
||||
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
|
||||
scopes: [
|
||||
'openid', 'email', 'profile', 'offline_access',
|
||||
@@ -273,6 +298,12 @@ const chinaAzureSettings: ProviderSettings = {
|
||||
endpoint: 'https://api.loganalytics.azure.cn',
|
||||
azureResourceId: AzureResource.AzureLogAnalytics,
|
||||
},
|
||||
azureStorageResource: {
|
||||
id: SettingIds.storage,
|
||||
endpoint: '',
|
||||
endpointSuffix: '.core.chinacloudapi.cn',
|
||||
azureResourceId: AzureResource.AzureStorage
|
||||
},
|
||||
redirectUri: 'https://vscode-redirect.azurewebsites.net/',
|
||||
scopes: [
|
||||
'openid', 'email', 'profile', 'offline_access',
|
||||
|
||||
@@ -396,7 +396,7 @@ export async function makeHttpRequest(account: azdata.Account, subscription: azu
|
||||
if (host) {
|
||||
requestUrl = `${host}${path}`;
|
||||
} else {
|
||||
requestUrl = `https://management.azure.com${path}`;
|
||||
requestUrl = `${account.properties.providerSettings.settings.armResource.endpoint}${path}`;
|
||||
}
|
||||
|
||||
let response;
|
||||
@@ -494,7 +494,7 @@ export async function getBlobs(account: azdata.Account, subscription: azureResou
|
||||
try {
|
||||
const sharedKeyCredential = new StorageSharedKeyCredential(storageAccount.name, storageKeys.keyName1);
|
||||
const blobServiceClient = new BlobServiceClient(
|
||||
`https://${storageAccount.name}.blob.core.windows.net`,
|
||||
`https://${storageAccount.name}.blob${account.properties.providerSettings.settings.azureStorageResource.endpointSuffix}`,
|
||||
sharedKeyCredential
|
||||
);
|
||||
const containerClient = blobServiceClient.getContainerClient(containerName);
|
||||
|
||||
10
extensions/azurecore/src/azurecore.d.ts
vendored
10
extensions/azurecore/src/azurecore.d.ts
vendored
@@ -123,6 +123,11 @@ declare module 'azurecore' {
|
||||
*/
|
||||
azureLogAnalyticsResource?: Resource;
|
||||
|
||||
/**
|
||||
* Information that describes the Azure Storage resourceI
|
||||
*/
|
||||
azureStorageResource?: Resource;
|
||||
|
||||
/**
|
||||
* A list of tenant IDs to authenticate against. If defined, then these IDs will be used
|
||||
* instead of querying the tenants endpoint of the armResource
|
||||
@@ -160,6 +165,11 @@ declare module 'azurecore' {
|
||||
*/
|
||||
endpoint: string;
|
||||
|
||||
/**
|
||||
* Endpoint suffix used to access the resource
|
||||
*/
|
||||
endpointSuffix?: string;
|
||||
|
||||
/**
|
||||
* Resource ID for azdata
|
||||
*/
|
||||
|
||||
6
src/sql/azdata.proposed.d.ts
vendored
6
src/sql/azdata.proposed.d.ts
vendored
@@ -857,7 +857,11 @@ declare module 'azdata' {
|
||||
/**
|
||||
* Azure Log Analytics
|
||||
*/
|
||||
AzureLogAnalytics = 8
|
||||
AzureLogAnalytics = 8,
|
||||
/**
|
||||
* Azure Storage
|
||||
*/
|
||||
AzureStorage = 9
|
||||
}
|
||||
|
||||
export interface ButtonProperties {
|
||||
|
||||
@@ -437,7 +437,8 @@ export enum AzureResource {
|
||||
MicrosoftResourceManagement = 5,
|
||||
AzureDevOps = 6,
|
||||
MsGraph = 7,
|
||||
AzureLogAnalytics = 8
|
||||
AzureLogAnalytics = 8,
|
||||
AzureStorage = 9
|
||||
}
|
||||
|
||||
export class TreeItem extends vsExtTypes.TreeItem {
|
||||
|
||||
Reference in New Issue
Block a user