Skip to content

Commit 5394b27

Browse files
authored
Merge pull request #773 from Project-MONAI/samrooke/AC-1574-update-wf-validation-to-check-data-origins
add validation for data origins
2 parents 62a3dc2 + 86d0f3a commit 5394b27

24 files changed

+715
-155
lines changed

src/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818

1919
[assembly: AssemblyFileVersion("0.0.0.0")]
2020
[assembly: AssemblyVersion("0.0.0.0")]
21-
[assembly: AssemblyInformationalVersion("0.0.0-development")]
21+
[assembly: AssemblyInformationalVersion("0.0.0-development")]

src/Monai.Deploy.WorkflowManager.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManage
8282
EndProject
8383
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManager.Common.Tests", "..\tests\UnitTests\Common.Tests\Monai.Deploy.WorkflowManager.Common.Tests.csproj", "{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}"
8484
EndProject
85+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monai.Deploy.WorkflowManager.Services", "WorkflowManager\Monai.Deploy.WorkflowManager.Services\Monai.Deploy.WorkflowManager.Services.csproj", "{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}"
86+
EndProject
87+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monai.Deploy.WorkflowManager.Services.Tests", "..\tests\UnitTests\WorkflowManager.Services.Tests\Monai.Deploy.WorkflowManager.Services.Tests.csproj", "{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}"
88+
EndProject
8589
Global
8690
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8791
Debug|Any CPU = Debug|Any CPU
@@ -228,6 +232,14 @@ Global
228232
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}.Debug|Any CPU.Build.0 = Debug|Any CPU
229233
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}.Release|Any CPU.ActiveCfg = Release|Any CPU
230234
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}.Release|Any CPU.Build.0 = Release|Any CPU
235+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
236+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Debug|Any CPU.Build.0 = Debug|Any CPU
237+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Release|Any CPU.ActiveCfg = Release|Any CPU
238+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Release|Any CPU.Build.0 = Release|Any CPU
239+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
240+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Debug|Any CPU.Build.0 = Debug|Any CPU
241+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Release|Any CPU.ActiveCfg = Release|Any CPU
242+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Release|Any CPU.Build.0 = Release|Any CPU
231243
EndGlobalSection
232244
GlobalSection(SolutionProperties) = preSolution
233245
HideSolutionNode = FALSE
@@ -269,6 +281,8 @@ Global
269281
{81E3F943-B992-4C81-AA09-A17C05081236} = {37A19144-CEA5-47A2-9FFD-22C522E8B895}
270282
{C853A9E3-C53D-4B1A-BFDA-228689A8C94C} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
271283
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
284+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467} = {AC5B198A-C3F2-4AD2-B532-E71B4630BDD5}
285+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
272286
EndGlobalSection
273287
GlobalSection(ExtensibilityGlobals) = postSolution
274288
SolutionGuid = {DC0D56C8-D8CB-45CE-B528-F3DCF86D63ED}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2022 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using Microsoft.Extensions.Configuration;
18+
19+
namespace Monai.Deploy.WorkflowManager.Configuration
20+
{
21+
public class InformaticsGatewayConfiguration
22+
{
23+
[ConfigurationKeyName("apiHost")]
24+
public string ApiHost { get; set; }
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2022 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
namespace Monai.Deploy.WorkflowManager.Services.InformaticsGateway
18+
{
19+
public interface IInformaticsGatewayService
20+
{
21+
/// <summary>
22+
/// Checks if a data origin exists with the informatics gateway.
23+
/// </summary>
24+
/// <param name="name">Name of the source.</param>
25+
/// <returns>bool based on success status on the informatics gateway request.</returns>
26+
Task<bool> OriginExists(string name);
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2022 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using System.Net;
18+
using Microsoft.Extensions.Options;
19+
using Monai.Deploy.WorkflowManager.Configuration;
20+
21+
namespace Monai.Deploy.WorkflowManager.Services.InformaticsGateway
22+
{
23+
public class InformaticsGatewayService : IInformaticsGatewayService
24+
{
25+
public InformaticsGatewayService(
26+
IHttpClientFactory httpClientFactory,
27+
IOptions<InformaticsGatewayConfiguration> options
28+
)
29+
{
30+
_httpClient = httpClientFactory?.CreateClient("Informatics-Gateway") ?? throw new ArgumentNullException(nameof(httpClientFactory));
31+
_options = options ?? throw new ArgumentNullException(nameof(options));
32+
33+
_httpClient.BaseAddress = new Uri(_options.Value.ApiHost);
34+
}
35+
36+
private readonly HttpClient _httpClient;
37+
38+
private readonly IOptions<InformaticsGatewayConfiguration> _options;
39+
40+
public async Task<bool> OriginExists(string name)
41+
{
42+
var response = await _httpClient.GetAsync($"/config/source/{name}");
43+
44+
return response.StatusCode == HttpStatusCode.OK;
45+
}
46+
}
47+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!--
2+
~ Copyright 2022 MONAI Consortium
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<Project Sdk="Microsoft.NET.Sdk">
18+
19+
<PropertyGroup>
20+
<TargetFramework>net6.0</TargetFramework>
21+
<ImplicitUsings>enable</ImplicitUsings>
22+
<Nullable>enable</Nullable>
23+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<AdditionalFiles Include="..\..\..\stylecop.json" Link="stylecop.json" />
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<AdditionalFiles Include="..\..\.sonarlint\project-monai_monai-deploy-workflow-manager\CSharp\SonarLint.xml" Link="SonarLint.xml" />
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<Compile Include="..\..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.0" />
40+
</ItemGroup>
41+
42+
<ItemGroup>
43+
<ProjectReference Include="..\..\Shared\Configuration\Monai.Deploy.WorkflowManager.Configuration.csproj" />
44+
</ItemGroup>
45+
46+
<PropertyGroup>
47+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
48+
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
49+
<CodeAnalysisRuleSet>..\..\.sonarlint\project-monai_monai-deploy-workflow-managercsharp.ruleset</CodeAnalysisRuleSet>
50+
</PropertyGroup>
51+
52+
</Project>

0 commit comments

Comments
 (0)