-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from serverlessworkflow/feat-alpha-6
Implement ServerlessWorkflow `v1.0.0-alpha6`
- Loading branch information
Showing
17 changed files
with
392 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright © 2024-Present The Serverless Workflow Specification Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"), | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace ServerlessWorkflow.Sdk; | ||
|
||
/// <summary> | ||
/// Enumerates all supported container cleanup policies | ||
/// </summary> | ||
public static class ContainerCleanupPolicy | ||
{ | ||
|
||
/// <summary> | ||
/// Indicates that the runtime must delete the container immediately after execution | ||
/// </summary> | ||
public const string Always = "always"; | ||
/// <summary> | ||
/// Indicates that the runtime must eventually delete the container, after waiting for a specific amount of time. | ||
/// </summary> | ||
public const string Eventually = "eventually"; | ||
/// <summary> | ||
/// Indicates that the runtime must never delete the container. | ||
/// </summary> | ||
public const string Never = "never"; | ||
|
||
/// <summary> | ||
/// Gets a new <see cref="IEnumerable{T}"/> containing all supported values | ||
/// </summary> | ||
/// <returns>A new <see cref="IEnumerable{T}"/> containing all supported values</returns> | ||
public static IEnumerable<string> AsEnumerable() | ||
{ | ||
yield return Always; | ||
yield return Eventually; | ||
yield return Never; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/ServerlessWorkflow.Sdk/Models/AsyncApiMessageDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright © 2024-Present The Serverless Workflow Specification Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"), | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace ServerlessWorkflow.Sdk.Models; | ||
|
||
/// <summary> | ||
/// Represents the definition of an AsyncAPI message | ||
/// </summary> | ||
[DataContract] | ||
public record AsyncApiMessageDefinition | ||
{ | ||
|
||
/// <summary> | ||
/// Gets/sets the message's payload, if any | ||
/// </summary> | ||
[DataMember(Name = "payload", Order = 1), JsonPropertyName("payload"), JsonPropertyOrder(1), YamlMember(Alias = "payload", Order = 1)] | ||
public virtual object? Payload { get; set; } | ||
|
||
/// <summary> | ||
/// Gets/sets the message's headers, if any | ||
/// </summary> | ||
[DataMember(Name = "headers", Order = 2), JsonPropertyName("headers"), JsonPropertyOrder(2), YamlMember(Alias = "headers", Order = 2)] | ||
public virtual object? Headers { get; set; } | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/ServerlessWorkflow.Sdk/Models/AsyncApiSubscriptionDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright © 2024-Present The Serverless Workflow Specification Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"), | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace ServerlessWorkflow.Sdk.Models; | ||
|
||
/// <summary> | ||
/// Represents an object used to configure an AsyncAPI subscription | ||
/// </summary> | ||
[DataContract] | ||
public record AsyncApiSubscriptionDefinition | ||
{ | ||
|
||
/// <summary> | ||
/// Gets/sets a runtime expression, if any, used to filter consumed messages | ||
/// </summary> | ||
[DataMember(Name = "filter", Order = 1), JsonPropertyName("filter"), JsonPropertyOrder(1), YamlMember(Alias = "filter", Order = 1)] | ||
public virtual string? Filter { get; set; } | ||
|
||
/// <summary> | ||
/// Gets/sets an object used to configure the subscription's lifetime. | ||
/// </summary> | ||
[Required] | ||
[DataMember(Name = "consume", Order = 2), JsonPropertyName("consume"), JsonPropertyOrder(2), YamlMember(Alias = "consume", Order = 2)] | ||
public required virtual AsyncApiSubscriptionLifetimeDefinition Consume { get; set; } | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
src/ServerlessWorkflow.Sdk/Models/AsyncApiSubscriptionLifetimeDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright © 2024-Present The Serverless Workflow Specification Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"), | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace ServerlessWorkflow.Sdk.Models; | ||
|
||
/// <summary> | ||
/// Represents an object used to configure the lifetime of an AsyncAPI subscription | ||
/// </summary> | ||
[DataContract] | ||
public record AsyncApiSubscriptionLifetimeDefinition | ||
{ | ||
|
||
/// <summary> | ||
/// Gets/sets the duration that defines for how long to consume messages | ||
/// /// </summary> | ||
[DataMember(Name = "for", Order = 1), JsonPropertyName("for"), JsonPropertyOrder(1), YamlMember(Alias = "for", Order = 1)] | ||
public virtual Duration? For { get; set; } | ||
|
||
/// <summary> | ||
/// Gets/sets the amount of messages to consume.<para></para> | ||
/// Required if <see cref="While"/> and <see cref="Until"/> have not been set. | ||
/// /// </summary> | ||
[DataMember(Name = "amount", Order = 2), JsonPropertyName("amount"), JsonPropertyOrder(2), YamlMember(Alias = "amount", Order = 2)] | ||
public virtual int? Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Gets/sets a runtime expression, if any, used to determine whether or not to keep consuming messages.<para></para> | ||
/// Required if <see cref="Amount"/> and <see cref="Until"/> have not been set. | ||
/// /// </summary> | ||
[DataMember(Name = "while", Order = 3), JsonPropertyName("while"), JsonPropertyOrder(3), YamlMember(Alias = "while", Order = 3)] | ||
public virtual int? While { get; set; } | ||
|
||
/// <summary> | ||
/// Gets/sets a runtime expression, if any, used to determine until when to consume messages..<para></para> | ||
/// Required if <see cref="Amount"/> and <see cref="While"/> have not been set. | ||
/// /// </summary> | ||
[DataMember(Name = "until", Order = 4), JsonPropertyName("until"), JsonPropertyOrder(4), YamlMember(Alias = "until", Order = 4)] | ||
public virtual int? Until { get; set; } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/ServerlessWorkflow.Sdk/Models/Processes/ContainerLifetimeDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright © 2024-Present The Serverless Workflow Specification Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"), | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace ServerlessWorkflow.Sdk.Models.Processes; | ||
|
||
/// <summary> | ||
/// Represents an object used to configure the lifetime of a container | ||
/// </summary> | ||
[DataContract] | ||
public record ContainerLifetimeDefinition | ||
{ | ||
|
||
/// <summary> | ||
/// Gets/sets the cleanup policy to use.<para></para> | ||
/// See <see cref="ContainerCleanupPolicy"/><para></para> | ||
/// Defaults to <see cref="ContainerCleanupPolicy.Never"/> | ||
/// </summary> | ||
[Required, MinLength(1)] | ||
[DataMember(Name = "cleanup", Order = 1), JsonPropertyName("cleanup"), JsonPropertyOrder(1), YamlMember(Alias = "cleanup", Order = 1)] | ||
public required virtual string Cleanup { get; set; } | ||
|
||
/// <summary> | ||
/// Gets/sets the duration, if any, after which to delete the container once executed.<para></para> | ||
/// Required if <see cref="Cleanup"/> has been set to <see cref="ContainerCleanupPolicy.Eventually"/>, otherwise ignored. | ||
/// </summary> | ||
[DataMember(Name = "duration", Order = 2), JsonPropertyName("duration"), JsonPropertyOrder(2), YamlMember(Alias = "duration", Order = 2)] | ||
public virtual Duration? Duration { get; set; } | ||
} |
Oops, something went wrong.