in src/app/runtime/runtime.wac.ts [148:191]
private GetApiKey(): Observable<ApiKey> {
return this.PrepareIISHost({ command: 'ensure' }).pipe(
catchError((e, _) => {
let errString = e as string;
if (errString) {
let errContent: any;
try {
errContent = JSON.parse(errString);
} catch (e) {
this._logger.log(LogLevel.INFO,
`Unable to parse error message ${e}, the error must be unexpected`);
}
if (errContent) {
if (errContent.Type === 'PREREQ_BELOW_MIN_VERSION') {
return throwError({
type: ApiErrorType.Unreachable,
details: `To manage IIS Server, you need to install ${errContent.App} version ${errContent.Required} or higher. Current version detected: ${errContent.Actual}`,
});
}
if (errContent.Type === 'ADMIN_API_SERVICE_NOT_FOUND') {
return throwError({
type: ApiErrorType.Unreachable,
details: `To manage an IIS Server, you need to install ${errContent.App} on IIS host`,
});
}
if (errContent.Type === 'ADMIN_API_SERVICE_NOT_RUNNING') {
return throwError(new UnexpectedServerStatusError(errContent.Status));
}
}
}
return throwError(e);
}),
mergeMap(_ => {
var tokenUtilParams: any = {
command: 'ensure',
apiHost: this._apiHost,
};
if (this._tokenId) {
tokenUtilParams.tokenId = this._tokenId;
}
return this.powershellService.run<ApiKey>(PowerShellScripts.Get_Token.script, tokenUtilParams);
})
);
}