Exemplo n.º 1
0
        public async Task <object> CreateSchedule(CreateScheduleRequest request)
        {
            var response = new CreateScheduleResponse
            {
                //Id = await _scheduleStorage.SaveScheduleAsync(CalculateScheduleFor(request.WorkloadItems, plannedMaintenanceWindow))
            };

            return(response);
        }
Exemplo n.º 2
0
    public override async Task<ActionResult<CreateScheduleResponse>> HandleAsync(CreateScheduleRequest request,
      CancellationToken cancellationToken)
    {
      var response = new CreateScheduleResponse(request.CorrelationId());

      var toAdd = _mapper.Map<Schedule>(request);
      toAdd = await _repository.AddAsync(toAdd);

      var dto = _mapper.Map<ScheduleDto>(toAdd);
      response.Schedule = dto;

      return Ok(response);
    }
        public static CreateScheduleResponse Unmarshall(UnmarshallerContext _ctx)
        {
            CreateScheduleResponse createScheduleResponse = new CreateScheduleResponse();

            createScheduleResponse.HttpResponse     = _ctx.HttpResponse;
            createScheduleResponse.RequestId        = _ctx.StringValue("CreateSchedule.RequestId");
            createScheduleResponse.ScheduleName     = _ctx.StringValue("CreateSchedule.ScheduleName");
            createScheduleResponse.Description      = _ctx.StringValue("CreateSchedule.Description");
            createScheduleResponse.ScheduleId       = _ctx.StringValue("CreateSchedule.ScheduleId");
            createScheduleResponse.Payload          = _ctx.StringValue("CreateSchedule.Payload");
            createScheduleResponse.CronExpression   = _ctx.StringValue("CreateSchedule.CronExpression");
            createScheduleResponse.Enable           = _ctx.BooleanValue("CreateSchedule.Enable");
            createScheduleResponse.CreatedTime      = _ctx.StringValue("CreateSchedule.CreatedTime");
            createScheduleResponse.LastModifiedTime = _ctx.StringValue("CreateSchedule.LastModifiedTime");

            return(createScheduleResponse);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CreateScheduleResponse response = new CreateScheduleResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Name", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Name = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 5
0
        public async Task <object> Post(CreateScheduleRequest request)
        {
            _logger.LogInformation("Create schedule requested.");
            using var httpClient = _httpClientFactory.CreateClient();
            var getMaintenanceWindowServiceUriRequest = new HttpRequestMessage(HttpMethod.Get, $"{_configuration["ServiceLocatorBaseAddress"]}/MaintenanceWindowService");
            var maintenanceWindowServiceUriResponse   = await httpClient.SendAsync(getMaintenanceWindowServiceUriRequest).ConfigureAwait(false);

            var maintenanceWindowServiceUri = JsonConvert.DeserializeObject <ServiceLocation>(await maintenanceWindowServiceUriResponse.Content.ReadAsStringAsync()
                                                                                              .ConfigureAwait(false));
            var getPlannedMaintenanceWindowRequest = new HttpRequestMessage(HttpMethod.Get, $"{maintenanceWindowServiceUri.Location}Planned");
            var plannedMaintenanceWindowResponse   = await httpClient.SendAsync(getPlannedMaintenanceWindowRequest).ConfigureAwait(false);

            var plannedMaintenanceWindow =
                JsonConvert.DeserializeObject <MaintenanceWindow>(await plannedMaintenanceWindowResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
            var response = new CreateScheduleResponse
            {
                Id = await _scheduleStorage.SaveScheduleAsync(CalculateScheduleFor(request.WorkloadItems, plannedMaintenanceWindow))
            };

            return(response);
        }