Skip to content

Commit

Permalink
Refactor continuation (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdavernas committed May 5, 2023
1 parent 4aaf1ce commit fa0da33
Show file tree
Hide file tree
Showing 66 changed files with 1,836 additions and 515 deletions.
122 changes: 105 additions & 17 deletions Synapse.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,47 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{3CC8DB0B-8
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Core", "src\core\Synapse.Core.csproj", "{905204D2-2CB7-4227-9007-68F0CD755DDC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "runner", "runner", "{02565E6F-64CD-4388-93C1-FC624200F7B3}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{5B177AF9-7412-4414-880B-CFC280C2A4DD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Runner", "src\runner\Synapse.Runner.csproj", "{BA2597E7-ECEB-473F-952C-50A506A22F35}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "runtime", "runtime", "{FCD7FB36-5E98-4FD2-96CB-33721DF8A523}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{5B177AF9-7412-4414-880B-CFC280C2A4DD}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{A657B5B7-2B69-4400-BBB4-1F531E9C0EBD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Api.Core.Http", "src\api\core\http\Synapse.Api.Core.Http.csproj", "{85682236-3190-4E8B-ADBE-0D7019D30667}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "http", "http", "{B68A6707-B874-4D5A-ABB2-C0E27A1AF2F5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "runtime", "runtime", "{F2F0601F-B12F-4496-99FB-C94A510046AE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "http", "http", "{0574FF6A-112B-4A7C-850D-2E9D67D83B71}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "process-management", "process-management", "{EF90C3E0-17C6-473D-81F5-E5BF196C3B3F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "native", "native", "{25686D56-58F5-464B-95BD-D286079A6061}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{358B9074-3DE1-4277-BA3C-9B2B2315F36D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "kubernetes", "kubernetes", "{365E3B11-940D-4BA3-B851-3B44CF577E32}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "abstractions", "abstractions", "{B9A8513C-8A9E-4A4E-AD3C-12C7CBA7F66F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Runtime.ProcessManagement.Abstractions", "src\runtime\process-management\abstractions\Synapse.Runtime.ProcessManagement.Abstractions.csproj", "{49831987-1D7E-4DE9-8562-E8E0F7CF9098}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Runtime.ProcessManagement.Native", "src\runtime\process-management\native\Synapse.Runtime.ProcessManagement.Native.csproj", "{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "agent", "agent", "{4459ACBC-B8B9-432F-B3A8-4C0A0E327E50}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Runtime.Agent", "src\runtime\agent\Synapse.Runtime.Agent.csproj", "{5E578F78-9063-4A81-9CDD-7085A53CA641}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{9B52498A-89C1-4396-931A-D11A6D7E7AC9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "management", "management", "{FF13A50C-586A-4F29-A0DD-1AE21581D813}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sdk", "sdk", "{499E479F-3757-4009-AF70-251AF6CB59EE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server", "server", "{6F1394AA-5DD2-44A1-A0FD-41D601E46CCB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Plugins.Management", "src\plugins\management\Synapse.Plugins.Management.csproj", "{E1236A03-9E94-4982-8FB5-6D19D695B565}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client", "client", "{1EE177F3-64AB-4B2C-99CD-E9B5D94A89A9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Plugins.Sdk", "src\plugins\sdk\Synapse.Plugins.Sdk.csproj", "{922A993B-C3AA-4222-9974-8C4A1972F357}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -65,14 +97,54 @@ Global
{905204D2-2CB7-4227-9007-68F0CD755DDC}.Release|Any CPU.Build.0 = Release|Any CPU
{905204D2-2CB7-4227-9007-68F0CD755DDC}.Release|x86.ActiveCfg = Release|Any CPU
{905204D2-2CB7-4227-9007-68F0CD755DDC}.Release|x86.Build.0 = Release|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Debug|x86.ActiveCfg = Debug|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Debug|x86.Build.0 = Debug|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Release|Any CPU.Build.0 = Release|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Release|x86.ActiveCfg = Release|Any CPU
{BA2597E7-ECEB-473F-952C-50A506A22F35}.Release|x86.Build.0 = Release|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Debug|x86.ActiveCfg = Debug|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Debug|x86.Build.0 = Debug|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Release|Any CPU.Build.0 = Release|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Release|x86.ActiveCfg = Release|Any CPU
{85682236-3190-4E8B-ADBE-0D7019D30667}.Release|x86.Build.0 = Release|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Debug|x86.ActiveCfg = Debug|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Debug|x86.Build.0 = Debug|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Release|Any CPU.Build.0 = Release|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Release|x86.ActiveCfg = Release|Any CPU
{49831987-1D7E-4DE9-8562-E8E0F7CF9098}.Release|x86.Build.0 = Release|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Debug|x86.ActiveCfg = Debug|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Debug|x86.Build.0 = Debug|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Release|Any CPU.Build.0 = Release|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Release|x86.ActiveCfg = Release|Any CPU
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7}.Release|x86.Build.0 = Release|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Debug|x86.ActiveCfg = Debug|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Debug|x86.Build.0 = Debug|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Release|Any CPU.Build.0 = Release|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Release|x86.ActiveCfg = Release|Any CPU
{5E578F78-9063-4A81-9CDD-7085A53CA641}.Release|x86.Build.0 = Release|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Debug|x86.ActiveCfg = Debug|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Debug|x86.Build.0 = Debug|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Release|Any CPU.Build.0 = Release|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Release|x86.ActiveCfg = Release|Any CPU
{E1236A03-9E94-4982-8FB5-6D19D695B565}.Release|x86.Build.0 = Release|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Debug|Any CPU.Build.0 = Debug|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Debug|x86.ActiveCfg = Debug|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Debug|x86.Build.0 = Debug|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Release|Any CPU.ActiveCfg = Release|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Release|Any CPU.Build.0 = Release|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Release|x86.ActiveCfg = Release|Any CPU
{922A993B-C3AA-4222-9974-8C4A1972F357}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -82,11 +154,27 @@ Global
{8BA50965-1742-4C74-8768-18B8E1F6707F} = {9DCC70EA-2F8F-4895-B9AA-110A98D50C47}
{3CC8DB0B-84BC-4DEE-BF37-525360FFF201} = {D789B1B2-073B-4609-948F-25C70148CDFB}
{905204D2-2CB7-4227-9007-68F0CD755DDC} = {3CC8DB0B-84BC-4DEE-BF37-525360FFF201}
{02565E6F-64CD-4388-93C1-FC624200F7B3} = {D789B1B2-073B-4609-948F-25C70148CDFB}
{BA2597E7-ECEB-473F-952C-50A506A22F35} = {02565E6F-64CD-4388-93C1-FC624200F7B3}
{5B177AF9-7412-4414-880B-CFC280C2A4DD} = {D789B1B2-073B-4609-948F-25C70148CDFB}
{6F1394AA-5DD2-44A1-A0FD-41D601E46CCB} = {5B177AF9-7412-4414-880B-CFC280C2A4DD}
{1EE177F3-64AB-4B2C-99CD-E9B5D94A89A9} = {5B177AF9-7412-4414-880B-CFC280C2A4DD}
{FCD7FB36-5E98-4FD2-96CB-33721DF8A523} = {D789B1B2-073B-4609-948F-25C70148CDFB}
{A657B5B7-2B69-4400-BBB4-1F531E9C0EBD} = {5B177AF9-7412-4414-880B-CFC280C2A4DD}
{85682236-3190-4E8B-ADBE-0D7019D30667} = {B68A6707-B874-4D5A-ABB2-C0E27A1AF2F5}
{B68A6707-B874-4D5A-ABB2-C0E27A1AF2F5} = {A657B5B7-2B69-4400-BBB4-1F531E9C0EBD}
{F2F0601F-B12F-4496-99FB-C94A510046AE} = {5B177AF9-7412-4414-880B-CFC280C2A4DD}
{0574FF6A-112B-4A7C-850D-2E9D67D83B71} = {F2F0601F-B12F-4496-99FB-C94A510046AE}
{EF90C3E0-17C6-473D-81F5-E5BF196C3B3F} = {FCD7FB36-5E98-4FD2-96CB-33721DF8A523}
{25686D56-58F5-464B-95BD-D286079A6061} = {EF90C3E0-17C6-473D-81F5-E5BF196C3B3F}
{358B9074-3DE1-4277-BA3C-9B2B2315F36D} = {EF90C3E0-17C6-473D-81F5-E5BF196C3B3F}
{365E3B11-940D-4BA3-B851-3B44CF577E32} = {EF90C3E0-17C6-473D-81F5-E5BF196C3B3F}
{B9A8513C-8A9E-4A4E-AD3C-12C7CBA7F66F} = {EF90C3E0-17C6-473D-81F5-E5BF196C3B3F}
{49831987-1D7E-4DE9-8562-E8E0F7CF9098} = {B9A8513C-8A9E-4A4E-AD3C-12C7CBA7F66F}
{1EACFFC2-E701-4BB7-8546-7F15A0A641C7} = {25686D56-58F5-464B-95BD-D286079A6061}
{4459ACBC-B8B9-432F-B3A8-4C0A0E327E50} = {FCD7FB36-5E98-4FD2-96CB-33721DF8A523}
{5E578F78-9063-4A81-9CDD-7085A53CA641} = {4459ACBC-B8B9-432F-B3A8-4C0A0E327E50}
{9B52498A-89C1-4396-931A-D11A6D7E7AC9} = {D789B1B2-073B-4609-948F-25C70148CDFB}
{FF13A50C-586A-4F29-A0DD-1AE21581D813} = {9B52498A-89C1-4396-931A-D11A6D7E7AC9}
{499E479F-3757-4009-AF70-251AF6CB59EE} = {9B52498A-89C1-4396-931A-D11A6D7E7AC9}
{E1236A03-9E94-4982-8FB5-6D19D695B565} = {FF13A50C-586A-4F29-A0DD-1AE21581D813}
{922A993B-C3AA-4222-9974-8C4A1972F357} = {499E479F-3757-4009-AF70-251AF6CB59EE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C1FCD70A-A848-4567-B59C-D7B076BC2F2E}
Expand Down
17 changes: 17 additions & 0 deletions src/api/core/http/Controllers/WorkflowAgentsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hylo.Api.Http;
using Synapse.Resources;

namespace Synapse.Api.Core.Http.Controllers;

/// <summary>
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowAgent"/>s
/// </summary>
[Route("api/core/v1/workflow-agents")]
public class WorkflowAgentsController
: ClusterResourceApiController<WorkflowAgent>
{

/// <inheritdoc/>
public WorkflowAgentsController(IMediator mediator) : base(mediator) { }

}
17 changes: 17 additions & 0 deletions src/api/core/http/Controllers/WorkflowDslExtensionsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hylo.Api.Http;
using Synapse.Resources;

namespace Synapse.Api.Core.Http.Controllers;

/// <summary>
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowDslExtension"/>s
/// </summary>
[Route("api/core/v1/workflow-dsl-extensions")]
public class WorkflowDslExtensionsController
: ClusterResourceApiController<WorkflowDslExtension>
{

/// <inheritdoc/>
public WorkflowDslExtensionsController(IMediator mediator) : base(mediator) { }

}
17 changes: 17 additions & 0 deletions src/api/core/http/Controllers/WorkflowDslsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hylo.Api.Http;
using Synapse.Resources;

namespace Synapse.Api.Core.Http.Controllers;

/// <summary>
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowDsl"/>s
/// </summary>
[Route("api/core/v1/workflow-dsls")]
public class WorkflowDslsController
: ClusterResourceApiController<WorkflowDsl>
{

/// <inheritdoc/>
public WorkflowDslsController(IMediator mediator) : base(mediator) { }

}
17 changes: 17 additions & 0 deletions src/api/core/http/Controllers/WorkflowInstancesController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hylo.Api.Http;
using Synapse.Resources;

namespace Synapse.Api.Core.Http.Controllers;

/// <summary>
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="WorkflowInstance"/>s
/// </summary>
[Route("api/core/v1/workflow-instances")]
public class WorkflowInstancesController
: ClusterResourceApiController<WorkflowInstance>
{

/// <inheritdoc/>
public WorkflowInstancesController(IMediator mediator) : base(mediator) { }

}
17 changes: 17 additions & 0 deletions src/api/core/http/Controllers/WorkflowsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hylo.Api.Http;
using Synapse.Resources;

namespace Synapse.Api.Core.Http.Controllers;

/// <summary>
/// Represents the <see cref="ResourceApiController{TResource}"/> used to manage <see cref="Workflow"/>s
/// </summary>
[Route("api/core/v1/workflows")]
public class WorkflowsController
: NamespacedResourceApiController<Workflow>
{

/// <inheritdoc/>
public WorkflowsController(IMediator mediator) : base(mediator) { }

}
12 changes: 12 additions & 0 deletions src/api/core/http/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"Synapse.Api.Core": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:49854;http://localhost:49855"
}
}
}
30 changes: 30 additions & 0 deletions src/api/core/http/Synapse.Api.Core.Http.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<VersionPrefix>0.1.0</VersionPrefix>
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
<FileVersion>$(VersionPrefix)</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright © 2023-Present The Synapse Authors. All rights reserved.</Copyright>
<PackageProjectUrl>https://github.com/serverlessworkflow/synapse</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/serverlessworkflow/synapse</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\core\Synapse.Core.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Hylo.Api.Http" Version="0.4.0" />
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions src/api/core/http/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global using Hylo;
global using Microsoft.AspNetCore.Mvc;
global using MediatR;
36 changes: 36 additions & 0 deletions src/core/Assets/Definitions/workflow-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: agents.synapse-wfms.io
spec:
scope: Namespaced
group: synapse-wfms.io
names:
kind: WorkflowAgent
singular: workflow-agent
plural: workflow-agents
shortNames:
- wfa
- agent
versions:
- name: v1
served: true
storage: true
subResources:
status: {}
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
supportedDsls:
type: array
uniqueItems: true
minItems: 1
items:
type: string
required: [ 'supportedDsls' ]
status:
type: object
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: workflow-processes.synapse-wfms.io
name: workflow-instances.synapse-wfms.io
spec:
scope: Namespaced
group: synapse-wfms.io
names:
kind: WorkflowProcess
singular: workflow-process
plural: workflow-processes
kind: WorkflowInstance
singular: workflow-instance
plural: workflow-instances
shortNames:
- wfp
- proc
- wfi
versions:
- name: v1
served: true
storage: true
subResources:
status: {}
schema:
openAPIV3Schema:
type: object
Expand Down
2 changes: 1 addition & 1 deletion src/core/EmbeddedResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ public static class Definitions

}

}
}
26 changes: 26 additions & 0 deletions src/core/Extensions/WorkflowAgentProcessRuleExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace Synapse;

