fix(azuredeployer.gbapp): Fix in wheather bot exists on Azure.
This commit is contained in:
parent
8c68332802
commit
13fdc5a3ff
1 changed files with 11 additions and 9 deletions
|
@ -229,18 +229,20 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
||||||
const accessToken = await GBAdminService.getADALTokenFromUsername(username, password);
|
const accessToken = await GBAdminService.getADALTokenFromUsername(username, password);
|
||||||
const httpClient = new ServiceClient();
|
const httpClient = new ServiceClient();
|
||||||
|
|
||||||
const query = `subscriptions/${subscriptionId}/resourceGroups/${group}/providers/${
|
const query = `providers/${
|
||||||
this.provider
|
this.provider
|
||||||
}/botServices/${botId}?api-version=${this.apiVersion}`;
|
}/checkNameAvailability/Action?api-version=${this.apiVersion}`;
|
||||||
|
|
||||||
const url = urlJoin(baseUrl, query);
|
const url = urlJoin(baseUrl, query);
|
||||||
const req = AzureDeployerService.createRequestObject(url, accessToken, 'GET', undefined);
|
const body = {
|
||||||
|
name: botId,
|
||||||
|
type: "botServices"
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = AzureDeployerService.createRequestObject(url, accessToken, 'POST', JSON.stringify(body));
|
||||||
const res = await httpClient.sendRequest(req);
|
const res = await httpClient.sendRequest(req);
|
||||||
// CHECK
|
|
||||||
if (!JSON.parse(res.bodyAsText).id) {
|
return res.parsedBody.valid;
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateBotProxy(botId, group, endpoint) {
|
public async updateBotProxy(botId, group, endpoint) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue