Example #1
0
        public Task <ContractExecutionResult> PostMdpSummary([FromBody] MDPSummaryRequest mdpSummaryRequest)
        {
            Log.LogInformation($"{nameof(PostMdpSummary)}: " + Request.QueryString);

            mdpSummaryRequest.Validate();
            ValidateFilterMachines(nameof(PostMdpSummary), mdpSummaryRequest.ProjectUid, mdpSummaryRequest.Filter);

            return(WithServiceExceptionTryExecuteAsync(() =>
                                                       RequestExecutorContainer
                                                       .Build <SummaryMDPExecutor>(ConfigStore, LoggerFactory, ServiceExceptionHandler)
                                                       .ProcessAsync(mdpSummaryRequest)));
        }
Example #2
0
        /// <summary>
        /// Processes the summary MDP request by passing the request to Raptor and returning the result.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="item"></param>
        /// <returns>a CMVSummaryResult if successful</returns>
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            try
            {
                var request = CastRequestObjectTo <MDPRequest>(item);
#if RAPTOR
                if (configStore.GetValueBool("ENABLE_TREX_GATEWAY_MDP") ?? false)
                {
#endif
                var mdpSummaryRequest = new MDPSummaryRequest(
                    request.ProjectUid.Value,
                    request.Filter,
                    request.MdpSettings.MdpTarget,
                    request.MdpSettings.OverrideTargetMDP,
                    request.MdpSettings.MaxMDPPercent,
                    request.MdpSettings.MinMDPPercent,
                    AutoMapperUtility.Automapper.Map <LiftSettings>(request.LiftBuildSettings));

                return(await trexCompactionDataProxy.SendDataPostRequest <MDPSummaryResult, MDPSummaryRequest>(mdpSummaryRequest, "/mdp/summary", customHeaders));

#if RAPTOR
            }

            string fileSpaceName = FileDescriptorExtensions.GetFileSpaceId(configStore, log);

            var raptorFilter = RaptorConverters.ConvertFilter(request.Filter, request.ProjectId, raptorClient, request.OverrideStartUtc, request.OverrideEndUtc, request.OverrideAssetIds, fileSpaceName);
            var raptorResult = raptorClient.GetMDPSummary(request.ProjectId ?? VelociraptorConstants.NO_PROJECT_ID,
                                                          ASNodeRPC.__Global.Construct_TASNodeRequestDescriptor((request.CallId ?? Guid.NewGuid()), 0, TASNodeCancellationDescriptorType.cdtMDPSummary),
                                                          ConvertSettings(request.MdpSettings),
                                                          raptorFilter,
                                                          RaptorConverters.ConvertLift(request.LiftBuildSettings, raptorFilter.LayerMethod),
                                                          out var mdpSummary);

            if (raptorResult == TASNodeErrorStatus.asneOK)
            {
                return(ConvertResult(mdpSummary));
            }

            throw CreateServiceException <SummaryMDPExecutor>((int)raptorResult);
#endif
            }
            finally
            {
                ContractExecutionStates.ClearDynamic();
            }
        }