Add extension api for calling azdata commands (#11763)

* Add extension api for calling azdata commands

* Update typings file name
This commit is contained in:
Charles Gagnon
2020-08-12 12:57:59 -07:00
committed by GitHub
parent d96fe82fbc
commit 094ee7c50c
4 changed files with 151 additions and 18 deletions

View File

@@ -0,0 +1,39 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { PostgresServerListResult, SqlInstanceListResult } from '../typings/azdata-ext';
/**
* Helper function to parse the raw output from the `azdata postgres server list` command
* @param result The raw JSON result array
*/
export function parsePostgresServerListResult(result: any[]): PostgresServerListResult[] {
return result.map(r => {
return {
id: r['ID'],
clusterIP: r['clusterIP'],
externalIP: r['externalIP'],
mustRestart: r['mustRestart'],
name: r['name'],
status: r['status']
};
});
}
/**
* Helper function to parse the raw output from the `azdata sql instance list` command
* @param result The raw JSON result array
*/
export function parseSqlInstanceListResult(result: any[]): SqlInstanceListResult[] {
return result.map(r => {
return {
clusterEndpoint: r['Cluster Endpoint'],
externalEndpoint: r['External Endpoint'],
name: r['Name'],
status: r['Status'],
vCores: r['VCores']
};
});
}