mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Exposing Azure HTTP requests method in Azurecore extension for external consumption (#14135)
* Exposing azure HTTP request in azurecore Moving migration specific request from azurecore to migration Created a migrations typing file * Deleting the typings file in sql migration * Fixed typos in comments * Adding default host for azure https requests * Fixed operator in service url modification * Changed path and host logic * Made chagned requested in the PR * Fixed variable names * Adding / check for path. * Changing error code check * Fixed status logic in azure rest request Fixed comment logic Converting error array to string while throwing * Fixed status check * Fixed typos and cleaning up
This commit is contained in:
29
extensions/azurecore/src/azurecore.d.ts
vendored
29
extensions/azurecore/src/azurecore.d.ts
vendored
@@ -66,6 +66,13 @@ declare module 'azurecore' {
|
||||
westus2 = 'westus2',
|
||||
}
|
||||
|
||||
export const enum HttpRequestMethod {
|
||||
GET,
|
||||
PUT,
|
||||
POST,
|
||||
DELETE
|
||||
}
|
||||
|
||||
export interface IExtension {
|
||||
getSubscriptions(account?: azdata.Account, ignoreErrors?: boolean, selectedOnly?: boolean): Promise<GetSubscriptionsResult>;
|
||||
getResourceGroups(account?: azdata.Account, subscription?: azureResource.AzureResourceSubscription, ignoreErrors?: boolean): Promise<GetResourceGroupsResult>;
|
||||
@@ -75,10 +82,18 @@ declare module 'azurecore' {
|
||||
getStorageAccounts(account: azdata.Account, subscriptions: azureResource.AzureResourceSubscription[], ignoreErrors?: boolean): Promise<GetStorageAccountResult>;
|
||||
getBlobContainers(account: azdata.Account, subscription: azureResource.AzureResourceSubscription, storageAccount: azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<GetBlobContainersResult>;
|
||||
getFileShares(account: azdata.Account, subscription: azureResource.AzureResourceSubscription, storageAccount: azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<GetFileSharesResult>;
|
||||
getMigrationController(account: azdata.Account, subscription: azureResource.AzureResourceSubscription, resourceGroupName: string, regionName: string, controllerName: string, ignoreErrors?: boolean): Promise<GetMigrationControllerResult>;
|
||||
createMigrationController(account:azdata.Account, subscription: azureResource.AzureResourceSubscription, resourceGroupName: string, regionName: string, controllerName: string, ignoreErrors?:boolean): Promise<CreateMigrationControllerResult>;
|
||||
getMigrationControllerAuthKeys(account: azdata.Account, subscription: azureResource.AzureResourceSubscription, resourceGroupName: string, regionName: string, controllerName: string, ignoreErrors?: boolean): Promise<GetMigrationControllerAuthKeysResult>;
|
||||
|
||||
/**
|
||||
* Makes Azure REST requests to create, retrieve, update or delete access to azure service's resources.
|
||||
* For reference to different service URLs, See https://docs.microsoft.com/rest/api/?view=Azure
|
||||
* @param account The azure account used to acquire access token
|
||||
* @param subscription The subscription under azure account where the service will perform operations.
|
||||
* @param path The path for the service starting from '/subscription/..'. See https://docs.microsoft.com/rest/api/azure/.
|
||||
* @param requestType Http request method. Currently GET, PUT, POST and DELETE methods are supported.
|
||||
* @param requestBody Optional request body to be used in PUT and POST requests.
|
||||
* @param ignoreErrors When this flag is set the method will not throw any runtime or service errors and will return the errors in errors array.
|
||||
* @param host Use this to override the host. The default host is https://management.azure.com
|
||||
*/
|
||||
makeAzureRestRequest(account: azdata.Account, subscription: azureResource.AzureResourceSubscription, path: string, requestType: HttpRequestMethod, requestBody?: any, ignoreErrors?: boolean, host?: string): Promise<AzureRestResponse>;
|
||||
/**
|
||||
* Converts a region value (@see AzureRegion) into the localized Display Name
|
||||
* @param region The region value
|
||||
@@ -97,10 +112,6 @@ declare module 'azurecore' {
|
||||
export type GetStorageAccountResult = { resources: azureResource.AzureGraphResource[], errors: Error[] };
|
||||
export type GetBlobContainersResult = { blobContainers: azureResource.BlobContainer[], errors: Error[] };
|
||||
export type GetFileSharesResult = { fileShares: azureResource.FileShare[], errors: Error[] };
|
||||
export type GetMigrationControllerResult = { controller: azureResource.MigrationController | undefined, errors: Error[] };
|
||||
export type CreateMigrationControllerResult = { controller: azureResource.MigrationController | undefined, errors: Error[] };
|
||||
export type GetMigrationControllerAuthKeysResult = { keyName1: string, keyName2: string, errors: Error[] };
|
||||
|
||||
export type ResourceQueryResult<T extends azureResource.AzureGraphResource> = { resources: T[], errors: Error[] };
|
||||
export type HttpRequestResult = { response: any, errors: Error[] };
|
||||
export type AzureRestResponse = { response: any, errors: Error[] };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user