Exemplo n.º 1
0
        private async Task <IActionResult> SendExportRequest(
            ExportJobType exportType,
            PartialDateTime since,
            string resourceType  = null,
            string groupId       = null,
            string containerName = null,
            string formatName    = null,
            string anonymizationConfigLocation = null,
            string anonymizationConfigFileETag = null)
        {
            CreateExportResponse response = await _mediator.ExportAsync(
                _fhirRequestContextAccessor.FhirRequestContext.Uri,
                exportType,
                resourceType,
                since,
                groupId,
                containerName,
                formatName,
                anonymizationConfigLocation,
                anonymizationConfigFileETag,
                HttpContext.RequestAborted);

            var exportResult = ExportResult.Accepted();

            exportResult.SetContentLocationHeader(_urlResolver, OperationsConstants.Export, response.JobId);
            return(exportResult);
        }
Exemplo n.º 2
0
        public ExportJobRecord(
            Uri requestUri,
            ExportJobType exportType,
            string resourceType,
            string hash,
            IReadOnlyCollection <KeyValuePair <string, string> > requestorClaims = null,
            PartialDateTime since = null,
            string groupId        = null,
            string storageAccountConnectionHash   = null,
            string storageAccountUri              = null,
            uint maximumNumberOfResourcesPerQuery = 100,
            uint numberOfPagesPerCommit           = 10)
        {
            EnsureArg.IsNotNull(requestUri, nameof(requestUri));
            EnsureArg.IsNotNullOrWhiteSpace(hash, nameof(hash));

            Hash            = hash;
            RequestUri      = requestUri;
            ExportType      = exportType;
            ResourceType    = resourceType;
            RequestorClaims = requestorClaims;
            Since           = since;
            GroupId         = groupId;
            StorageAccountConnectionHash     = storageAccountConnectionHash;
            StorageAccountUri                = storageAccountUri;
            MaximumNumberOfResourcesPerQuery = maximumNumberOfResourcesPerQuery;
            NumberOfPagesPerCommit           = numberOfPagesPerCommit;

            // Default values
            SchemaVersion = 1;
            Id            = Guid.NewGuid().ToString();
            Status        = OperationStatus.Queued;

            QueuedTime = Clock.UtcNow;
        }
Exemplo n.º 3
0
        public CreateExportRequest(
            Uri requestUri,
            ExportJobType requestType,
            string resourceType   = null,
            PartialDateTime since = null,
            string filters        = null,
            string groupId        = null,
            string containerName  = null,
            string formatName     = null,
            string anonymizationConfigurationLocation = null,
            string anonymizationConfigurationFileETag = null)
        {
            EnsureArg.IsNotNull(requestUri, nameof(requestUri));

            RequestUri   = requestUri;
            RequestType  = requestType;
            ResourceType = resourceType;

            Since   = since;
            Filters = filters;
            AnonymizationConfigurationLocation = anonymizationConfigurationLocation;
            AnonymizationConfigurationFileETag = anonymizationConfigurationFileETag;
            GroupId       = groupId;
            ContainerName = containerName;
            FormatName    = formatName;
        }
Exemplo n.º 4
0
        public ExportJobRecord(
            Uri requestUri,
            ExportJobType exportType,
            string exportFormat,
            string resourceType,
            IList <ExportJobFilter> filters,
            string hash,
            uint rollingFileSizeInMB,
            IReadOnlyCollection <KeyValuePair <string, string> > requestorClaims = null,
            PartialDateTime since = null,
            string groupId        = null,
            string storageAccountConnectionHash       = null,
            string storageAccountUri                  = null,
            string anonymizationConfigurationLocation = null,
            string anonymizationConfigurationFileETag = null,
            uint maximumNumberOfResourcesPerQuery     = 100,
            uint numberOfPagesPerCommit               = 10,
            string storageAccountContainerName        = null,
            int schemaVersion = 2)
        {
            EnsureArg.IsNotNull(requestUri, nameof(requestUri));
            EnsureArg.IsNotNullOrWhiteSpace(hash, nameof(hash));
            EnsureArg.IsNotNullOrWhiteSpace(exportFormat, nameof(exportFormat));
            EnsureArg.IsGt(schemaVersion, 0, nameof(schemaVersion));

            Hash            = hash;
            RequestUri      = requestUri;
            ExportType      = exportType;
            ExportFormat    = exportFormat;
            ResourceType    = resourceType;
            Filters         = filters;
            RequestorClaims = requestorClaims;
            Since           = since;
            GroupId         = groupId;
            StorageAccountConnectionHash     = storageAccountConnectionHash;
            StorageAccountUri                = storageAccountUri;
            MaximumNumberOfResourcesPerQuery = maximumNumberOfResourcesPerQuery;
            NumberOfPagesPerCommit           = numberOfPagesPerCommit;
            RollingFileSizeInMB              = rollingFileSizeInMB;

            AnonymizationConfigurationLocation = anonymizationConfigurationLocation;
            AnonymizationConfigurationFileETag = anonymizationConfigurationFileETag;

            // Default values
            SchemaVersion = schemaVersion;
            Id            = Guid.NewGuid().ToString();
            Status        = OperationStatus.Queued;

            QueuedTime = Clock.UtcNow;

            if (string.IsNullOrWhiteSpace(storageAccountContainerName))
            {
                StorageAccountContainerName = Id;
            }
            else
            {
                StorageAccountContainerName = storageAccountContainerName;
            }
        }
Exemplo n.º 5
0
        public CreateExportRequest(Uri requestUri, ExportJobType requestType, string resourceType = null, PartialDateTime since = null)
        {
            EnsureArg.IsNotNull(requestUri, nameof(requestUri));

            RequestUri   = requestUri;
            RequestType  = requestType;
            ResourceType = resourceType;
            Since        = since;
        }
Exemplo n.º 6
0
        private async Task <IActionResult> SendExportRequest(ExportJobType exportType, PartialDateTime since, string resourceType = null)
        {
            CreateExportResponse response = await _mediator.ExportAsync(_fhirRequestContextAccessor.FhirRequestContext.Uri, exportType, resourceType, since, HttpContext.RequestAborted);

            var exportResult = ExportResult.Accepted();

            exportResult.SetContentLocationHeader(_urlResolver, OperationsConstants.Export, response.JobId);

            return(exportResult);
        }
        public static async Task <CreateExportResponse> ExportAsync(
            this IMediator mediator,
            Uri requestUri,
            ExportJobType requestType,
            string resourceType,
            PartialDateTime since,
            CancellationToken cancellationToken)
        {
            EnsureArg.IsNotNull(mediator, nameof(mediator));
            EnsureArg.IsNotNull(requestUri, nameof(requestUri));

            var request = new CreateExportRequest(requestUri, requestType, resourceType, since);

            CreateExportResponse response = await mediator.Send(request, cancellationToken);

            return(response);
        }
Exemplo n.º 8
0
        public static async Task <CreateExportResponse> ExportAsync(
            this IMediator mediator,
            Uri requestUri,
            ExportJobType requestType,
            string resourceType,
            PartialDateTime since,
            string groupId,
            string containerName,
            string anonymizationConfigLocation,
            string anonymizationConfigFileETag,
            CancellationToken cancellationToken)
        {
            EnsureArg.IsNotNull(mediator, nameof(mediator));
            EnsureArg.IsNotNull(requestUri, nameof(requestUri));

            var request = new CreateExportRequest(requestUri, requestType, resourceType, since, groupId, containerName, anonymizationConfigLocation, anonymizationConfigFileETag);

            CreateExportResponse response = await mediator.Send(request, cancellationToken);

            return(response);
        }