public IEnumerable <MsvmVirtualSystemSettingData> Member(MsvmSnapshotCollection inCollection, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inCollection.AsCimInstance(), options); return(instances.Select(i => (MsvmVirtualSystemSettingData)scope.Mapper.Create(scope, i))); }
public IEnumerable <Win32Group> PartComponent(Win32NTDomain inGroupComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inGroupComponent.AsCimInstance(), options); return(instances.Select(i => (Win32Group)scope.Mapper.Create(scope, i))); }
public IEnumerable <CIMServiceAccessPoint> Dependent(CIMLogicalDevice inAntecedent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inAntecedent.AsCimInstance(), options); return(instances.Select(i => (CIMServiceAccessPoint)scope.Mapper.Create(scope, i))); }
internal void FetchAllModuleFiles(CimSession cimSession, string cimNamespace, CimOperationOptions operationOptions) { IEnumerable <CimInstance> associatedInstances = cimSession.EnumerateAssociatedInstances( cimNamespace, _baseObject, DiscoveryProviderAssociationClass, DiscoveryProviderFileClass, "Antecedent", "Dependent", operationOptions); IEnumerable <CimModuleFile> associatedFiles = associatedInstances.Select(i => new CimModuleImplementationFile(i)); _moduleFiles = associatedFiles.ToList(); }
public IEnumerable <CIMService> AffectingElement(CIMManagedElement inAffectedElement, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inAffectedElement.AsCimInstance(), options); return(instances.Select(i => (CIMService)scope.Mapper.Create(scope, i))); }
public IEnumerable <CIMManagedElement> ManagedElement(CIMSettingData inSettingData, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSource(scope, inSettingData.AsCimInstance(), options); return(instances.Select(i => (CIMManagedElement)scope.Mapper.Create(scope, i))); }
public IEnumerable <MsvmEthernetSwitchData> Dependent(MsvmVirtualEthernetSwitch inAntecedent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inAntecedent.AsCimInstance(), options); return(instances.Select(i => (MsvmEthernetSwitchData)scope.Mapper.Create(scope, i))); }
public IEnumerable <MSFTNetConSecRule> PartComponent(MSFTNetFirewallProfile inGroupComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inGroupComponent.AsCimInstance(), options); return(instances.Select(i => (MSFTNetConSecRule)scope.Mapper.Create(scope, i))); }
public IObservable <MSFTNetFirewallProfile> GroupComponentAsync(MSFTNetConSecRule inPartComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inPartComponent.AsCimInstance(), options); return(instances.Select(i => (MSFTNetFirewallProfile)scope.Mapper.Create(scope, i))); }
public IEnumerable <Win32BaseService> Dependent(Win32LoadOrderGroup inAntecedent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inAntecedent.AsCimInstance(), options); return(instances.Select(i => (Win32BaseService)scope.Mapper.Create(scope, i))); }
public IObservable <Win32LoadOrderGroup> AntecedentAsync(Win32BaseService inDependent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inDependent.AsCimInstance(), options); return(instances.Select(i => (Win32LoadOrderGroup)scope.Mapper.Create(scope, i))); }
public IObservable<CIMSystemResource> AntecedentAsync(CimInstance inDependent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inDependent, options); return instances.Select(i => (CIMSystemResource)scope.Mapper.Create(scope, i)); }
public IObservable<CimInstance> DependentAsync(CIMSystemResource inAntecedent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTargetAsync(scope, inAntecedent.AsCimInstance(), options); return instances; }
public IObservable <CIMSettingData> SettingDataAsync(CIMManagedElement inManagedElement, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTargetAsync(scope, inManagedElement.AsCimInstance(), options); return(instances.Select(i => (CIMSettingData)scope.Mapper.Create(scope, i))); }
/// <summary> /// Create <see cref="CimSession"/> by given computer name. /// Then create wrapper object. /// </summary> /// <param name="computerName"></param> /// <param name="operOptions">Used when create async operation</param> public CimSessionProxy(string computerName, CimOperationOptions operOptions) { CreateSetSession(computerName, null, null, operOptions, false); this.isDefaultSession = (computerName == ConstValue.NullComputerName); }
public IEnumerable <MsvmGuestNetworkAdapterConfiguration> PartComponent(CIMResourceAllocationSettingData inGroupComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inGroupComponent.AsCimInstance(), options); return(instances.Select(i => (MsvmGuestNetworkAdapterConfiguration)scope.Mapper.Create(scope, i))); }
/// <summary> /// Initialize CimSessionProxy object /// </summary> /// <param name="computerName"></param> /// <param name="session"></param> /// <param name="sessionOptions"></param> /// <param name="options"></param> private void CreateSetSession( string computerName, CimSession cimSession, CimSessionOptions sessionOptions, CimOperationOptions operOptions, bool temporaryCimSession) { DebugHelper.WriteLogEx("computername {0}; cimsession {1}; sessionOptions {2}; operationOptions {3}.", 0, computerName, cimSession, sessionOptions, operOptions); lock (this.stateLock) { this.CancelOperation = null; this.operation = null; } InitOption(operOptions); this.protocol = ProtocolType.Wsman; this.isTemporaryCimSession = temporaryCimSession; if (cimSession != null) { this.session = cimSession; CimSessionState state = CimSessionBase.GetCimSessionState(); if (state != null) { CimSessionWrapper wrapper = state.QuerySession(cimSession); if (wrapper != null) { this.protocol = wrapper.GetProtocolType(); } } } else { if (sessionOptions != null) { if (sessionOptions is DComSessionOptions) { string defaultComputerName = ConstValue.IsDefaultComputerName(computerName) ? ConstValue.NullComputerName : computerName; this.session = CimSession.Create(defaultComputerName, sessionOptions); this.protocol = ProtocolType.Dcom; } else { this.session = CimSession.Create(computerName, sessionOptions); } } else { this.session = CreateCimSessionByComputerName(computerName); } this.isTemporaryCimSession = true; } if (this.isTemporaryCimSession) { AddCimSessionToTemporaryCache(this.session); } this.invocationContextObject = new InvocationContext(this); DebugHelper.WriteLog("Protocol {0}, Is temporary session ? {1}", 1, this.protocol, this.isTemporaryCimSession); }
public IObservable <CIMResourceAllocationSettingData> GroupComponentAsync(MsvmGuestNetworkAdapterConfiguration inPartComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inPartComponent.AsCimInstance(), options); return(instances.Select(i => (CIMResourceAllocationSettingData)scope.Mapper.Create(scope, i))); }
internal void Apply(CimOperationOptions cimOperationOptions, CimSensitiveValueConverter cimSensitiveValueConverter) { CimOperationOptionsHelper.SetCustomOptions(cimOperationOptions, this.GetSnapshot(), cimSensitiveValueConverter); }
public IEnumerable <MSFTNetAdapterRdmaSettingData> SettingData(MSFTNetAdapter inManagedElement, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inManagedElement.AsCimInstance(), options); return(instances.Select(i => (MSFTNetAdapterRdmaSettingData)scope.Mapper.Create(scope, i))); }
public IObservable <MsvmVirtualEthernetSwitch> AntecedentAsync(MsvmEthernetSwitchData inDependent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inDependent.AsCimInstance(), options); return(instances.Select(i => (MsvmVirtualEthernetSwitch)scope.Mapper.Create(scope, i))); }
public IObservable <MSFTNetAdapter> ManagedElementAsync(MSFTNetAdapterRdmaSettingData inSettingData, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inSettingData.AsCimInstance(), options); return(instances.Select(i => (MSFTNetAdapter)scope.Mapper.Create(scope, i))); }
private static IEnumerable <CimModule> GetCimModules( CimSession cimSession, Uri resourceUri, string cimNamespace, string moduleNamePattern, bool onlyManifests, Cmdlet cmdlet, CancellationToken cancellationToken) { Dbg.Assert(cimSession != null, "Caller should verify cimSession != null"); Dbg.Assert(moduleNamePattern != null, "Caller should verify that moduleNamePattern != null"); const WildcardOptions wildcardOptions = WildcardOptions.IgnoreCase | WildcardOptions.CultureInvariant; var wildcardPattern = WildcardPattern.Get(moduleNamePattern, wildcardOptions); string dosWildcard = WildcardPatternToDosWildcardParser.Parse(wildcardPattern); var options = new CimOperationOptions { CancellationToken = cancellationToken }; options.SetCustomOption("PS_ModuleNamePattern", dosWildcard, mustComply: false); if (resourceUri != null) { options.ResourceUri = resourceUri; } if (string.IsNullOrEmpty(cimNamespace) && (resourceUri is null)) { cimNamespace = DiscoveryProviderNamespace; } // TODO/FIXME: ETW for method invocation IEnumerable <CimInstance> syncResults = cimSession.EnumerateInstances( cimNamespace, DiscoveryProviderModuleClass, options); // TODO/FIXME: ETW for method results IEnumerable <CimModule> cimModules = syncResults .Select(cimInstance => new CimModule(cimInstance)) .Where(cimModule => wildcardPattern.IsMatch(cimModule.ModuleName)); if (!onlyManifests) { cimModules = cimModules.Select( delegate(CimModule cimModule) { cimModule.FetchAllModuleFiles(cimSession, cimNamespace, options); return(cimModule); }); } return(EnumerateWithCatch( cimModules, delegate(Exception exception) { ErrorRecord errorRecord = GetErrorRecordForRemoteDiscoveryProvider(exception); if (!cmdlet.MyInvocation.ExpectingInput) { if (((-1) != errorRecord.FullyQualifiedErrorId.IndexOf(DiscoveryProviderNotFoundErrorId, StringComparison.OrdinalIgnoreCase)) || (cancellationToken.IsCancellationRequested || (exception is OperationCanceledException)) || (!cimSession.TestConnection())) { cmdlet.ThrowTerminatingError(errorRecord); } } cmdlet.WriteError(errorRecord); })); }
public IEnumerable <Win32DCOMApplication> GroupComponent(Win32ClassicCOMClass inPartComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSource(scope, inPartComponent.AsCimInstance(), options); return(instances.Select(i => (Win32DCOMApplication)scope.Mapper.Create(scope, i))); }
public IObservable <CIMManagedElement> AffectedElementAsync(CIMService inAffectingElement, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inAffectingElement.AsCimInstance(), options); return(instances.Select(i => (CIMManagedElement)scope.Mapper.Create(scope, i))); }
public IObservable <Win32ClassicCOMClass> PartComponentAsync(Win32DCOMApplication inGroupComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTargetAsync(scope, inGroupComponent.AsCimInstance(), options); return(instances.Select(i => (Win32ClassicCOMClass)scope.Mapper.Create(scope, i))); }
public IObservable <Win32NTDomain> GroupComponentAsync(Win32Group inPartComponent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inPartComponent.AsCimInstance(), options); return(instances.Select(i => (Win32NTDomain)scope.Mapper.Create(scope, i))); }
public IEnumerable <MsvmSummaryInformationBase> Dependent(CIMComputerSystem inAntecedent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inAntecedent.AsCimInstance(), options); return(instances.Select(i => (MsvmSummaryInformationBase)scope.Mapper.Create(scope, i))); }
public IObservable <CIMLogicalDevice> AntecedentAsync(CIMServiceAccessPoint inDependent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inDependent.AsCimInstance(), options); return(instances.Select(i => (CIMLogicalDevice)scope.Mapper.Create(scope, i))); }
public IObservable <CIMComputerSystem> AntecedentAsync(MsvmSummaryInformationBase inDependent, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inDependent.AsCimInstance(), options); return(instances.Select(i => (CIMComputerSystem)scope.Mapper.Create(scope, i))); }
// Dispose(bool disposing) executes in two distinct scenarios. // If disposing equals true, the method has been called directly // or indirectly by a user's code. Managed and unmanaged resources // can be disposed. // If disposing equals false, the method has been called by the // runtime from inside the finalizer and you should not reference // other objects. Only unmanaged resources can be disposed. protected virtual void Dispose(bool disposing) { DebugHelper.WriteLogEx("Disposed = {0}", 0, this.IsDisposed); if (Interlocked.CompareExchange(ref this._disposed, 1, 0) == 0) { if (disposing) { // Dispose managed resources. this.DisposeCancelOperation(); if (this.options != null) { this.options.Dispose(); this.options = null; } DisposeTemporaryCimSession(); } } }
public IEnumerable <Win32NamedJobObjectSecLimitSetting> Setting(Win32NamedJobObject inCollection, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveTarget(scope, inCollection.AsCimInstance(), options); return(instances.Select(i => (Win32NamedJobObjectSecLimitSetting)scope.Mapper.Create(scope, i))); }
/// <summary> /// Create wrapper object by given session object /// </summary> /// <param name="session"></param> /// <param name="operOptions">Used when create async operation</param> public CimSessionProxy(CimSession session, CimOperationOptions operOptions) { CreateSetSession(null, session, null, operOptions, false); }
public IObservable <Win32NamedJobObject> CollectionAsync(Win32NamedJobObjectSecLimitSetting inSetting, CimOperationOptions options = null) { var scope = _scope; var instances = _resolver.ResolveSourceAsync(scope, inSetting.AsCimInstance(), options); return(instances.Select(i => (Win32NamedJobObject)scope.Mapper.Create(scope, i))); }
/// <summary> /// Initialize the operation option /// </summary> private void InitOption(CimOperationOptions operOptions) { DebugHelper.WriteLogEx(); if (operOptions != null) { this.options = new CimOperationOptions(operOptions); } else if (this.options == null) { this.options = new CimOperationOptions(); } this.EnableMethodResultStreaming = true; this.EnablePSSemantics(); }
public virtual void RegisterAcceptedAsyncCallbacks(OperationCallbacks operationCallbacks, CimOperationOptions operationOptions) { operationCallbacks.InternalErrorCallback = new OperationCallbacks.InternalErrorCallbackDelegate(this.ReportInternalErrorCore); operationCallbacks.ManagedOperationContext = this; }