Skip to content

Commit f25000f

Browse files
committed
gh-165 Update user guide
Signed-off-by: Victor Chang <[email protected]>
1 parent ac77ea6 commit f25000f

File tree

6 files changed

+108
-8
lines changed

6 files changed

+108
-8
lines changed

docs/api/rest/config.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Response Content Type: JSON - [MonaiApplicationEntity](xref:Monai.Deploy.Informa
8585
| Code | Description |
8686
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
8787
| 200 | Configuration retrieved successfully. |
88-
| 404 | Configuration Titles not found. |
88+
| 404 | Named AE not found. |
8989
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
9090

9191
### Example Request
@@ -185,7 +185,7 @@ Response Content Type: JSON - [MonaiApplicationEntity](xref:Monai.Deploy.Informa
185185
| Code | Description |
186186
| ---- | ---------------------------------------------------------------------------------------------------------------------------------------- |
187187
| 200 | AE Title deleted. |
188-
| 404 | AE Title not found. |
188+
| 404 | Named MONAI AE not found. |
189189
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
190190

191191
### Example Request
@@ -265,7 +265,7 @@ Response Content Type: JSON - [SourceApplicationEntity](xref:Monai.Deploy.Inform
265265
| Code | Description |
266266
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
267267
| 200 | AE Titles retrieved successfully. |
268-
| 404 | AE Titles not found. |
268+
| 404 | Named source not found. |
269269
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
270270

271271
### Example Request
@@ -347,7 +347,7 @@ Response Content Type: JSON - [SourceApplicationEntity](xref:Monai.Deploy.Inform
347347
| Code | Description |
348348
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
349349
| 200 | AE Title deleted. |
350-
| 404 | AE Title not found. |
350+
| 404 | Named source not found. |
351351
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
352352

353353
### Example Request
@@ -451,6 +451,34 @@ curl --location --request GET 'http://localhost:5000/config/destination/USEAST'
451451

452452
---
453453

454+
## GET /config/destination/cecho/{name}
455+
456+
Performs a DICOM C-Echo request to the named destination on behalf of `MONAISCU`.
457+
458+
### Parameters
459+
460+
| Name | Type | Description |
461+
| ---- | ------ | ----------------------------------------- |
462+
| name | string | The _name_ of the AE Title to be deleted. |
463+
464+
### Responses
465+
466+
467+
| Code | Description |
468+
| ---- | ----------------------------------------------------------------------------------------------------------------------------------------- |
469+
| 200 | C-ECHO performed successfully. |
470+
| 404 | Named destination not found. |
471+
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
472+
| 502 | C-ECHO failure. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
473+
474+
### Example Request
475+
476+
```bash
477+
curl --location --request DELETE 'http://localhost:5000/config/destination/cecho/USEAST'
478+
```
479+
480+
---
481+
454482
## POST /config/destination
455483

456484
Adds a new DICOM destination AET for exporting results to.
@@ -513,13 +541,13 @@ Response Content Type: JSON - [DestinationApplicationEntity](xref:Monai.Deploy.I
513541
| Code | Description |
514542
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
515543
| 200 | AE Title deleted. |
516-
| 404 | AE Title not found. |
544+
| 404 | Named destination not found. |
517545
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
518546

519547
### Example Request
520548

521549
```bash
522-
curl --location --request DELETE 'http://localhost:5000/config/ae/USEAST'
550+
curl --location --request DELETE 'http://localhost:5000/config/destination/USEAST'
523551
```
524552

525553
### Example Response

docs/setup/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ Options:
170170

171171
Commands:
172172
add Add a new DICOM destination
173+
cecho C-ECHO a DICOM destination
173174
del, rm Remove a DICOM destination
174175
list, ls List all DICOM destinations
175176
```

src/Client/Monai.Deploy.InformaticsGateway.Client.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@
2424
</PropertyGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
2827
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
2928
<PrivateAssets>All</PrivateAssets>
3029
</PackageReference>
3130
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
3231
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
33-
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
3432
</ItemGroup>
3533

3634
<ItemGroup>

src/Client/Services/AeTitle{T}Service.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System.Threading.Tasks;
2424
using Ardalis.GuardClauses;
2525
using Microsoft.Extensions.Logging;
26+
using Monai.Deploy.InformaticsGateway.Api;
2627

2728
namespace Monai.Deploy.InformaticsGateway.Client.Services
2829
{
@@ -93,6 +94,10 @@ public async Task<IReadOnlyList<T>> List(CancellationToken cancellationToken)
9394

9495
public async Task CEcho(string name, CancellationToken cancellationToken)
9596
{
97+
if (typeof(T) != typeof(DestinationApplicationEntity))
98+
{
99+
throw new NotSupportedException($"C-ECHO is not supported for {typeof(T).Name}");
100+
}
96101
name = Uri.EscapeDataString(name);
97102
Guard.Against.NullOrWhiteSpace(name, nameof(name));
98103
Logger.SendingRequestTo($"{Route}/{name}");

src/Client/Test/AeTitleServiceTest.cs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,72 @@ public async Task List_ReturnsAProblem()
324324

325325
Assert.Equal($"HTTP Status: {problem.Status}. {problem.Detail}", result.Message);
326326
}
327+
328+
[Fact(DisplayName = "Destination - C-ECHO")]
329+
public async Task CEcho()
330+
{
331+
var aet = new SourceApplicationEntity()
332+
{
333+
AeTitle = "Test",
334+
Name = "Test",
335+
HostIp = "1.2.3.4"
336+
};
337+
338+
var json = JsonSerializer.Serialize(aet, Configuration.JsonSerializationOptions);
339+
340+
var rootUri = new Uri("http://localhost:5000");
341+
var uriPath = "config/destination";
342+
343+
var httpResponse = new HttpResponseMessage
344+
{
345+
StatusCode = HttpStatusCode.OK,
346+
Content = new StringContent(json, Encoding.UTF8, "application/json")
347+
};
348+
349+
var httpClient = SetupHttpClientMock(rootUri, HttpMethod.Get, httpResponse);
350+
351+
var service = new AeTitleService<DestinationApplicationEntity>(uriPath, httpClient, _logger.Object);
352+
353+
var exception = await Record.ExceptionAsync(async () => await service.CEcho(aet.Name, CancellationToken.None));
354+
Assert.Null(exception);
355+
356+
}
357+
358+
[Fact(DisplayName = "Destination - C-ECHO returns a problem")]
359+
public async Task CEcho_ReturnsAProblem()
360+
{
361+
var aet = new SourceApplicationEntity()
362+
{
363+
AeTitle = "Test",
364+
Name = "Test Name",
365+
HostIp = "1.2.3.4"
366+
};
367+
368+
var problem = new ProblemDetails
369+
{
370+
Title = "Problem Title",
371+
Detail = "Problem Detail",
372+
Status = 500
373+
};
374+
375+
var json = JsonSerializer.Serialize(problem, Configuration.JsonSerializationOptions);
376+
377+
var rootUri = new Uri("http://localhost:5000");
378+
var uriPath = "config/destination";
379+
380+
var httpResponse = new HttpResponseMessage
381+
{
382+
StatusCode = HttpStatusCode.InternalServerError,
383+
Content = new StringContent(json, Encoding.UTF8, "application/json")
384+
};
385+
386+
var httpClient = SetupHttpClientMock(rootUri, HttpMethod.Get, httpResponse);
387+
388+
var service = new AeTitleService<DestinationApplicationEntity>(uriPath, httpClient, _logger.Object);
389+
390+
var result = await Assert.ThrowsAsync<ProblemException>(async () => await service.CEcho(aet.Name, CancellationToken.None));
391+
392+
Assert.Equal($"HTTP Status: {problem.Status}. {problem.Detail}", result.Message);
393+
}
327394
}
328395
}

src/InformaticsGateway/Services/Http/DestinationAeTitleController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public async Task<ActionResult<DestinationApplicationEntity>> GetAeTitle(string
9595
[Produces("application/json")]
9696
[ProducesResponseType(StatusCodes.Status200OK)]
9797
[ProducesResponseType(StatusCodes.Status404NotFound)]
98+
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
9899
[ProducesResponseType(StatusCodes.Status502BadGateway)]
99100
[ActionName(nameof(GetAeTitle))]
100101
public async Task<IActionResult> CEcho(string name)

0 commit comments

Comments
 (0)