forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaticMethodInvocationJob.cs
More file actions
54 lines (46 loc) · 1.92 KB
/
Copy pathStaticMethodInvocationJob.cs
File metadata and controls
54 lines (46 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using System;
using Microsoft.Management.Infrastructure;
using Microsoft.Management.Infrastructure.Options;
namespace Microsoft.PowerShell.Cmdletization.Cim
{
/// <summary>
/// Job wrapping invocation of a static CIM method
/// </summary>
internal class StaticMethodInvocationJob : ExtrinsicMethodInvocationJob
{
internal StaticMethodInvocationJob(CimJobContext jobContext, MethodInvocationInfo methodInvocationInfo)
: base(jobContext, false /* passThru */, jobContext.CmdletizationClassName, methodInvocationInfo)
{
}
internal override IObservable<CimMethodResultBase> GetCimOperation()
{
if (!this.ShouldProcess())
{
return null;
}
CimMethodParametersCollection methodParameters = this.GetCimMethodParametersCollection();
CimOperationOptions operationOptions = this.CreateOperationOptions();
operationOptions.EnableMethodResultStreaming = true;
IObservable<CimMethodResultBase> observable = this.JobContext.Session.InvokeMethodAsync(
this.JobContext.Namespace,
this.JobContext.ClassNameOrNullIfResourceUriIsUsed,
this.MethodName,
methodParameters,
operationOptions);
return observable;
}
internal override object PassThruObject
{
get { return null; }
}
internal override CimCustomOptionsDictionary CalculateJobSpecificCustomOptions()
{
return CimCustomOptionsDictionary.MergeOptions(
base.CalculateJobSpecificCustomOptions(),
this.GetCimInstancesFromArguments());
}
}
}