Example #1
0
        public static async Task <HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "put", Route = "Database/{key}")] HttpRequestMessage req,
            string key,
            [OrchestrationClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            string instanceId;

            // GET request
            if (req.Method == HttpMethod.Get)
            {
                instanceId = await starter.StartNewAsync("Database_GET_Orchestrator", key);

                log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
                return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, System.TimeSpan.MaxValue));
            }

            // PUT request
            else if (req.Method == HttpMethod.Put)
            {
                var    content = req.Content;
                string value   = content.ReadAsStringAsync().Result;
                instanceId = await starter.StartNewAsync("Database_PUT_Orchestrator", new WriteOperation(key, value));

                log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
                return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, System.TimeSpan.MaxValue));
            }

            // Otherwise.
            else
            {
                return(req.CreateResponse(System.Net.HttpStatusCode.BadRequest));
            }
        }
        public async Task <HttpResponseMessage> RunAsync(
            [HttpTrigger(AuthorizationLevel.Anonymous, Route = "scan/{organization}/{projectName}/{scope}")]
            HttpRequestMessage request, string organization, string projectName, string scope,
            [DurableClient] IDurableOrchestrationClient starter)
        {
            if (starter == null)
            {
                throw new ArgumentNullException(nameof(starter));
            }

            if (_tokenizer.IdentifierFromClaim(request) == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }

            var project = await _azuredo.GetAsync(Project.ProjectByName(projectName));

            if (project == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.NotFound));
            }

            // clear cache for manual scan
            _policiesResolver.Clear(project.Id);

            var scanDate   = DateTime.UtcNow;
            var instanceId = await starter.StartNewAsync <object>(nameof(ProjectScanOrchestrator), (project, scope, scanDate));

            return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(request, instanceId,
                                                                                   TimeSpan.FromSeconds(TimeOut)));
        }
Example #3
0
        public static async Task <IActionResult> RunOrchestrated(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            var content = await new StreamReader(req.Body).ReadToEndAsync();

            try
            {
                var options    = JsonConvert.DeserializeObject <FractalOptions>(content);
                var instanceId = await starter.StartNewAsync(nameof(RunOrchestrator), null, options);

                log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
                return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, TimeSpan.FromSeconds(60)));
            }
            catch (Exception ex)
            {
                var response = new FunctionResult
                {
                    ErrorMessage = $"{ex.GetType().Name}: {ex.Message}",
                };

                return(new OkObjectResult(response));
            }
        }
 /// <summary>
 /// Creates an HTTP response which either contains a payload of management URLs for a non-completed instance
 /// or contains the payload containing the output of the completed orchestration.
 /// </summary>
 /// <remarks>
 /// If the orchestration instance completes within the default 10 second timeout, then the HTTP response payload will
 /// contain the output of the orchestration instance formatted as JSON. However, if the orchestration does not
 /// complete within this timeout, then the HTTP response will be identical to that of the
 /// <see cref="IDurableOrchestrationClient.CreateCheckStatusResponse(HttpRequest, string, bool)"/> API.
 /// </remarks>
 /// <param name="client">The client object.</param>
 /// <param name="request">The HTTP request that triggered the current function.</param>
 /// <param name="instanceId">The unique ID of the instance to check.</param>
 /// <returns>An HTTP response which may include a 202 and location header or a 200 with the durable function output in the response body.</returns>
 public static Task <IActionResult> WaitForCompletionOrCreateCheckStatusResponseAsync(
     this IDurableOrchestrationClient client,
     HttpRequest request,
     string instanceId)
 {
     return(client.WaitForCompletionOrCreateCheckStatusResponseAsync(
                request,
                instanceId,
                timeout: TimeSpan.FromSeconds(10)));
 }
 /// <summary>
 /// Creates an HTTP response which either contains a payload of management URLs for a non-completed instance
 /// or contains the payload containing the output of the completed orchestration.
 /// </summary>
 /// <remarks>
 /// If the orchestration instance completes within the specified timeout, then the HTTP response payload will
 /// contain the output of the orchestration instance formatted as JSON. However, if the orchestration does not
 /// complete within the specified timeout, then the HTTP response will be identical to that of the
 /// <see cref="IDurableOrchestrationClient.CreateCheckStatusResponse(HttpRequestMessage, string, bool)"/> API.
 /// </remarks>
 /// <param name="client">The client object.</param>
 /// <param name="request">The HTTP request that triggered the current function.</param>
 /// <param name="instanceId">The unique ID of the instance to check.</param>
 /// <param name="timeout">Total allowed timeout for output from the durable function. The default value is 10 seconds.</param>
 /// <returns>An HTTP response which may include a 202 and location header or a 200 with the durable function output in the response body.</returns>
 public static Task <HttpResponseMessage> WaitForCompletionOrCreateCheckStatusResponseAsync(
     this IDurableOrchestrationClient client,
     HttpRequestMessage request,
     string instanceId,
     TimeSpan timeout)
 {
     return(client.WaitForCompletionOrCreateCheckStatusResponseAsync(
                request,
                instanceId,
                timeout,
                retryInterval: TimeSpan.FromSeconds(1)));
 }
