Skip to content

Commit ab8672f

Browse files
committed
Add piping support to StopJob and Set-ASSDevice
1 parent 741630d commit ab8672f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class SetAzureStorSimpleDevice : StorSimpleCmdletBase
7171
/// <summary>
7272
/// A collection of network configs for interfaces on the device.
7373
/// </summary>
74-
[Parameter(Mandatory = false, Position = 4, HelpMessage = StorSimpleCmdletHelpMessage.StorSimpleNetworkConfig)]
74+
[Parameter(Mandatory = false, Position = 4, HelpMessage = StorSimpleCmdletHelpMessage.StorSimpleNetworkConfig, ValueFromPipeline=true)]
7575
[ValidateNotNullOrEmpty]
7676
public NetworkConfig[] StorSimpleNetworkConfig { get; set; }
7777

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/StopAzureStorSimpleJob.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public class StopAzureStorSimpleJob : StorSimpleCmdletBase
3232
/// <summary>
3333
/// Device job id of the job to stop.
3434
/// </summary>
35-
[Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.DeviceJobId)]
36-
[ValidateNotNullOrEmptyAttribute]
37-
public string JobId { get; set; }
35+
[Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.DeviceJobId, ValueFromPipelineByPropertyName = true)]
36+
[ValidateNotNullOrEmpty]
37+
public string InstanceId { get; set; }
3838

3939
/// <summary>
4040
/// Wheter to prompt for permission or not.
@@ -48,23 +48,23 @@ public override void ExecuteCmdlet()
4848
{
4949
ConfirmAction(
5050
Force.IsPresent,
51-
string.Format(Resources.StopAzureStorSimpleJobWarningMessage, JobId),
52-
string.Format(Resources.StopAzureStorSimpleJobMessage, JobId),
53-
JobId,
51+
string.Format(Resources.StopAzureStorSimpleJobWarningMessage, InstanceId),
52+
string.Format(Resources.StopAzureStorSimpleJobMessage, InstanceId),
53+
InstanceId,
5454
() =>
5555
{
5656
// Get details of the job being cancelled.
57-
var deviceJobDetails = StorSimpleClient.GetDeviceJobById(JobId);
57+
var deviceJobDetails = StorSimpleClient.GetDeviceJobById(InstanceId);
5858
if (deviceJobDetails == null)
5959
{
60-
WriteVerbose(string.Format(Resources.NoDeviceJobFoundWithGivenIdMessage, JobId));
60+
WriteVerbose(string.Format(Resources.NoDeviceJobFoundWithGivenIdMessage, InstanceId));
6161
WriteObject(null);
6262
return;
6363
}
6464

6565
// issue call to cancel the job.
66-
WriteVerbose(string.Format(Resources.StoppingDeviceJob,JobId));
67-
var taskStatusInfo = StorSimpleClient.StopDeviceJob(deviceJobDetails.Device.InstanceId, JobId);
66+
WriteVerbose(string.Format(Resources.StoppingDeviceJob,InstanceId));
67+
var taskStatusInfo = StorSimpleClient.StopDeviceJob(deviceJobDetails.Device.InstanceId, InstanceId);
6868
HandleSyncTaskResponse(taskStatusInfo, "stop");
6969
if (taskStatusInfo.AsyncTaskAggregatedResult == AsyncTaskAggregatedResult.Succeeded)
7070
{

0 commit comments

Comments
 (0)