Skip to content

Commit 402fccf

Browse files
committed
put back method
1 parent 9f68676 commit 402fccf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Common/Extensions/CmdletExtensions.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ public static Job ExecuteAsJob<T>(this T cmdlet, string jobName, Action<T> execu
7171
return job;
7272
}
7373

74+
/// <summary>
75+
/// Determine if AsJob is present
76+
/// </summary>
77+
/// <typeparam name="T">The cmdlet type</typeparam>
78+
/// <param name="cmdlet">The cmdlet</param>
79+
/// <returns>True if the cmdlet shoudl run as a Job, otherwise false</returns>
80+
public static bool AsJobPresent<T>(this T cmdlet) where T : AzurePSCmdlet
81+
{
82+
if (cmdlet == null)
83+
{
84+
throw new ArgumentNullException(nameof(cmdlet));
85+
}
86+
87+
return (cmdlet.MyInvocation?.BoundParameters != null
88+
&& cmdlet.MyInvocation.BoundParameters.ContainsKey("AsJob"));
89+
}
90+
7491
/// <summary>
7592
/// Execute the given cmdlet synchronously os as a job, based on input parameters
7693
/// </summary>

0 commit comments

Comments
 (0)