Example #6
0
        public static async Task <IActionResult> Checkout(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = "user/{userId}/order/checkout")] HttpRequest req,
            [DurableClient] IDurableOrchestrationClient client,
            string userId,
            ILogger log)
        {
            log.LogInformation("Processing order checkout.");

            var instanceId = await client.StartNewAsync <string>(nameof(OrderOrchestrator), userId);

            return(await client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId));
        }
Example #7
0
        public static async Task <HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            // Function input comes from the request content.
            string instanceId = await starter.StartNewAsync("Function1", null);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            //return starter.CreateCheckStatusResponse(req, instanceId);
            return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, TimeSpan.FromSeconds(30)));
        }
Example #8
0
        public async Task <HttpResponseMessage> HttpStartAsync(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get")]
            HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient orchestrator)
        {
            Person person     = personService.GetPersonFromRequestAsync(req);
            string instanceId = await orchestrator.StartNewAsync(nameof(GreetingOrchestrator), person);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            return(await orchestrator.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId,
                                                                                        TimeSpan.FromSeconds(TimeoutInSeconds)));
        }
Example #9
0
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = "providers/DotNetDevOps.LetsEncrypt/certificates")] HttpRequestMessage req,
            [OrchestrationClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            var addCertificateRequest = await req.Content.ReadAsAsync <AddCertificateRequest>();

            var instanceId = await starter.StartNewAsync(nameof(AddCertificateOrchestrator), addCertificateRequest);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, TimeSpan.FromSeconds(3)));
        }
        public async Task <IActionResult> ClassifyAsync([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "customers")] HttpRequest request,
                                                        [DurableClient] IDurableOrchestrationClient client)
        {
            var fileRecordsRequest = await request.GetModel <InsertCustomersRequest>();

            var instanceId = Guid.NewGuid().ToString("N");

            await client.StartNewAsync(nameof(CustomerRecordOrchestratorFunction), instanceId, fileRecordsRequest);

            var actionResult = await client.WaitForCompletionOrCreateCheckStatusResponseAsync(request, instanceId, TimeSpan.FromSeconds(2));

            return(actionResult);
        }
Example #11
0
        public static async Task <HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            var body = JsonConvert.DeserializeObject <ListRequest>(req.Content.ReadAsStringAsync().Result);

            string instanceId = await starter.StartNewAsync("DurableFunction", Guid.NewGuid().ToString(), body);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
            return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId));

            //return starter.CreateCheckStatusResponse(req, instanceId);
        }
Example #12
0
        public static async Task <JToken> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get",
                                                           Route = "Counter/{name}")] HttpRequestMessage req,
                                              [DurableClient] IDurableOrchestrationClient client,
                                              string name)
        {
            var entityId       = new EntityId("Counter", name);
            var orchestratorId = await client.StartNewAsync("GetCounter_Orchestrator", entityId);

            await client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, orchestratorId);

            var status = await client.GetStatusAsync(orchestratorId);

            return(status.Output);
        }
