@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
99 lines (98 loc) • 3.22 kB
TypeScript
import { Observable } from 'rxjs';
import { AppContext } from '../data/app-context';
import { EnvironmentModuleEntryPoint, EnvironmentModuleEntryPointWithToolConditionResult } from '../manifest/environment-modules';
import { Connection } from '../security/connection';
import { InventoryQueryCaches } from '../shared/inventory-query-caches';
/**
* The calculation weight ratio base on performance.
*/
export declare const enum ToolConditionWeight {
/**
* Not using any observable calculation.
*/
NonObservable = 0,
/**
* Using the connection property.
*/
Property = 1,
/**
* Using the gateway inventory data.
*/
Gateway = 2,
/**
* Using the server inventory data.
*/
Server = 3,
/**
* Using a custom PowerShell script.
*/
Script = 4
}
/**
* The condition result with weight information.
*/
export interface ToolConditionResultWithWeight {
/**
* The calculation weight.
*/
weight: ToolConditionWeight;
/**
* The result data.
*/
result: Observable<EnvironmentModuleEntryPointWithToolConditionResult> | EnvironmentModuleEntryPointWithToolConditionResult;
}
/**
* The class handles conditions of tools to be presented on tools' menu.
* @dynamic
*/
export declare class ToolConditionValidator {
private appContext;
/**
* Support the following condition name.
* It can be a string, number, boolean and version string.
*/
private static serverInventoryProperties;
/**
* The following operators are supported.
* String comparison uses caseinsesitive pattern.
*/
private static operators;
private static internalCurrent;
private caches;
private toolInventoryCache;
private errorStrings;
/**
* Gets the current object of the ToolConditionValidator class, and maintains as singleton.
*
* @param appContext the application context.
* @param caches the instance of the inventory query caches to share the resource.
*/
static current(appContext: AppContext, caches: InventoryQueryCaches): ToolConditionValidator;
/**
* Initializes a new instance of the ToolConditionValidator class.
*
* @param appContext the application context.
* @param caches the instance of the inventory query caches to share the resource.
*/
constructor(appContext: AppContext, caches: InventoryQueryCaches);
/**
* Scan the tool condition to be present or not.
*
* @param connection the connection object.
* @param solution The entry point object of solution.
* @param tool The entry point object of tool.
* @param scanMode The mode of scanning.
* @return the result observable.
*/
scanToolCondition(connection: Connection, solution: EnvironmentModuleEntryPoint, tool: EnvironmentModuleEntryPoint): ToolConditionResultWithWeight;
private runChecker;
private localhostValidate;
private installationTypeValidate;
private inventoryValidate;
private propertyValidate;
private toolInventoryValidate;
private checkServerInventoryCondition;
private checkCondition;
private compareVersion;
private getNumberOrZero;
}