/// <summary>
/// Defines extensions for <see cref="WorkflowAgentProcessRule"/>s
/// </summary>
public static class WorkflowAgentProcessRuleExtensions
{

/// <summary>
/// Determines whether or not the <see cref="WorkflowAgentProcessRule"/> applies to the specified <see cref="WorkflowInstance"/>
/// </summary>
/// <param name="rule">The <see cref="WorkflowAgentProcessRule"/> to check</param>
/// <param name="workflowVersion">The <see cref="WorkflowVersion"/> that defines the <see cref="WorkflowInstance"/> to check</param>
/// <param name="instance">The <see cref="WorkflowInstance"/> to check</param>
/// <returns>A boolean indicating whether or not the <see cref="WorkflowAgentProcessRule"/> applies to the specified <see cref="WorkflowInstance"/></returns>
public static bool AppliesTo(this WorkflowAgentProcessRule rule, WorkflowVersion workflowVersion, WorkflowInstance instance)
{
if (rule == null) throw new ArgumentNullException(nameof(rule));
if (workflowVersion == null) throw new ArgumentNullException(nameof(workflowVersion));
if (instance == null) throw new ArgumentNullException(nameof(instance));
if (!rule.SupportedLanguages.Contains(workflowVersion.Name)) return false;
if (rule.Selectors != null && rule.Selectors.Any()) return rule.Selectors.All(s => s.Selects(instance));
return true;
}

}
Loading

0 comments on commit fa0da33

Please sign in to comment.