Example #13
0
        public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "post",
                                                  Route = "Game/Player/{player}/Add/{item}/{quantity}")] HttpRequestMessage req,
                                     [DurableClient] IDurableOrchestrationClient client,
                                     string player,
                                     string item,
                                     int quantity)
        {
            var input = new AddItemToPlayerInventoryOrchestratorInput
            {
                Player   = player,
                Item     = item,
                Quantity = quantity
            };

            var orchestratorId = await client.StartNewAsync("AddItemToPlayerInventoryFunction_Orchestrator", input);

            await client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, orchestratorId);
        }
        public async Task <IActionResult> ProcessFlow(
            BeginRequestData beginRequestData,
            HttpRequestMessage request,
            IDurableOrchestrationClient client)
        {
            await client.StartNewAsync(Constants.MyOrchestration, beginRequestData.Id, beginRequestData);

            _log.LogInformation($"Started orchestration with ID = '{beginRequestData.Id}'.");

            TimeSpan timeout       = TimeSpan.FromSeconds(7);
            TimeSpan retryInterval = TimeSpan.FromSeconds(1);

            await client.WaitForCompletionOrCreateCheckStatusResponseAsync(
                request,
                beginRequestData.Id,
                timeout,
                retryInterval);

            var data = await client.GetStatusAsync(beginRequestData.Id);

            // timeout
            if (data.RuntimeStatus != OrchestrationRuntimeStatus.Completed)
            {
                await client.TerminateAsync(beginRequestData.Id, "Timeout something took too long");

                return(new ContentResult()
                {
                    Content = "{ error: \"Timeout something took too long\" }",
                    ContentType = "application/json",
                    StatusCode = (int)HttpStatusCode.InternalServerError
                });
            }
            var output = data.Output.ToObject <MyOrchestrationDto>();

            var completeResponseData = new CompleteResponseData
            {
                BeginRequestData = output.BeginRequest,
                Id2 = output.BeginRequest.Id + ".v2",
                MyActivityTwoResult = output.MyActivityTwoResult
            };

            return(new OkObjectResult(completeResponseData));
        }
Example #15
0
        public static async Task <HttpResponseMessage> BalanceInquiry(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "Account/{accountId}")] HttpRequestMessage req,
            string accountId,
            [OrchestrationClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            string instanceId;

            // GET request
            if (req.Method == HttpMethod.Get)
            {
                instanceId = await starter.StartNewAsync("GetBalance", accountId);

                log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
                return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, System.TimeSpan.MaxValue));
            }
            else
            {
                return(req.CreateResponse(System.Net.HttpStatusCode.BadRequest));
            }
        }
        private async Task <HttpResponseMessage> HandleStartOrchestratorRequestAsync(
            HttpRequestMessage request,
            string functionName,
            string instanceId)
        {
            try
            {
                IDurableOrchestrationClient client = this.GetClient(request);

                object input = null;
                if (request.Content != null)
                {
                    using (Stream s = await request.Content.ReadAsStreamAsync())
                        using (StreamReader sr = new StreamReader(s))
                            using (JsonReader reader = new JsonTextReader(sr))
                            {
                                JsonSerializer serializer = JsonSerializer.Create(MessagePayloadDataConverter.MessageSettings);
                                input = serializer.Deserialize <object>(reader);
                            }
                }

                string id = await client.StartNewAsync(functionName, instanceId, input);

                TimeSpan?timeout         = GetTimeSpan(request, "timeout");
                TimeSpan?pollingInterval = GetTimeSpan(request, "pollingInterval");

                if (timeout.HasValue && pollingInterval.HasValue)
                {
                    return(await client.WaitForCompletionOrCreateCheckStatusResponseAsync(request, id, timeout.Value, pollingInterval.Value));
                }
                else
                {
                    return(client.CreateCheckStatusResponse(request, id));
                }
            }
            catch (JsonReaderException e)
            {
                return(request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid JSON content", e));
            }
        }
Example #17
0
        public static async Task <HttpResponseMessage> PerformWithdraw(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "Account/{accountId}/Withdraw/{amount}")] HttpRequestMessage req,
            string accountId,
            string amount,
            [OrchestrationClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            string instanceId;

            // POST request
            if (req.Method == HttpMethod.Post)
            {
                instanceId = await starter.StartNewAsync("Withdraw", new AccountOperation(accountId, "withdraw", Int32.Parse(amount)));

                log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
                return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId, System.TimeSpan.MaxValue));
            }
            else
            {
                return(req.CreateResponse(System.Net.HttpStatusCode.BadRequest));
            }
        }
