public async Task UpdateAsync(ServiceInstanceUpdateRequest request)
        {
            var response = await _inner.UpdateAsync(request);

            if (string.IsNullOrEmpty(response.Operation))
                return;

            await LastOperationWaitAsync(request.ServiceId, request.PlanId, response.Operation);
        }
Пример #2
0
        public async Task Update()
        {
            var request = new ServiceInstanceUpdateRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };

            SetupMock(x => x.UpdateAsync(new ServiceInstanceContext("123"), request));
            await Client.ServiceInstancesBlocking["123"].UpdateAsync(request);
        }
Пример #3
0
        public async Task Update()
        {
            var request = new ServiceInstanceUpdateRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };

            Mock.Setup(x => x.UpdateAsync(new("123"), request))
            .Returns(Task.CompletedTask);
            await Client.ServiceInstancesBlocking["123"].UpdateAsync(request);
        }
        public async Task UpdateCompleted()
        {
            var request = new ServiceInstanceUpdateRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };
            var response = new ServiceInstanceAsyncOperation();

            SetupMock(x => x.UpdateAsync(new ServiceInstanceContext("123"), request), response);
            await Client.ServiceInstancesPolling["123"].UpdateAsync(request);
        }
Пример #5
0
        public async Task UpdateCompleted()
        {
            var request = new ServiceInstanceUpdateRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };
            var response = new ServiceInstanceAsyncOperation();

            SetupMock(x => x.UpdateAsync(new ServiceInstanceContext("123"), request), response);
            var result = await Client.ServiceInstancesDeferred["123"].UpdateAsync(request);

            result.Should().BeEquivalentTo(response);
        }
Пример #6
0
        public async Task UpdateBody()
        {
            var request = new ServiceInstanceUpdateRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };

            SetupMock(x => x.UpdateAsync(new ServiceInstanceContext("123"), request));

            var result = await Client.HttpClient.PatchAsync(Client.ServiceInstancesBlocking["123"].Uri, request, Client.Serializer);

            result.StatusCode.Should().BeEquivalentTo(HttpStatusCode.OK);
            string resultString = await result.Content.ReadAsStringAsync();

            resultString.Should().Be("{}");
        }
Пример #7
0
        public async Task UpdateDeferred()
        {
            var request = new ServiceInstanceUpdateRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };
            var response = new ServiceInstanceAsyncOperation
            {
                Operation    = "my operation",
                DashboardUrl = new Uri("http://example.com")
            };

            SetupMock(x => x.UpdateAsync(new ServiceInstanceContext("123"), request), response);
            var result = await Client.ServiceInstancesDeferred["123"].UpdateAsync(request);

            result.Should().BeEquivalentTo(response);
        }
Пример #8
0
        public Task <IActionResult> Update(
            [FromRoute(Name = "instance_id"), Required] string instanceId,
            [FromBody, Required] ServiceInstanceUpdateRequest request,
            [FromQuery(Name = "accepts_incomplete")] bool acceptsIncomplete = false)
        {
            var context = Context(instanceId);

            return(Do(acceptsIncomplete,
                      blocking: async x =>
            {
                await x.UpdateAsync(context, request);
                return Ok();
            },
                      deferred: async x =>
            {
                var result = await x.UpdateAsync(context, request);
                return result.Completed
                        ? Ok()
                        : AsyncResult(context, result, request);
            }));
        }
        public async Task UpdateDeferred()
        {
            var request = new ServiceInstanceUpdateRequest
            {
                ServiceId = "abc",
                PlanId    = "xyz"
            };
            var response = new ServiceInstanceAsyncOperation
            {
                Operation = "my operation"
            };
            var operation = new LastOperationResource
            {
                State       = LastOperationResourceState.Succeeded,
                Description = "done"
            };

            SetupMock(x => x.UpdateAsync(new ServiceInstanceContext("123"), request), response);
            SetupMock(x => x.GetLastOperationAsync(new ServiceInstanceContext("123"), "abc", "xyz", "my operation"), operation);
            await Client.ServiceInstancesPolling["123"].UpdateAsync(request);
        }
Пример #10
0
        public async Task <ServiceInstanceAsyncOperation> UpdateAsync(ServiceInstanceUpdateRequest request)
        {
            var response = await HandleAsync(() => HttpClient.PatchAsync(Uri, request, Serializer));

            return(await ParseDeferredResponseAsync <ServiceInstanceProvision, ServiceInstanceAsyncOperation>(response));
        }
Пример #11
0
 public Task UpdateAsync(ServiceInstanceUpdateRequest request)
 => HandleAsync(() => HttpClient.PatchAsync(Uri, request, Serializer));