@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
168 lines (166 loc) • 7.05 kB
JavaScript
import { Net } from './net';
export class Cim {
static cimClassRelativeUri = 'features/cim/namespaces/{0}/classes/{1}';
static cimQueryRelativeUri = 'features/cim/namespaces/{0}/query';
static cimInvokeRelativeUri = '/methods/{0}/invoke';
static namespace = {
cimV2: 'root.cimv2',
cluster: 'root.MSCluster',
standardCimV2: 'root.standardCimv2',
managementTools: 'root.Microsoft.Windows.ManagementTools',
serverManager: 'root.Microsoft.Windows.ServerManager',
windowsUpdate: 'root.Microsoft.Windows.WindowsUpdate',
/**
* @deprecated namespace is deprecated use "Cim.namespace.managementTools"
*/
managementTools2: 'root.Microsoft.Windows.ManagementTools'
};
static cimClass = {
clusterResource: 'MSCluster_Resource',
clusterNode: 'MSCluster_Node',
win32NetworkAdapter: 'Win32_NetworkAdapter',
clusterUtilities: 'MSCluster_ClusterUtilities',
win32ComputerSystem: 'Win32_ComputerSystem',
win32OperatingSystem: 'Win32_OperatingSystem',
win32Processor: 'Win32_Processor',
win32LogicalDisks: 'Win32_LogicalDisk',
win32PhysicalMemory: 'Win32_PhysicalMemory',
win32Service: 'Win32_Service',
Win32DependentService: 'Win32_DependentService',
win32PnpEntity: 'Win32_PnPEntity',
win32Sid: 'Win32_SID',
msftMTProcessorSummary: 'MSFT_MTProcessorSummary',
msftMTMemorySummary: 'MSFT_MTMemorySummary',
msftMTDisk: 'MSFT_MTDisk',
msftMTNetworkAdapter: 'MSFT_MTNetworkAdapter',
msftMTTaskManager: 'MSFT_MTTaskManager',
msftMTProcesses: 'MSFT_MTProcess',
msftMTEventProvider: 'MSFT_MTEventProvider',
msftMTEventChannel: 'MSFT_MTEventChannel',
msftMTRegistryKey: 'MSFT_MTRegistryKey',
msftMTRegistryValue: 'MSFT_MTRegistryValue',
msftMTRegistryTasks: 'MSFT_MTRegistryTasks',
msftMTRegistryString: 'MSFT_MTregistryString',
msftMTRegistryBinary: 'MSFT_MTregistryBinary',
msftMTRegistryDword: 'MSFT_MTregistryDword',
msftMTRegistryMultiString: 'MSFT_MTregistryMultiString',
msftMTRegistryQword: 'MSFT_MTregistryQword',
msftNetAdapter: 'MSFT_NetAdapter',
msftNetIPInterface: 'MSFT_NetIPInterface',
msftNetIPAddress: 'MSFT_NetIPAddress',
msftNetRoute: 'MSFT_NetRoute',
msftDnsClientServerAddress: 'MSFT_DNSClientServerAddress',
msftServerManagerTasks: 'MSFT_ServerManagerTasks',
msftWUOperationsSession: 'MSFT_WUOperationsSession',
msftWUSettings: 'MSFT_WUSettings',
msftNetFirewallRule: 'MSFT_NetFirewallRule',
msftNetAddressFilter: 'MSFT_NetAddressFilter',
msftNetApplicationFilter: 'MSFT_NetApplicationFilter',
msftNetInterfaceFilter: 'MSFT_NetInterfaceFilter',
msftNetInterfaceTypeFilter: 'MSFT_NetInterfaceTypeFilter',
msftNetProtocolPortFilter: 'MSFT_NetProtocolPortFilter',
msftNetNetworkLayerSecurityFilter: 'MSFT_NetNetworkLayerSecurityFilter',
msftNetServiceFilter: 'MSFT_NetServiceFilter'
};
/**
* WQL query to select by a single property value
* @param className the class name to query for
* @param propertyName The property Name to filter by
* @param properties the collection of properties to retrieve. To get all properties specify and array
* of one element: ["*"]
* @returns the WQL query for the given parameters formatted to add the desired property value:
* Select {properties} from {className} where {PropertyName}='{0}'
*/
static wqlSelectBySingleProperty(className, propertyName, properties) {
return 'Select {0} from {1} where {2}='.format(properties.join(','), className, propertyName) + '\'{0}\'';
}
/**
* CIM URL builder for MultipleInstances
*
* @param namespace the cim namespace.
* @param className the class name.
*/
static cimUrlMultipleInstances(namespace, className) {
return Cim.instanceMultiple(namespace, className);
}
/**
* CIM URL builder for SingleInstance
*
* @param namespace the cim namespace.
* @param className the class name.
* @param keyProperties the key properties object.
*/
static cimUrlSingleInstance(namespace, className, keyProperties) {
return Cim.instanceSingle(namespace, className).format(Net.cimCreateName(keyProperties));
}
/**
* CIM URL builder for InstanceMethod
*
* @param namespace the cim namespace.
* @param className the class name.
* @param methodName the method name.
* @param keyProperties the key properties object.
*/
static cimUrlInstanceMethod(namespace, className, methodName, keyProperties) {
return Cim.invokeInstance(namespace, className, methodName).format(Net.cimCreateName(keyProperties));
}
/**
* CIM URL builder for StaticMethod
*
* @param namespace the cim namespace.
* @param className the class name.
* @param methodName the method name.
*/
static cimUrlStaticMethod(namespace, className, methodName) {
return Cim.invokeStatic(namespace, className, methodName);
}
/**
* CIM URL builder for WqlQuery
*/
static cimUrlWqlQuery(namespace) {
return Cim.cimQueryRelativeUri.format(namespace);
}
/**
* Create Get URL of cim instances.
*
* @param namespaceName name of CIM namespace.
* @param className name of CIM class.
* @return relative URL of GET call.
*/
static instanceMultiple(namespaceName, className) {
return Cim.cimClassRelativeUri.format(namespaceName, className) + '/instances';
}
/**
* Create Get URL of cim single instance.
*
* @param namespaceName name of CIM namespace.
* @param className name of CIM class.
* @return relative URL of GET call.
*/
static instanceSingle(namespaceName, className) {
return Cim.cimClassRelativeUri.format(namespaceName, className) + '/instances/{0}';
}
/**
* Create POST URL of cim static method.
*
* @param namespaceName name of CIM namespace.
* @param className name of CIM class.
* @param methodName name of CIM method.
* @return relative URL of POST call.
*/
static invokeStatic(namespaceName, className, methodName) {
return Cim.cimClassRelativeUri.format(namespaceName, className) + Cim.cimInvokeRelativeUri.format(methodName);
}
/**
* Create POST URL of cim instance method.
*
* @param namespaceName name of CIM namespace.
* @param className name of CIM class.
* @param methodName name of CIM method.
* @return relative URL of POST call.
*/
static invokeInstance(namespaceName, className, methodName) {
return Cim.cimClassRelativeUri.format(namespaceName, className) + '/instances/{0}' + Cim.cimInvokeRelativeUri.format(methodName);
}
}
//# sourceMappingURL=cim.js.map