Example #18
0
        public static async Task <IActionResult> PostCard(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "card/{id:guid}")] HttpRequest request,
            Guid id,
            [DurableClient] IDurableEntityClient entities,
            [DurableClient] IDurableOrchestrationClient orchestrations)
        {
            var entityId    = EntityIdFromGuid(id);
            var entityState = await entities.ReadEntityStateAsync <AttachmentDurableCard>(entityId);

            if (!entityState.EntityExists)
            {
                return(new NotFoundResult());
            }

            var attachment = request.ReadFormAsJObject();

            if (!await entityState.EntityState.ValidateAsync(attachment))
            {
                return(new BadRequestResult());
            }

            var operations = new JsonPatchDocument();

            operations.Add("data/attachments/-", attachment);

            var entityOperation = new EntityOperation
            {
                EntityId = entityId,
                Document = operations
            };

            var instanceId = await orchestrations.StartNewAsync(nameof(PatchCard), entityOperation);

            var timeout  = TimeSpan.FromMinutes(1);
            var response = await orchestrations.WaitForCompletionOrCreateCheckStatusResponseAsync(request, instanceId, timeout);

            return(new RedirectResult($"/card/{id}"));
        }
Example #19
0
        public static async Task <HttpResponseMessage> ResetDeviceStatus(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "v1/devices/{deviceId}/status/reset")] HttpRequestMessage req,
            string deviceId,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            var instanceId       = deviceId;
            var existingInstance = await starter.GetStatusAsync(instanceId);

            if (existingInstance != null)
            {
                await starter.TerminateAsync(instanceId, "reset command called.");

                //await starter.PurgeInstanceHistoryAsync(instanceId);  // これを呼ぶとInstanceの情報すべてが削除される。この場合StartNewAsyncとWaitForCompletionOrCreateCheckStatusResponseAsyncの必要はない
                await starter.StartNewAsync(
                    "UpdateDeviceStatus",
                    instanceId,
                    new InputData
                {
                    State = existingInstance?.CustomStatus?.ToObject <DeviceState>(),
                    Input = new[]
                    {
                        new
                        {
                            Type = "terminate"
                        }
                    }
                });

                var output = await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(
                    req,
                    instanceId,
                    TimeSpan.FromSeconds(10),
                    TimeSpan.FromSeconds(1));
            }

            return(req.CreateResponse(HttpStatusCode.OK));
        }
        public static async Task <IActionResult> PostToServiceBusQueue(
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest request,
            [DurableClient] IDurableOrchestrationClient client,
            ILogger log)
        {
            var inputObject = JObject.Parse(await request.ReadAsStringAsync());
            var numberOfMessagesPerSession = inputObject.Value <int>(@"NumberOfMessagesPerSession");
            var numberOfSessions           = inputObject.Value <int>(@"NumberOfSessions");

            var workTime = -1;

            if (inputObject.TryGetValue(@"WorkTime", out var workTimeVal))
            {
                workTime = workTimeVal.Value <int>();
            }

            var orchestrationIds = new List <string>();
            var testRunId        = Guid.NewGuid().ToString();

            for (var c = 1; c <= numberOfSessions; c++)
            {
                var sessionId = Guid.NewGuid().ToString();
                var orchId    = await client.StartNewAsync(nameof(GenerateMessagesForServiceBusSession),
                                                           new SessionCreateRequest
                {
                    TestRunId = testRunId,
                    SessionId = sessionId,
                    NumberOfMessagesPerSession = numberOfMessagesPerSession,
                    ConsumerWorkTime           = workTime,
                });

                log.LogTrace($@"Kicked off message creation for session {sessionId}...");

                orchestrationIds.Add(orchId);
            }

            return(await client.WaitForCompletionOrCreateCheckStatusResponseAsync(request, orchestrationIds.First(), TimeSpan.FromMinutes(2)));
        }
