private async Task <HttpResponseMessage> HandleRewindInstanceRequestAsync( HttpRequestMessage request, string instanceId) { IDurableOrchestrationClient client = this.GetClient(request); DurableOrchestrationStatus status = await client.GetStatusAsync(instanceId); if (status == null) { return(request.CreateResponse(HttpStatusCode.NotFound)); } switch (status.RuntimeStatus) { case OrchestrationRuntimeStatus.Canceled: case OrchestrationRuntimeStatus.Terminated: case OrchestrationRuntimeStatus.Completed: return(request.CreateResponse(HttpStatusCode.Gone)); } string reason = request.GetQueryNameValuePairs()["reason"]; #pragma warning disable 0618 await client.RewindAsync(instanceId, reason); #pragma warning restore 0618 return(request.CreateResponse(HttpStatusCode.Accepted)); }