コード例 #1
0
        private ContractExecutionResult ProcessTagFile(CompactionTagFileRequest request, string method)
        {
            if (request == null)
            {
                _logger.LogWarning("Empty request passed");
                return(ContractExecutionResult.ErrorResult("Empty Request"));
            }

            request.Validate();

            _logger.LogInformation($"Received Tag File (via {method}) with filename: {request.FileName}. TCC Org: {request.OrgId}. Data Length: {request.Data.Length}");

            using (var data = new MemoryStream(request.Data))
            {
                _logger.LogInformation($"Uploading Tag File {request.FileName}");
                var path = GetS3Key(method, request.FileName, request.OrgId);
                // S3 needs a full path including file, but TCC needs a path and filename as two separate variables
                var s3FullPath = path + request.FileName;

                _transferProxyFactory.NewProxy(TransferProxyType.TagFileGatewayArchive).Upload(data, s3FullPath);
                _logger.LogInformation($"Successfully uploaded Tag File {request.FileName}");
            }

            return(new ContractExecutionResult(0));
        }