Example #21
0
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, methods: "post", Route = "orchestrators/{functionName}/wait")]
            HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            string functionName,
            ILogger log)
        {
            // Function input comes from the request content.
            object eventData = await req.Content.ReadAsAsync <object>();

            string instanceId = await starter.StartNewAsync(functionName, eventData);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            TimeSpan timeout       = GetTimeSpan(req, Timeout) ?? TimeSpan.FromSeconds(30);
            TimeSpan retryInterval = GetTimeSpan(req, RetryInterval) ?? TimeSpan.FromSeconds(1);

            return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(
                       req,
                       instanceId,
                       timeout,
                       retryInterval));
        }
Example #22
0
        public async Task <IActionResult> OidcLogin(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "oidc-login/{platformId}")] HttpRequest req,
            [Platform(PlatformId = "{platformId}")] Platform platform,
            [LtiAdvantage] OidcClient oidcClient,
            [DurableClient] IDurableOrchestrationClient orchestrationClient)
        {
            NameValueCollection redirectQueryParams = oidcClient.GetRedirectQueryParams(platform.ClientId);
            string nonce = Guid.NewGuid().ToString();
            string state = Guid.NewGuid().ToString();

            string instanceId = await orchestrationClient.StartNewAsync(nameof(SaveState), (object)(nonce, state));

            await orchestrationClient.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId);

            redirectQueryParams["nonce"] = nonce;
            redirectQueryParams["state"] = state;

            string queryParams = redirectQueryParams.ToString();

            string redirectUrl = $"{platform.AuthorizationUrl}?{queryParams}";

            return(new RedirectResult(redirectUrl));
        }
Example #23
0
        public static async Task <IActionResult> PostToStorageQueue(
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest request,
            [DurableClient] IDurableOrchestrationClient client,
            ILogger log)
        {
            var inputObject      = JObject.Parse(await request.ReadAsStringAsync());
            var numberOfMessages = inputObject.Value <int>(@"NumberOfMessages");

            var workTime = -1;

            if (inputObject.TryGetValue(@"WorkTime", out var workTimeVal))
            {
                workTime = workTimeVal.Value <int>();
            }

            var testRunId = Guid.NewGuid().ToString();
            var orchId    = await client.StartNewAsync(nameof(GenerateMessagesForStorageQueue),
                                                       Tuple.Create(numberOfMessages, testRunId, workTime));

            log.LogTrace($@"Kicked off {numberOfMessages} message creation...");

            return(await client.WaitForCompletionOrCreateCheckStatusResponseAsync(request, orchId, TimeSpan.FromMinutes(2)));
        }
Example #24
0
        public async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            var jsonContent = await req.Content.ReadAsStringAsync();

            log.LogInformation($"Request:{jsonContent}");

            var data = JsonConvert.DeserializeObject <LineRequestInterface>(jsonContent);

            if (data.Events[0].ReplyToken.Equals("00000000000000000000000000000000"))
            {
                return(req.CreateResponse(HttpStatusCode.OK));
            }


            // Function input comes from the request content.
            string instanceId = await starter.StartNewAsync("LineBotOrchestrator", data);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
            return(await starter.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId));
        }
        private async Task <HttpResponseMessage> HandleStartOrchestratorRequestAsync(
            HttpRequestMessage request,
            string functionName,
            string instanceId)
        {
            try
            {
                IDurableOrchestrationClient client = this.GetClient(request);

                object input = null;
                if (request.Content != null && request.Content.Headers?.ContentLength != 0)
                {
                    string json = await request.Content.ReadAsStringAsync();

                    input = JsonConvert.DeserializeObject(json, this.messageDataConverter.JsonSettings);
                }

                string id = await client.StartNewAsync(functionName, instanceId, input);

                TimeSpan?timeout         = GetTimeSpan(request, "timeout");
                TimeSpan?pollingInterval = GetTimeSpan(request, "pollingInterval");

                if (timeout.HasValue && pollingInterval.HasValue)
                {
                    return(await client.WaitForCompletionOrCreateCheckStatusResponseAsync(request, id, timeout.Value, pollingInterval.Value));
                }
                else
                {
                    return(client.CreateCheckStatusResponse(request, id));
                }
            }
            catch (JsonReaderException e)
            {
                return(request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid JSON content", e));
            }
        }