Skip to content

Commit 9c9a87a

Browse files
committed
Using JobResponse instead of TaskResponse
1 parent d489fa9 commit 9c9a87a

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Failover/StartAzureStorSimpleDeviceFailoverJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public override void ExecuteCmdlet()
101101
ReturnWorkflowId = true
102102
};
103103

104-
var taskResponse = StorSimpleClient.TriggerFailover(deviceId, drRequest);
105-
HandleDeviceJobResponse(taskResponse, "start");
104+
var jobResponse = StorSimpleClient.TriggerFailover(deviceId, drRequest);
105+
HandleDeviceJobResponse(jobResponse, "start");
106106
});
107107
}
108108
catch (Exception exception)

src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
<Compile Include="Properties\AssemblyInfo.cs" />
167167
<Compile Include="ServiceClients\StorSimpleContextClient.cs" />
168168
<Compile Include="ServiceClients\StorSimpleDCClient.cs" />
169-
<Compile Include="ServiceClients\StorSimpleDeviceRestoreClient.cs" />
169+
<Compile Include="ServiceClients\StorSimpleDeviceFailoverClient.cs" />
170170
<Compile Include="ServiceClients\StorSimpleDevicesClient.cs" />
171171
<Compile Include="ServiceClients\StorSimpleServiceConfigClient.cs" />
172172
<Compile Include="ServiceClients\StorSimpleVolumeClient.cs" />

src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@
436436
<value>Volume Container Group \"{0}\" is not eligible for failover due to the reason: {1}</value>
437437
</data>
438438
<data name="SuccessMessageSubmitDeviceJob" xml:space="preserve">
439-
<value>A device job for the {0} task is triggered successfully. Please use the command Get-AzureStorSimpleJob -InstanceId {1} for tracking the job's status</value>
439+
<value>The {0} job is triggered successfully. Please use the command Get-AzureStorSimpleJob -InstanceId {1} for tracking the job's status</value>
440+
</data>
441+
<data name="FailureMessageSubmitDeviceJob" xml:space="preserve">
442+
<value>The {0} job failed to submit. </value>
440443
</data>
441444
</root>

src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleDeviceRestoreClient.cs renamed to src/ServiceManagement/StorSimple/Commands.StorSimple/ServiceClients/StorSimpleDeviceFailoverClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public DataContainerGroupsGetResponse GetFaileoverDataContainerGroups(string dev
2828
return this.GetStorSimpleClient().DeviceFailover.ListDCGroups(deviceId, this.GetCustomRequestHeaders());
2929
}
3030

31-
public TaskResponse TriggerFailover(string deviceId, DeviceFailoverRequest drRequest)
31+
public JobResponse TriggerFailover(string deviceId, DeviceFailoverRequest drRequest)
3232
{
3333
return GetStorSimpleClient().DeviceFailover.Trigger(deviceId, drRequest, GetCustomRequestHeaders());
3434

src/ServiceManagement/StorSimple/Commands.StorSimple/StorSimpleCmdletBase.cs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,30 +92,19 @@ internal virtual void HandleAsyncTaskResponse(AzureOperationResponse opResponse,
9292
WriteVerbose(msg);
9393
}
9494

95-
internal virtual void HandleDeviceJobResponse(AzureOperationResponse opResponse, string operationName)
95+
internal virtual void HandleDeviceJobResponse(JobResponse jobResponse, string operationName)
9696
{
9797
string msg = string.Empty;
9898

99-
if (opResponse.StatusCode != HttpStatusCode.Accepted && opResponse.StatusCode != HttpStatusCode.OK)
99+
if (jobResponse.StatusCode != HttpStatusCode.Accepted && jobResponse.StatusCode != HttpStatusCode.OK)
100100
{
101-
msg = string.Format(Resources.FailureMessageSubmitTask, operationName);
101+
msg = string.Format(Resources.FailureMessageSubmitDeviceJob, operationName);
102102
}
103103

104104
else
105105
{
106-
if (opResponse.GetType().Equals(typeof(TaskResponse)))
107-
{
108-
var taskResponse = opResponse as TaskResponse;
109-
msg = string.Format(Resources.SuccessMessageSubmitDeviceJob, operationName, taskResponse.TaskId);
110-
WriteObject(taskResponse.TaskId);
111-
}
112-
113-
else if (opResponse.GetType().Equals(typeof(GuidTaskResponse)))
114-
{
115-
var guidTaskResponse = opResponse as GuidTaskResponse;
116-
msg = string.Format(Resources.SuccessMessageSubmitDeviceJob, operationName, guidTaskResponse.TaskId);
117-
WriteObject(guidTaskResponse.TaskId);
118-
}
106+
msg = string.Format(Resources.SuccessMessageSubmitDeviceJob, operationName, jobResponse.JobId);
107+
WriteObject(jobResponse.JobId);
119108
}
120109

121110
WriteVerbose(msg);

0 commit comments

Comments
 (0)