diff --git a/samples/StreetLightsApi/Services/StreetLightsService.cs b/samples/StreetLightsApi/Services/StreetLightsService.cs index 3aa4069..230d4be 100644 --- a/samples/StreetLightsApi/Services/StreetLightsService.cs +++ b/samples/StreetLightsApi/Services/StreetLightsService.cs @@ -43,12 +43,12 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) await message.AcknowledgeAsync(stoppingToken); }); await this.MqttClient.SubscribeAsync("onLightMeasured", cancellationToken: stoppingToken).ConfigureAwait(false); - await this.PublishLightMeasured(new() { Id = Guid.NewGuid(), Lumens = 5, SentAt = DateTime.UtcNow }).ConfigureAwait(false); + await this.PublishLightMeasured(new() { Id = Guid.NewGuid(), Lumens = 5, SentAt = DateTime.UtcNow }, stoppingToken).ConfigureAwait(false); } [Tag("light", "A tag for light-related operations"), Tag("measurement", "A tag for measurement-related operations")] [Channel("light/measured"), PublishOperation(OperationId = "NotifyLightMeasured", Summary = "Notifies remote consumers about environmental lighting conditions for a particular streetlight")] - public async Task PublishLightMeasured(LightMeasuredEvent e) + public async Task PublishLightMeasured(LightMeasuredEvent e, CancellationToken cancellationToken = default) { var message = new MqttApplicationMessage() { @@ -56,7 +56,7 @@ public async Task PublishLightMeasured(LightMeasuredEvent e) ContentType = "application/json", PayloadSegment = Encoding.UTF8.GetBytes(this.Serializer.SerializeToText(e)) }; - await this.MqttClient.PublishAsync(message); + await this.MqttClient.PublishAsync(message, cancellationToken); } [Tag("light", "A tag for light-related operations"), Tag("measurement", "A tag for measurement-related operations")] diff --git a/src/Neuroglia.AsyncApi.AspNetCore.UI/Neuroglia.AsyncApi.AspNetCore.UI.csproj b/src/Neuroglia.AsyncApi.AspNetCore.UI/Neuroglia.AsyncApi.AspNetCore.UI.csproj index 3ac84d1..4f5694b 100644 --- a/src/Neuroglia.AsyncApi.AspNetCore.UI/Neuroglia.AsyncApi.AspNetCore.UI.csproj +++ b/src/Neuroglia.AsyncApi.AspNetCore.UI/Neuroglia.AsyncApi.AspNetCore.UI.csproj @@ -12,7 +12,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api asp ui - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.AspNetCore/Neuroglia.AsyncApi.AspNetCore.csproj b/src/Neuroglia.AsyncApi.AspNetCore/Neuroglia.AsyncApi.AspNetCore.csproj index 6eaee39..71cc3d1 100644 --- a/src/Neuroglia.AsyncApi.AspNetCore/Neuroglia.AsyncApi.AspNetCore.csproj +++ b/src/Neuroglia.AsyncApi.AspNetCore/Neuroglia.AsyncApi.AspNetCore.csproj @@ -12,7 +12,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api asp - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.CloudEvents/Neuroglia.AsyncApi.CloudEvents.csproj b/src/Neuroglia.AsyncApi.CloudEvents/Neuroglia.AsyncApi.CloudEvents.csproj index 475e327..6ae9adb 100644 --- a/src/Neuroglia.AsyncApi.CloudEvents/Neuroglia.AsyncApi.CloudEvents.csproj +++ b/src/Neuroglia.AsyncApi.CloudEvents/Neuroglia.AsyncApi.CloudEvents.csproj @@ -11,7 +11,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api cloud-event - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.Core/Attributes/ExcludeAttribute.cs b/src/Neuroglia.AsyncApi.Core/Attributes/ExcludeAttribute.cs new file mode 100644 index 0000000..68b9273 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/Attributes/ExcludeAttribute.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi; + +/// +/// Represents an used to exclude a parameter from the schema of an Async API message +/// +[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = false)] +public class ExcludeAttribute + : Attribute +{ + + + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/Attributes/OperationAttribute.cs b/src/Neuroglia.AsyncApi.Core/Attributes/OperationAttribute.cs index fd93489..844629f 100644 --- a/src/Neuroglia.AsyncApi.Core/Attributes/OperationAttribute.cs +++ b/src/Neuroglia.AsyncApi.Core/Attributes/OperationAttribute.cs @@ -18,22 +18,16 @@ namespace Neuroglia.AsyncApi; /// /// Represents an used to mark a method as an /// +/// +/// Initializes a new +/// +/// The 's type +/// The 's message type [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] -public abstract class OperationAttribute +public abstract class OperationAttribute(OperationType operationType, Type? messageType) : Attribute { - /// - /// Initializes a new - /// - /// The 's type - /// The 's message type - protected OperationAttribute(OperationType operationType, Type? messageType) - { - this.OperationType = operationType; - this.MessageType = messageType; - } - /// /// Initializes a new /// @@ -43,12 +37,12 @@ protected OperationAttribute(OperationType operationType) : this(operationType, /// /// Gets the 's type /// - public virtual OperationType OperationType { get; } + public virtual OperationType OperationType { get; } = operationType; /// /// Gets the 's message type /// - public virtual Type? MessageType { get; } + public virtual Type? MessageType { get; } = messageType; /// /// Gets/sets the 's operation id diff --git a/src/Neuroglia.AsyncApi.Core/Neuroglia.AsyncApi.Core.csproj b/src/Neuroglia.AsyncApi.Core/Neuroglia.AsyncApi.Core.csproj index f2aee11..07e44f1 100644 --- a/src/Neuroglia.AsyncApi.Core/Neuroglia.AsyncApi.Core.csproj +++ b/src/Neuroglia.AsyncApi.Core/Neuroglia.AsyncApi.Core.csproj @@ -12,7 +12,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api core - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.Core/v2/AsyncApiProtocol.cs b/src/Neuroglia.AsyncApi.Core/v2/AsyncApiProtocol.cs index ea08f9a..786ef2b 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/AsyncApiProtocol.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/AsyncApiProtocol.cs @@ -40,6 +40,10 @@ public static class AsyncApiProtocol /// public const string Kafka = "kafka"; /// + /// Gets the anypointmq Async API protocol + /// + public const string AnypointMQ = "anypointmq"; + /// /// Gets the amqp Async API protocol /// public const string Amqp = "amqp"; @@ -48,6 +52,10 @@ public static class AsyncApiProtocol /// public const string AmqpV1 = "amqp1"; /// + /// Gets the googlepubsub Async API protocol + /// + public const string GooglePubSub = "googlepubsub"; + /// /// Gets the mqtt Async API protocol /// public const string Mqtt = "mqtt"; @@ -60,6 +68,10 @@ public static class AsyncApiProtocol /// public const string Nats = "nats"; /// + /// Gets the pulsar Async API protocol + /// + public const string Pulsar = "pulsar"; + /// /// Gets the jms Async API protocol /// public const string Jms = "jms"; @@ -68,6 +80,10 @@ public static class AsyncApiProtocol /// public const string Sns = "sns"; /// + /// Gets the solace Async API protocol + /// + public const string Solace = "solace"; + /// /// Gets the sqs Async API protocol /// public const string Sqs = "sqs"; @@ -86,6 +102,6 @@ public static class AsyncApiProtocol /// /// Gets the ibmmq Async API protocol /// - public const string Ibmmq = "ibmmq"; + public const string IbmMQ = "ibmmq"; } \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1BindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1BindingDefinition.cs index 792d163..8009803 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1BindingDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1BindingDefinition.cs @@ -11,9 +11,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2; -using Neuroglia.AsyncApi.v2.Bindings; - namespace Neuroglia.AsyncApi.v2.Bindings.AmqpV1; /// diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1ServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1ServerBindingDefinition.cs index 03be516..40aa37f 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1ServerBindingDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AmqpV1/AmqpV1ServerBindingDefinition.cs @@ -11,8 +11,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2.Bindings; - namespace Neuroglia.AsyncApi.v2.Bindings.AmqpV1; /// diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQBindingDefinition.cs new file mode 100644 index 0000000..26b665a --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; + +/// +/// Represents the base record for all Anypoint MQ implementations of the interface +/// +[DataContract] +public abstract record AnypointMQBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.AnypointMQ; + } + } + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQChannelBindingDefinition.cs new file mode 100644 index 0000000..fe5d4f0 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQChannelBindingDefinition.cs @@ -0,0 +1,42 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; + +/// +/// Represents the object used to configure an Anypoint MQ channel binding +/// +[DataContract] +public record AnypointMQChannelBindingDefinition + : AnypointMQBindingDefinition, IChannelBindingDefinition +{ + + /// + /// Gets/sets the destination (queue or exchange) name for this channel. SHOULD only be specified if the channel name differs from the actual destination name, such as when the channel name is not a valid destination name in Anypoint MQ. + /// + [DataMember(Order = 1, Name = "destination"), JsonPropertyOrder(1), JsonPropertyName("destination"), YamlMember(Order = 1, Alias = "destination")] + public virtual string? Destination { get; set; } + + /// + /// Gets/sets the type of destination, which MUST be either exchange or queue or fifo-queue. SHOULD be specified to document the messaging model (publish/subscribe, point-to-point, strict message ordering) supported by this channel. + /// + [DataMember(Order = 2, Name = "destinationType"), JsonPropertyOrder(2), JsonPropertyName("destinationType"), YamlMember(Order = 2, Alias = "destinationType")] + public virtual AnypointMQDestinationType DestinationType { get; set; } = AnypointMQDestinationType.Queue; + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 3, Name = "bindingVersion"), JsonPropertyOrder(3), JsonPropertyName("bindingVersion"), YamlMember(Order = 3, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQMessageBindingDefinition.cs new file mode 100644 index 0000000..fd84069 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQMessageBindingDefinition.cs @@ -0,0 +1,38 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Json.Schema; + +namespace Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; + +/// +/// Represents the object used to configure an Anypoint MQ message binding +/// +[DataContract] +public record AnypointMQMessageBindingDefinition + : AnypointMQBindingDefinition, IMessageBindingDefinition +{ + + /// + /// Gets/sets a schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). This schema MUST be of type object and have a properties key. Examples of Anypoint MQ protocol headers are messageId and messageGroupId + /// + [DataMember(Order = 1, Name = "headers"), JsonPropertyOrder(1), JsonPropertyName("headers"), YamlMember(Order = 1, Alias = "headers")] + public virtual JsonSchema? Headers { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 2, Name = "bindingVersion"), JsonPropertyOrder(2), JsonPropertyName("bindingVersion"), YamlMember(Order = 2, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQOperationBindingDefinition.cs new file mode 100644 index 0000000..b86d58a --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQOperationBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; + +/// +/// Represents the object used to configure an Anypoint MQ operation binding +/// +[DataContract] +public record AnypointMQOperationBindingDefinition + : AnypointMQBindingDefinition, IOperationBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQServerBindingDefinition.cs new file mode 100644 index 0000000..1058f2e --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/AnypointMQServerBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; + +/// +/// Represents the object used to configure an Anypoint MQ server binding +/// +[DataContract] +public record AnypointMQServerBindingDefinition + : AnypointMQBindingDefinition, IServerBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/JmsDestinationType.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/JmsDestinationType.cs new file mode 100644 index 0000000..321e719 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/AnypointMQ/JmsDestinationType.cs @@ -0,0 +1,41 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; + +/// +/// Enumerates all supported types of Anypoint MQ destinations +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum AnypointMQDestinationType +{ + /// + /// Indicates a point to point destination + /// + [EnumMember(Value = "queue")] + Queue = 0, + /// + /// Indicates a destination with strict message ordering + /// + [EnumMember(Value = "fifo-queue")] + FifoQueue = 1, + /// + /// Indicates publish/subscribe destination + /// + [EnumMember(Value = "exchange")] + Exchange = 2 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/BindingDefinitionCollection.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/BindingDefinitionCollection.cs index 55440fc..759028f 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/BindingDefinitionCollection.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/BindingDefinitionCollection.cs @@ -12,7 +12,6 @@ // limitations under the License. using System.Reflection; -using Neuroglia.AsyncApi.v2; namespace Neuroglia.AsyncApi.v2.Bindings; @@ -26,8 +25,8 @@ public abstract record BindingDefinitionCollection where TBinding : IBindingDefinition { - private List _bindingProperties = null!; - private List BindingProperties + List _bindingProperties = null!; + List BindingProperties { get { diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/ChannelBindingDefinitionCollection.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/ChannelBindingDefinitionCollection.cs index 88c46d9..b21c586 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/ChannelBindingDefinitionCollection.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/ChannelBindingDefinitionCollection.cs @@ -11,15 +11,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2; using Neuroglia.AsyncApi.v2.Bindings.Amqp; using Neuroglia.AsyncApi.v2.Bindings.AmqpV1; +using Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; +using Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; using Neuroglia.AsyncApi.v2.Bindings.Http; +using Neuroglia.AsyncApi.v2.Bindings.IbmMQ; +using Neuroglia.AsyncApi.v2.Bindings.Jms; using Neuroglia.AsyncApi.v2.Bindings.Kafka; +using Neuroglia.AsyncApi.v2.Bindings.Mercure; using Neuroglia.AsyncApi.v2.Bindings.Mqtt; using Neuroglia.AsyncApi.v2.Bindings.MqttV5; using Neuroglia.AsyncApi.v2.Bindings.Nats; +using Neuroglia.AsyncApi.v2.Bindings.Pulsar; using Neuroglia.AsyncApi.v2.Bindings.Redis; +using Neuroglia.AsyncApi.v2.Bindings.Sns; +using Neuroglia.AsyncApi.v2.Bindings.Solace; +using Neuroglia.AsyncApi.v2.Bindings.Sqs; +using Neuroglia.AsyncApi.v2.Bindings.Stomp; using Neuroglia.AsyncApi.v2.Bindings.WebSockets; namespace Neuroglia.AsyncApi.v2.Bindings; @@ -50,54 +59,124 @@ public record ChannelBindingDefinitionCollection [DataMember(Order = 3, Name = "kafka"), JsonPropertyOrder(3), JsonPropertyName("kafka"), YamlMember(Order = 3, Alias = "kafka")] public virtual KafkaChannelBindingDefinition? Kafka { get; set; } + /// + /// Gets/sets the protocol-specific information for a Anypoint MQ channel. + /// + [DataMember(Order = 4, Name = "anypointmq"), JsonPropertyOrder(4), JsonPropertyName("anypointmq"), YamlMember(Order = 4, Alias = "anypointmq")] + public virtual AnypointMQChannelBindingDefinition? AnypointMQ { get; set; } + /// /// Gets/sets the protocol-specific information for an AMQP 0-9-1 channel. /// - [DataMember(Order = 4, Name = "amqp"), JsonPropertyOrder(4), JsonPropertyName("amqp"), YamlMember(Order = 4, Alias = "amqp")] + [DataMember(Order = 5, Name = "amqp"), JsonPropertyOrder(5), JsonPropertyName("amqp"), YamlMember(Order = 5, Alias = "amqp")] public virtual AmqpChannelBindingDefinition? Amqp { get; set; } /// /// Gets/sets the protocol-specific information for an information for an AMQP 1.0 channel. /// - [DataMember(Order = 5, Name = "amqp1"), JsonPropertyOrder(5), JsonPropertyName("amqp1"), YamlMember(Order = 5, Alias = "amqp1")] + [DataMember(Order = 6, Name = "amqp1"), JsonPropertyOrder(6), JsonPropertyName("amqp1"), YamlMember(Order = 6, Alias = "amqp1")] public virtual AmqpV1ChannelBindingDefinition? Amqp1 { get; set; } /// /// Gets/sets the protocol-specific information for an information for an MQTT channel. /// - [DataMember(Order = 6, Name = "mqtt"), JsonPropertyOrder(6), JsonPropertyName("mqtt"), YamlMember(Order = 6, Alias = "mqtt")] + [DataMember(Order = 7, Name = "mqtt"), JsonPropertyOrder(7), JsonPropertyName("mqtt"), YamlMember(Order = 7, Alias = "mqtt")] public virtual MqttChannelBindingDefinition? Mqtt { get; set; } /// /// Gets/sets the protocol-specific information for an information for an MQTT 5 channel. /// - [DataMember(Order = 7, Name = "mqtt5"), JsonPropertyOrder(7), JsonPropertyName("mqtt5"), YamlMember(Order = 7, Alias = "mqtt5")] + [DataMember(Order = 8, Name = "mqtt5"), JsonPropertyOrder(8), JsonPropertyName("mqtt5"), YamlMember(Order = 8, Alias = "mqtt5")] public virtual MqttV5ChannelBindingDefinition? Mqtt5 { get; set; } /// /// Gets/sets the protocol-specific information for an information for a NATS channel. /// - [DataMember(Order = 8, Name = "nats"), JsonPropertyOrder(8), JsonPropertyName("nats"), YamlMember(Order = 8, Alias = "nats")] + [DataMember(Order = 9, Name = "nats"), JsonPropertyOrder(9), JsonPropertyName("nats"), YamlMember(Order = 9, Alias = "nats")] public virtual NatsChannelBindingDefinition? Nats { get; set; } + /// + /// Gets/sets the protocol-specific information for an information for a JMS channel. + /// + [DataMember(Order = 10, Name = "jms"), JsonPropertyOrder(10), JsonPropertyName("jms"), YamlMember(Order = 10, Alias = "jms")] + public virtual JmsChannelBindingDefinition? Jms { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SNS channel. + /// + [DataMember(Order = 11, Name = "sns"), JsonPropertyOrder(11), JsonPropertyName("sns"), YamlMember(Order = 11, Alias = "sns")] + public virtual SnsChannelBindingDefinition? Sns { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Solace channel. + /// + [DataMember(Order = 12, Name = "solace"), JsonPropertyOrder(12), JsonPropertyName("solace"), YamlMember(Order = 12, Alias = "solace")] + public virtual SolaceChannelBindingDefinition? Solace { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SQS channel. + /// + [DataMember(Order = 13, Name = "sqs"), JsonPropertyOrder(13), JsonPropertyName("sqs"), YamlMember(Order = 13, Alias = "sqs")] + public virtual SqsChannelBindingDefinition? Sqs { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a STOMP channel. + /// + [DataMember(Order = 14, Name = "stomp"), JsonPropertyOrder(14), JsonPropertyName("stomp"), YamlMember(Order = 14, Alias = "stomp")] + public virtual StompChannelBindingDefinition? Stomp { get; set; } + /// /// Gets/sets the protocol-specific information for an information for a Redis channel. /// - [DataMember(Order = 9, Name = "redis"), JsonPropertyOrder(9), JsonPropertyName("redis"), YamlMember(Order = 9, Alias = "redis")] + [DataMember(Order = 15, Name = "redis"), JsonPropertyOrder(15), JsonPropertyName("redis"), YamlMember(Order = 15, Alias = "redis")] public virtual RedisChannelBindingDefinition? Redis { get; set; } + /// + /// Gets/sets the protocol-specific information for an information for a Redis channel. + /// + [DataMember(Order = 16, Name = "mercure"), JsonPropertyOrder(16), JsonPropertyName("mercure"), YamlMember(Order = 16, Alias = "mercure")] + public virtual MercureChannelBindingDefinition? Mercure { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for an IBM MQ channel. + /// + [DataMember(Order = 17, Name = "ibmmq"), JsonPropertyOrder(17), JsonPropertyName("ibmmq"), YamlMember(Order = 17, Alias = "ibmmq")] + public virtual IbmMQChannelBindingDefinition? IbmMQ { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub channel. + /// + [DataMember(Order = 18, Name = "googlepubsub"), JsonPropertyOrder(18), JsonPropertyName("googlepubsub"), YamlMember(Order = 18, Alias = "googlepubsub")] + public virtual GooglePubSubChannelBindingDefinition? GooglePubSub { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub channel. + /// + [DataMember(Order = 19, Name = "pulsar"), JsonPropertyOrder(19), JsonPropertyName("pulsar"), YamlMember(Order = 19, Alias = "pulsar")] + public virtual PulsarChannelBindingDefinition? Pulsar { get; set; } + /// public override IEnumerable AsEnumerable() { - if (Http != null) yield return Http; - if (Ws != null) yield return Ws; - if (Kafka != null) yield return Kafka; - if (Amqp != null) yield return Amqp; - if (Amqp1 != null) yield return Amqp1; - if (Mqtt != null) yield return Mqtt; - if (Mqtt5 != null) yield return Mqtt5; - if (Nats != null) yield return Nats; - if (Redis != null) yield return Redis; + if (this.Http != null) yield return this.Http; + if (this.Ws != null) yield return this.Ws; + if (this.Kafka != null) yield return this.Kafka; + if (this.AnypointMQ != null) yield return this.AnypointMQ; + if (this.Amqp != null) yield return this.Amqp; + if (this.Amqp1 != null) yield return this.Amqp1; + if (this.Mqtt != null) yield return this.Mqtt; + if (this.Mqtt5 != null) yield return this.Mqtt5; + if (this.Nats != null) yield return this.Nats; + if (this.Jms != null) yield return this.Jms; + if (this.Sns != null) yield return this.Sns; + if (this.Solace != null) yield return this.Solace; + if (this.Sqs != null) yield return this.Sqs; + if (this.Stomp != null) yield return this.Stomp; + if (this.Redis != null) yield return this.Redis; + if (this.Mercure != null) yield return this.Mercure; + if (this.IbmMQ != null) yield return this.IbmMQ; + if (this.GooglePubSub != null) yield return this.GooglePubSub; + if (this.Pulsar != null) yield return this.Pulsar; } } diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubBindingDefinition.cs new file mode 100644 index 0000000..0ac3cee --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents the base record for all Google Pub/Sub implementations of the interface +/// +[DataContract] +public abstract record GooglePubSubBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.GooglePubSub; + } + } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubChannelBindingDefinition.cs new file mode 100644 index 0000000..7c0c5ab --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubChannelBindingDefinition.cs @@ -0,0 +1,54 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents the object used to configure a Google Pub/Sub channel binding +/// +[DataContract] +public record GooglePubSubChannelBindingDefinition + : GooglePubSubBindingDefinition, IChannelBindingDefinition +{ + + /// + /// Gets/sets the binding's version + /// + [DataMember(Order = 1, Name = "bindingVersion"), JsonPropertyOrder(1), JsonPropertyName("bindingVersion"), YamlMember(Order = 1, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + + /// + /// Gets/sets a list of labels used to categorize Cloud Resources like Cloud Pub/Sub Topics + /// + [DataMember(Order = 2, Name = "labels"), JsonPropertyOrder(2), JsonPropertyName("labels"), YamlMember(Order = 2, Alias = "labels")] + public virtual EquatableDictionary? Labels { get; set; } + + /// + /// Gets/sets the minimum duration to retain a message after it is published to the topic (Must be a valid Duration.) + /// + [DataMember(Order = 3, Name = "messageRetentionDuration"), JsonPropertyOrder(3), JsonPropertyName("messageRetentionDuration"), YamlMember(Order = 3, Alias = "messageRetentionDuration")] + public virtual string? MessageRetentionDuration { get; set; } + + /// + /// Gets/sets the policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored + /// + [DataMember(Order = 4, Name = "messageStoragePolicy"), JsonPropertyOrder(4), JsonPropertyName("messageStoragePolicy"), YamlMember(Order = 4, Alias = "messageStoragePolicy")] + public virtual GooglePubSubMessageStoragePolicyDefinition? MessageStoragePolicy { get; set; } + + /// + /// Gets/sets the settings for validating messages published against a schema + /// + [DataMember(Order = 5, Name = "schemaSettings"), JsonPropertyOrder(5), JsonPropertyName("schemaSettings"), YamlMember(Order = 5, Alias = "schemaSettings")] + public virtual GooglePubSubSchemaSettings? SchemaSettings { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageBindingDefinition.cs new file mode 100644 index 0000000..8aa6273 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageBindingDefinition.cs @@ -0,0 +1,48 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents the object used to configure a Google Pub/Sub message binding +/// +[DataContract] +public record GooglePubSubMessageBindingDefinition + : GooglePubSubBindingDefinition, IMessageBindingDefinition +{ + + /// + /// Gets/sets the binding's version + /// + [DataMember(Order = 1, Name = "bindingVersion"), JsonPropertyOrder(1), JsonPropertyName("bindingVersion"), YamlMember(Order = 1, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + + /// + /// Gets/sets the attributes for this message (If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.) + /// + [DataMember(Order = 2, Name = "attributes"), JsonPropertyOrder(2), JsonPropertyName("attributes"), YamlMember(Order = 2, Alias = "attributes")] + public virtual EquatableDictionary? Attributes { get; set; } + + /// + /// Gets/sets a value that identifies related messages for which publish order should be respected (For more information, see ordering messages.) + /// + [DataMember(Order = 3, Name = "orderingKey"), JsonPropertyOrder(3), JsonPropertyName("orderingKey"), YamlMember(Order = 3, Alias = "orderingKey")] + public virtual string? OrderingKey { get; set; } + + /// + /// Gets/sets the schema used to validate the payload of this message + /// + [DataMember(Order = 4, Name = "schema"), JsonPropertyOrder(4), JsonPropertyName("schema"), YamlMember(Order = 4, Alias = "schema")] + public virtual GooglePubSubSchemaDefinition? Schema { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageEncoding.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageEncoding.cs new file mode 100644 index 0000000..8cae76d --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageEncoding.cs @@ -0,0 +1,41 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Enumerates all supported Google Pub/Sub message encodings +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum GooglePubSubMessageEncoding +{ + /// + /// Indicates an unspecified encoding + /// + [EnumMember(Value = "ENCODING_UNSPECIFIED")] + Unspecified = 0, + /// + /// Indicates a JSON encoding + /// + [EnumMember(Value = "JSON")] + Json = 1, + /// + /// Indicates a binary encoding + /// + [EnumMember(Value = "BINARY")] + Binary = 2 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageStoragePolicyDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageStoragePolicyDefinition.cs new file mode 100644 index 0000000..0aabdd9 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubMessageStoragePolicyDefinition.cs @@ -0,0 +1,29 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents an object used to configure the policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored +/// +[DataContract] +public record GooglePubSubMessageStoragePolicyDefinition +{ + + /// + /// Gets/sets a list of IDs of GCP regions where messages that are published to the topic may be persisted in storage + /// + [DataMember(Order = 1, Name = "allowedPersistenceRegions"), JsonPropertyOrder(1), JsonPropertyName("allowedPersistenceRegions"), YamlMember(Order = 1, Alias = "allowedPersistenceRegions")] + public virtual EquatableList? AllowedPersistenceRegions { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubOperationBindingDefinition.cs new file mode 100644 index 0000000..057ce18 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubOperationBindingDefinition.cs @@ -0,0 +1,44 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Json.Schema; + +namespace Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents the object used to configure a Google Pub/Sub operation binding +/// +[DataContract] +public record GooglePubSubOperationBindingDefinition + : GooglePubSubBindingDefinition, IOperationBindingDefinition +{ + + /// + /// Gets/sets the of the consumer group. + /// + [DataMember(Order = 1, Name = "groupId"), JsonPropertyOrder(1), JsonPropertyName("groupId"), YamlMember(Order = 1, Alias = "groupId")] + public virtual JsonSchema? GroupId { get; set; } + + /// + /// Gets/sets the of the consumer inside a consumer group. + /// + [DataMember(Order = 2, Name = "clientId"), JsonPropertyOrder(2), JsonPropertyName("clientId"), YamlMember(Order = 2, Alias = "clientId")] + public virtual JsonSchema? ClientId { get; set; } + + /// + /// Gets/sets the version of this binding. Defaults to 'latest'. + /// + [DataMember(Order = 3, Name = "bindingVersion"), JsonPropertyOrder(3), JsonPropertyName("groubindingVersionpId"), YamlMember(Order = 3, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubSchemaDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubSchemaDefinition.cs new file mode 100644 index 0000000..5fb2826 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubSchemaDefinition.cs @@ -0,0 +1,30 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents the object used to configure a Google Pub/Sub schema +/// +[DataContract] +public record GooglePubSubSchemaDefinition +{ + + /// + /// Gets/sets the name of the schema + /// + [Required] + [DataMember(Order = 1, Name = "name"), JsonPropertyOrder(1), JsonPropertyName("name"), YamlMember(Order = 1, Alias = "name")] + public virtual string Name { get; set; } = null!; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubSchemaSettings.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubSchemaSettings.cs new file mode 100644 index 0000000..2b1d80f --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubSchemaSettings.cs @@ -0,0 +1,47 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents the settings for validating messages published against a schema +/// +[DataContract] +public record GooglePubSubSchemaSettings +{ + + /// + /// Gets/sets the encoding of the message + /// + [DataMember(Order = 1, Name = "encoding"), JsonPropertyOrder(1), JsonPropertyName("encoding"), YamlMember(Order = 1, Alias = "encoding")] + public virtual GooglePubSubMessageEncoding Encoding { get; set; } + + /// + /// Gets/sets the minimum (inclusive) revision allowed for validating messages + /// + [DataMember(Order = 2, Name = "firstRevisionId"), JsonPropertyOrder(2), JsonPropertyName("firstRevisionId"), YamlMember(Order = 2, Alias = "firstRevisionId")] + public virtual string? FirstRevisionId { get; set; } + + /// + /// Gets/sets the maximum (inclusive) revision allowed for validating messages + /// + [DataMember(Order = 3, Name = "lastRevisionId"), JsonPropertyOrder(3), JsonPropertyName("lastRevisionId"), YamlMember(Order = 3, Alias = "lastRevisionId")] + public virtual string? LastRevisionId { get; set; } + + /// + /// Gets/sets the name of the schema that messages published should be validated against (The format is projects/{project}/schemas/{schema}.) + /// + [DataMember(Order = 4, Name = "name"), JsonPropertyOrder(4), JsonPropertyName("name"), YamlMember(Order = 4, Alias = "name")] + public virtual string? Name { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubServerBindingDefinition.cs new file mode 100644 index 0000000..98568c7 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/GooglePubSub/GooglePubSubServerBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; + +/// +/// Represents the object used to configure a Google PubSub server binding +/// +[DataContract] +public record GooglePubSubServerBindingDefinition + : GooglePubSubBindingDefinition, IServerBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQBindingDefinition.cs new file mode 100644 index 0000000..238afac --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Represents the base record for all IBMMQ implementations of the interface +/// +[DataContract] +public abstract record IbmMQBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.IbmMQ; + } + } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQChannelBindingDefinition.cs new file mode 100644 index 0000000..1c788c9 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQChannelBindingDefinition.cs @@ -0,0 +1,56 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.AsyncApi.v2.Bindings.Solace; + +namespace Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Represents the object used to configure an IBMMQ channel binding +/// +[DataContract] +public record IbmMQChannelBindingDefinition + : IbmMQBindingDefinition, IChannelBindingDefinition +{ + + /// + /// Gets/sets a logical group of IBM MQ server objects. This is necessary to specify multi-endpoint configurations used in high availability deployments. If omitted, the server object is not part of a group. + /// + [DataMember(Order = 1, Name = "destinationType"), JsonPropertyOrder(1), JsonPropertyName("destinationType"), YamlMember(Order = 1, Alias = "destinationType")] + public virtual IbmMQDestinationType DestinationType { get; set; } + + /// + /// Gets/sets an object used to configure the channel's queue, if destination type has been set to 'queue'. + /// + [DataMember(Order = 2, Name = "queue"), JsonPropertyOrder(2), JsonPropertyName("queue"), YamlMember(Order = 2, Alias = "queue")] + public virtual IbmMQQueueDefinition? Queue { get; set; } + + /// + /// Gets/sets an object used to configure the channel's topic, if destination type has been set to 'topic'. + /// + [DataMember(Order = 3, Name = "topic"), JsonPropertyOrder(3), JsonPropertyName("topic"), YamlMember(Order = 3, Alias = "topic")] + public virtual IbmMQTopicDefinition? Topic { get; set; } + + /// + /// Gets/sets the maximum length of the physical message (in bytes) accepted by the Topic or Queue. Messages produced that are greater in size than this value may fail to be delivered. More information on the maximum message length can be found on this page in the IBM MQ Knowledge Center. + /// + [DataMember(Order = 4, Name = "maxMsgLength"), JsonPropertyOrder(4), JsonPropertyName("maxMsgLength"), YamlMember(Order = 4, Alias = "maxMsgLength")] + public virtual int? MaxMsgLength { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 5, Name = "bindingVersion"), JsonPropertyOrder(5), JsonPropertyName("bindingVersion"), YamlMember(Order = 5, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQDestinationType.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQDestinationType.cs new file mode 100644 index 0000000..afd5fd0 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQDestinationType.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Enumerates all IBMMQ destination types +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum IbmMQDestinationType +{ + /// + /// Indicates a queue + /// + [EnumMember(Value = "queue")] + Queue = 0, + /// + /// Indicates a topic + /// + [EnumMember(Value = "topic")] + Topic = 1 +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQMessageBindingDefinition.cs new file mode 100644 index 0000000..3b091e5 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQMessageBindingDefinition.cs @@ -0,0 +1,54 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Represents the object used to configure an IBMMQ message binding +/// +[DataContract] +public record IbmMQMessageBindingDefinition + : IbmMQBindingDefinition, IMessageBindingDefinition +{ + + /// + /// Gets/sets the type of the message. + /// + [DataMember(Order = 1, Name = "type"), JsonPropertyOrder(1), JsonPropertyName("type"), YamlMember(Order = 1, Alias = "type")] + public virtual IbmMQMessageType Type { get; set; } + + /// + /// Gets/sets a string that defines the IBM MQ message headers to include with this message. More than one header can be specified as a comma separated list. Supporting information on IBM MQ message formats can be found on this page in the IBM MQ Knowledge Center. + /// + [DataMember(Order = 2, Name = "headers"), JsonPropertyOrder(2), JsonPropertyName("headers"), YamlMember(Order = 2, Alias = "headers")] + public virtual string? Headers { get; set; } + + /// + /// Gets/sets additional information for application developers: describes the message type or format. + /// + [DataMember(Order = 3, Name = "description"), JsonPropertyOrder(3), JsonPropertyName("description"), YamlMember(Order = 3, Alias = "description")] + public virtual string? Description { get; set; } + + /// + /// Gets/sets the recommended setting the client should use for the TTL (Time-To-Live) of the message. This is a period of time expressed in milliseconds and set by the application that puts the message. expiry values are API dependant e.g., MQI and JMS use different units of time and default values for unlimited. General information on IBM MQ message expiry can be found on this page in the IBM MQ Knowledge Center. + /// + [DataMember(Order = 4, Name = "expiry"), JsonPropertyOrder(4), JsonPropertyName("expiry"), YamlMember(Order = 4, Alias = "expiry")] + public virtual int? Expiry { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 5, Name = "bindingVersion"), JsonPropertyOrder(5), JsonPropertyName("bindingVersion"), YamlMember(Order = 5, Alias = "bindingVersion")] + public virtual string? BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQMessageType.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQMessageType.cs new file mode 100644 index 0000000..448e536 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQMessageType.cs @@ -0,0 +1,41 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Enumerates all IBM MQ message types +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum IbmMQMessageType +{ + /// + /// Indicates a string message + /// + [EnumMember(Value = "string")] + String = 0, + /// + /// Indicates a JMS message + /// + [EnumMember(Value = "jms")] + JMS = 1, + /// + /// Indicates a binary message + /// + [EnumMember(Value = "binary")] + Binary = 2 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQOperationBindingDefinition.cs new file mode 100644 index 0000000..02c58bb --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQOperationBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Represents the object used to configure an IBMMQ operation binding +/// +[DataContract] +public record IbmMQOperationBindingDefinition + : IbmMQBindingDefinition, IOperationBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQQueueDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQQueueDefinition.cs new file mode 100644 index 0000000..817a730 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQQueueDefinition.cs @@ -0,0 +1,42 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Represents the object used to configure an IBMMQ queue +/// +[DataContract] +public record IbmMQQueueDefinition +{ + + /// + /// Gets/sets the name of the IBM MQ queue associated with the channel. + /// + [Required, MaxLength(48)] + [DataMember(Order = 1, Name = "objectName"), JsonPropertyOrder(1), JsonPropertyName("objectName"), YamlMember(Order = 1, Alias = "objectName")] + public virtual string ObjectName { get; set; } = null!; + + /// + /// Gets/sets a boolean indicating whether or not the queue is a cluster queue and therefore partitioned. If true, a binding option MAY be specified when accessing the queue. More information on binding options can be found on this page in the IBM MQ Knowledge Center. + /// + [DataMember(Order = 2, Name = "isPartitioned"), JsonPropertyOrder(2), JsonPropertyName("isPartitioned"), YamlMember(Order = 2, Alias = "isPartitioned")] + public virtual bool IsPartitioned { get; set; } + + /// + /// Gets/sets a boolean indicating whether or not it is recommended to open the queue exclusively. + /// + [DataMember(Order = 3, Name = "exclusive"), JsonPropertyOrder(3), JsonPropertyName("exclusive"), YamlMember(Order = 3, Alias = "exclusive")] + public virtual bool Exclusive { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQServerBindingDefinition.cs new file mode 100644 index 0000000..9b30896 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQServerBindingDefinition.cs @@ -0,0 +1,63 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Represents the object used to configure an IBMMQ server binding +/// +[DataContract] +public record IbmMQServerBindingDefinition + : IbmMQBindingDefinition, IServerBindingDefinition +{ + + /// + /// Gets/sets a logical group of IBM MQ server objects. This is necessary to specify multi-endpoint configurations used in high availability deployments. If omitted, the server object is not part of a group. + /// + [DataMember(Order = 1, Name = "groupId"), JsonPropertyOrder(1), JsonPropertyName("groupId"), YamlMember(Order = 1, Alias = "groupId")] + public virtual string? GroupId { get; set; } + + /// + /// Gets/sets the name of the IBM MQ queue manager to bind to in the CCDT file. + /// + [DataMember(Order = 2, Name = "ccdtQueueManagerName"), JsonPropertyOrder(2), JsonPropertyName("ccdtQueueManagerName"), YamlMember(Order = 2, Alias = "ccdtQueueManagerName")] + public virtual string? CcdtQueueManagerName { get; set; } + + /// + /// Gets/sets the recommended cipher specification used to establish a TLS connection between the client and the IBM MQ queue manager. More information on SSL/TLS cipher specifications supported by IBM MQ can be found on this page in the IBM MQ Knowledge Center. + /// + [DataMember(Order = 3, Name = "cipherSpec"), JsonPropertyOrder(3), JsonPropertyName("cipherSpec"), YamlMember(Order = 3, Alias = "cipherSpec")] + public virtual string? CipherSpec { get; set; } + + /// + /// Gets/sets a boolean indicating whether or not multiple connections can be workload balanced. Where message ordering, or affinity to specific message resources is necessary, a single endpoint (multiEndpointServer = false) may be required. + /// + [DataMember(Order = 4, Name = "multiEndpointServer"), JsonPropertyOrder(4), JsonPropertyName("multiEndpointServer"), YamlMember(Order = 4, Alias = "multiEndpointServer")] + public virtual bool MultiEndpointServer { get; set; } + + /// + /// Gets/sets the recommended value (in seconds) for the heartbeat sent to the queue manager during periods of inactivity. + /// A value of zero means that no heart beats are sent. + /// A value of 1 means that the client will use the value defined by the queue manager. + /// More information on heart beat interval can be found on this page in the IBM MQ Knowledge Center. + /// + [DataMember(Order = 5, Name = "heartBeatInterval"), JsonPropertyOrder(5), JsonPropertyName("heartBeatInterval"), YamlMember(Order = 5, Alias = "heartBeatInterval")] + public virtual int? HeartBeatInterval { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 6, Name = "bindingVersion"), JsonPropertyOrder(6), JsonPropertyName("bindingVersion"), YamlMember(Order = 6, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQTopicDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQTopicDefinition.cs new file mode 100644 index 0000000..1bb2860 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/IbmMQ/IbmMQTopicDefinition.cs @@ -0,0 +1,42 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.IbmMQ; + +/// +/// Represents the object used to configure an IBMMQ topic +/// +[DataContract] +public record IbmMQTopicDefinition +{ + + /// + /// Gets/sets the value of the IBM MQ topic string to be used. + /// + [Required, MaxLength(48)] + [DataMember(Order = 1, Name = "objectName"), JsonPropertyOrder(1), JsonPropertyName("objectName"), YamlMember(Order = 1, Alias = "objectName")] + public virtual string ObjectName { get; set; } = null!; + + /// + /// Gets/sets a boolean indicating whether or not the subscription may be durable. + /// + [DataMember(Order = 2, Name = "durablePermitted"), JsonPropertyOrder(2), JsonPropertyName("durablePermitted"), YamlMember(Order = 2, Alias = "durablePermitted")] + public virtual bool DurablePermitted { get; set; } + + /// + /// Gets/sets the last message published will be made available to new subscriptions. + /// + [DataMember(Order = 3, Name = "lastMsgRetained"), JsonPropertyOrder(3), JsonPropertyName("lastMsgRetained"), YamlMember(Order = 3, Alias = "lastMsgRetained")] + public virtual bool LastMsgRetained { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsBindingDefinition.cs new file mode 100644 index 0000000..7bc947b --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Jms; + +/// +/// Represents the base record for all JMS implementations of the interface +/// +[DataContract] +public abstract record JmsBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.Jms; + } + } + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsChannelBindingDefinition.cs new file mode 100644 index 0000000..c685796 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsChannelBindingDefinition.cs @@ -0,0 +1,42 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Jms; + +/// +/// Represents the object used to configure a JMS channel binding +/// +[DataContract] +public record JmsChannelBindingDefinition + : JmsBindingDefinition, IChannelBindingDefinition +{ + + /// + /// Gets/sets the destination (queue) name for this channel. SHOULD only be specified if the channel name differs from the actual destination name, such as when the channel name is not a valid destination name according to the JMS Provider. + /// + [DataMember(Order = 1, Name = "destination"), JsonPropertyOrder(1), JsonPropertyName("destination"), YamlMember(Order = 1, Alias = "destination")] + public virtual string? Destination { get; set; } + + /// + /// Gets/sets the type of destination, which MUST be either queue, or fifo-queue. SHOULD be specified to document the messaging model (point-to-point, or strict message ordering) supported by this channel. + /// + [DataMember(Order = 2, Name = "destinationType"), JsonPropertyOrder(2), JsonPropertyName("destinationType"), YamlMember(Order = 2, Alias = "destinationType")] + public virtual JmsDestinationType DestinationType { get; set; } = JmsDestinationType.Queue; + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 3, Name = "bindingVersion"), JsonPropertyOrder(3), JsonPropertyName("bindingVersion"), YamlMember(Order = 3, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsDestinationType.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsDestinationType.cs new file mode 100644 index 0000000..67b685d --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsDestinationType.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Jms; + +/// +/// Enumerates all supported types of JMS destinations +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum JmsDestinationType +{ + /// + /// Indicates point to point message ordering + /// + [EnumMember(Value = "queue")] + Queue = 0, + /// + /// Indicates strict message ordering + /// + [EnumMember(Value = "fifo-queue")] + FifoQueue = 1 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsMessageBindingDefinition.cs new file mode 100644 index 0000000..55bd72b --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsMessageBindingDefinition.cs @@ -0,0 +1,38 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Json.Schema; + +namespace Neuroglia.AsyncApi.v2.Bindings.Jms; + +/// +/// Represents the object used to configure a JMS message binding +/// +[DataContract] +public record JmsMessageBindingDefinition + : JmsBindingDefinition, IMessageBindingDefinition +{ + + /// + /// Gets/sets a schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). This schema MUST be of type object and have a properties key. Examples of Anypoint MQ protocol headers are messageId and messageGroupId. + /// + [DataMember(Order = 1, Name = "headers"), JsonPropertyOrder(1), JsonPropertyName("headers"), YamlMember(Order = 1, Alias = "headers")] + public virtual JsonSchema? Headers { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 2, Name = "bindingVersion"), JsonPropertyOrder(2), JsonPropertyName("bindingVersion"), YamlMember(Order = 2, Alias = "bindingVersion")] + public virtual string? BindingVersion { get; set; } = "latest"; + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsOperationBindingDefinition.cs new file mode 100644 index 0000000..7cbb412 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsOperationBindingDefinition.cs @@ -0,0 +1,27 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Json.Schema; + +namespace Neuroglia.AsyncApi.v2.Bindings.Jms; + +/// +/// Represents the object used to configure a JMS operation binding +/// +[DataContract] +public record JmsOperationBindingDefinition + : JmsBindingDefinition, IOperationBindingDefinition +{ + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsServerBindingDefinition.cs new file mode 100644 index 0000000..2483814 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Jms/JmsServerBindingDefinition.cs @@ -0,0 +1,51 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Json.Schema; + +namespace Neuroglia.AsyncApi.v2.Bindings.Jms; + +/// +/// Represents the object used to configure a JMS server binding +/// +[DataContract] +public record JmsServerBindingDefinition + : JmsBindingDefinition, IServerBindingDefinition +{ + + /// + /// Gets/sets the classname of the ConnectionFactory implementation for the JMS Provider + /// + [Required] + [DataMember(Order = 1, Name = "jmsConnectionFactory"), JsonPropertyOrder(1), JsonPropertyName("jmsConnectionFactory"), YamlMember(Order = 1, Alias = "jmsConnectionFactory")] + public virtual string JmsConnectionFactory { get; set; } = null!; + + /// + /// Gets/sets additional properties to set on the JMS ConnectionFactory implementation for the JMS Provider. + /// + [DataMember(Order = 2, Name = "properties"), JsonPropertyOrder(2), JsonPropertyName("properties"), YamlMember(Order = 2, Alias = "properties")] + public virtual EquatableList? Properties { get; set; } + + /// + /// Gets/sets a client identifier for applications that use this JMS connection factory. If the Client ID Policy is set to 'Restricted' (the default), then configuring a Client ID on the ConnectionFactory prevents more than one JMS client from using a connection from this factory. + /// + [DataMember(Order = 3, Name = "clientID"), JsonPropertyOrder(3), JsonPropertyName("clientID"), YamlMember(Order = 3, Alias = "clientID")] + public virtual string? ClientId { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 4, Name = "bindingVersion"), JsonPropertyOrder(4), JsonPropertyName("bindingVersion"), YamlMember(Order = 4, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaBindingDefinition.cs index d90c759..9bd2e81 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaBindingDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaBindingDefinition.cs @@ -11,9 +11,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2; -using Neuroglia.AsyncApi.v2.Bindings; - namespace Neuroglia.AsyncApi.v2.Bindings.Kafka; /// diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaChannelBindingDefinition.cs index 06f37f4..a7f5e83 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaChannelBindingDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaChannelBindingDefinition.cs @@ -11,8 +11,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2.Bindings; - namespace Neuroglia.AsyncApi.v2.Bindings.Kafka; /// diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaMessageBindingDefinition.cs index c81e355..313ea6e 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaMessageBindingDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaMessageBindingDefinition.cs @@ -12,7 +12,6 @@ // limitations under the License. using Json.Schema; -using Neuroglia.AsyncApi.v2.Bindings; namespace Neuroglia.AsyncApi.v2.Bindings.Kafka; diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaOperationBindingDefinition.cs index a3c63fc..dcc7d22 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaOperationBindingDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Kafka/KafkaOperationBindingDefinition.cs @@ -12,7 +12,6 @@ // limitations under the License. using Json.Schema; -using Neuroglia.AsyncApi.v2.Bindings; namespace Neuroglia.AsyncApi.v2.Bindings.Kafka; diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureBindingDefinition.cs new file mode 100644 index 0000000..d194981 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Mercure; + +/// +/// Represents the base record for all Mercure implementations of the interface +/// +[DataContract] +public abstract record MercureBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.Mercure; + } + } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureChannelBindingDefinition.cs new file mode 100644 index 0000000..5e8d6fa --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureChannelBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Mercure; + +/// +/// Represents the object used to configure a Mercure channel binding +/// +[DataContract] +public record MercureChannelBindingDefinition + : MercureBindingDefinition, IChannelBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureMessageBindingDefinition.cs new file mode 100644 index 0000000..4e85fd6 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureMessageBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Mercure; + +/// +/// Represents the object used to configure a Mercure message binding +/// +[DataContract] +public record MercureMessageBindingDefinition + : MercureBindingDefinition, IMessageBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureOperationBindingDefinition.cs new file mode 100644 index 0000000..0e009b3 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureOperationBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Mercure; + +/// +/// Represents the object used to configure a Mercure operation binding +/// +[DataContract] +public record MercureOperationBindingDefinition + : MercureBindingDefinition, IOperationBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureServerBindingDefinition.cs new file mode 100644 index 0000000..673eb1a --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Mercure/MercureServerBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Mercure; + +/// +/// Represents the object used to configure a Mercure server binding +/// +[DataContract] +public record MercureServerBindingDefinition + : MercureBindingDefinition, IServerBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/MessageBindingCollection.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/MessageBindingCollection.cs deleted file mode 100644 index 65a0ea5..0000000 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/MessageBindingCollection.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright © 2021-Present Neuroglia SRL. All rights reserved. -// -// 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. - -using Neuroglia.AsyncApi.v2; -using Neuroglia.AsyncApi.v2.Bindings.Amqp; -using Neuroglia.AsyncApi.v2.Bindings.AmqpV1; -using Neuroglia.AsyncApi.v2.Bindings.Http; -using Neuroglia.AsyncApi.v2.Bindings.Kafka; -using Neuroglia.AsyncApi.v2.Bindings.Mqtt; -using Neuroglia.AsyncApi.v2.Bindings.MqttV5; -using Neuroglia.AsyncApi.v2.Bindings.Nats; -using Neuroglia.AsyncApi.v2.Bindings.Redis; -using Neuroglia.AsyncApi.v2.Bindings.WebSockets; - -namespace Neuroglia.AsyncApi.v2.Bindings; - -/// -/// Represents the object used to configure a 's s -/// -[DataContract] -public record MessageBindingCollection - : BindingDefinitionCollection -{ - - /// - /// Gets/sets the protocol-specific information for an HTTP message. - /// - [DataMember(Order = 1, Name = "http"), JsonPropertyOrder(1), JsonPropertyName("http"), YamlMember(Order = 1, Alias = "http")] - public virtual HttpMessageBindingDefinition? Http { get; set; } - - /// - /// Gets/sets the protocol-specific information for an WebSockets message. - /// - [DataMember(Order = 2, Name = "ws"), JsonPropertyOrder(2), JsonPropertyName("ws"), YamlMember(Order = 2, Alias = "ws")] - public virtual WsMessageBindingDefinition? Ws { get; set; } - - /// - /// Gets/sets the protocol-specific information for a Kafka message. - /// - [DataMember(Order = 3, Name = "kafka"), JsonPropertyOrder(3), JsonPropertyName("kafka"), YamlMember(Order = 3, Alias = "kafka")] - public virtual KafkaMessageBindingDefinition? Kafka { get; set; } - - /// - /// Gets/sets the protocol-specific information for an AMQP 0-9-1 message. - /// - [DataMember(Order = 4, Name = "amqp"), JsonPropertyOrder(4), JsonPropertyName("amqp"), YamlMember(Order = 4, Alias = "amqp")] - public virtual AmqpMessageBindingDefinition? Amqp { get; set; } - - /// - /// Gets/sets the protocol-specific information for an information for an AMQP 1.0 message. - /// - [DataMember(Order = 5, Name = "amqp1"), JsonPropertyOrder(5), JsonPropertyName("amqp1"), YamlMember(Order = 5, Alias = "amqp1")] - public virtual AmqpV1MessageBindingDefinition? Amqp1 { get; set; } - - /// - /// Gets/sets the protocol-specific information for an information for an MQTT message. - /// - [DataMember(Order = 6, Name = "mqtt"), JsonPropertyOrder(6), JsonPropertyName("mqtt"), YamlMember(Order = 6, Alias = "mqtt")] - public virtual MqttMessageBindingDefinition? Mqtt { get; set; } - - /// - /// Gets/sets the protocol-specific information for an information for an MQTT 5 message. - /// - [DataMember(Order = 7, Name = "mqtt5"), JsonPropertyOrder(7), JsonPropertyName("mqtt5"), YamlMember(Order = 7, Alias = "mqtt5")] - public virtual MqttV5MessageBindingDefinition? Mqtt5 { get; set; } - - /// - /// Gets/sets the protocol-specific information for an information for a NATS message. - /// - [DataMember(Order = 8, Name = "nats"), JsonPropertyOrder(8), JsonPropertyName("nats"), YamlMember(Order = 8, Alias = "nats")] - public virtual NatsMessageBindingDefinition? Nats { get; set; } - - /// - /// Gets/sets the protocol-specific information for an information for a Redis message. - /// - [DataMember(Order = 9, Name = "redis"), JsonPropertyOrder(9), JsonPropertyName("redis"), YamlMember(Order = 9, Alias = "redis")] - public virtual RedisMessageBindingDefinition? Redis { get; set; } - - /// - public override IEnumerable AsEnumerable() - { - if (Http != null) yield return Http; - if (Ws != null) yield return Ws; - if (Kafka != null) yield return Kafka; - if (Amqp != null) yield return Amqp; - if (Amqp1 != null) yield return Amqp1; - if (Mqtt != null) yield return Mqtt; - if (Mqtt5 != null) yield return Mqtt5; - if (Nats != null) yield return Nats; - if (Redis != null) yield return Redis; - } - -} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/MessageBindingDefinitionCollection.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/MessageBindingDefinitionCollection.cs new file mode 100644 index 0000000..45896bc --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/MessageBindingDefinitionCollection.cs @@ -0,0 +1,182 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.AsyncApi.v2.Bindings.Amqp; +using Neuroglia.AsyncApi.v2.Bindings.AmqpV1; +using Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; +using Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; +using Neuroglia.AsyncApi.v2.Bindings.Http; +using Neuroglia.AsyncApi.v2.Bindings.IbmMQ; +using Neuroglia.AsyncApi.v2.Bindings.Jms; +using Neuroglia.AsyncApi.v2.Bindings.Kafka; +using Neuroglia.AsyncApi.v2.Bindings.Mercure; +using Neuroglia.AsyncApi.v2.Bindings.Mqtt; +using Neuroglia.AsyncApi.v2.Bindings.MqttV5; +using Neuroglia.AsyncApi.v2.Bindings.Nats; +using Neuroglia.AsyncApi.v2.Bindings.Pulsar; +using Neuroglia.AsyncApi.v2.Bindings.Redis; +using Neuroglia.AsyncApi.v2.Bindings.Sns; +using Neuroglia.AsyncApi.v2.Bindings.Solace; +using Neuroglia.AsyncApi.v2.Bindings.Sqs; +using Neuroglia.AsyncApi.v2.Bindings.Stomp; +using Neuroglia.AsyncApi.v2.Bindings.WebSockets; + +namespace Neuroglia.AsyncApi.v2.Bindings; + +/// +/// Represents the object used to configure a 's s +/// +[DataContract] +public record MessageBindingDefinitionCollection + : BindingDefinitionCollection +{ + + /// + /// Gets/sets the protocol-specific information for an HTTP message. + /// + [DataMember(Order = 1, Name = "http"), JsonPropertyOrder(1), JsonPropertyName("http"), YamlMember(Order = 1, Alias = "http")] + public virtual HttpMessageBindingDefinition? Http { get; set; } + + /// + /// Gets/sets the protocol-specific information for an WebSockets message. + /// + [DataMember(Order = 2, Name = "ws"), JsonPropertyOrder(2), JsonPropertyName("ws"), YamlMember(Order = 2, Alias = "ws")] + public virtual WsMessageBindingDefinition? Ws { get; set; } + + /// + /// Gets/sets the protocol-specific information for a Kafka message. + /// + [DataMember(Order = 3, Name = "kafka"), JsonPropertyOrder(3), JsonPropertyName("kafka"), YamlMember(Order = 3, Alias = "kafka")] + public virtual KafkaMessageBindingDefinition? Kafka { get; set; } + + /// + /// Gets/sets the protocol-specific information for a Anypoint MQ message. + /// + [DataMember(Order = 4, Name = "anypointmq"), JsonPropertyOrder(4), JsonPropertyName("anypointmq"), YamlMember(Order = 4, Alias = "anypointmq")] + public virtual AnypointMQMessageBindingDefinition? AnypointMQ { get; set; } + + /// + /// Gets/sets the protocol-specific information for an AMQP 0-9-1 message. + /// + [DataMember(Order = 5, Name = "amqp"), JsonPropertyOrder(5), JsonPropertyName("amqp"), YamlMember(Order = 5, Alias = "amqp")] + public virtual AmqpMessageBindingDefinition? Amqp { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for an AMQP 1.0 message. + /// + [DataMember(Order = 6, Name = "amqp1"), JsonPropertyOrder(6), JsonPropertyName("amqp1"), YamlMember(Order = 6, Alias = "amqp1")] + public virtual AmqpV1MessageBindingDefinition? Amqp1 { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for an MQTT message. + /// + [DataMember(Order = 7, Name = "mqtt"), JsonPropertyOrder(7), JsonPropertyName("mqtt"), YamlMember(Order = 7, Alias = "mqtt")] + public virtual MqttMessageBindingDefinition? Mqtt { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for an MQTT 5 message. + /// + [DataMember(Order = 8, Name = "mqtt5"), JsonPropertyOrder(8), JsonPropertyName("mqtt5"), YamlMember(Order = 8, Alias = "mqtt5")] + public virtual MqttV5MessageBindingDefinition? Mqtt5 { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a NATS message. + /// + [DataMember(Order = 9, Name = "nats"), JsonPropertyOrder(9), JsonPropertyName("nats"), YamlMember(Order = 9, Alias = "nats")] + public virtual NatsMessageBindingDefinition? Nats { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a JMS message. + /// + [DataMember(Order = 10, Name = "jms"), JsonPropertyOrder(10), JsonPropertyName("jms"), YamlMember(Order = 10, Alias = "jms")] + public virtual JmsMessageBindingDefinition? Jms { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SNS message. + /// + [DataMember(Order = 11, Name = "sns"), JsonPropertyOrder(11), JsonPropertyName("sns"), YamlMember(Order = 11, Alias = "sns")] + public virtual SnsMessageBindingDefinition? Sns { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Solace message. + /// + [DataMember(Order = 12, Name = "solace"), JsonPropertyOrder(12), JsonPropertyName("solace"), YamlMember(Order = 12, Alias = "solace")] + public virtual SolaceMessageBindingDefinition? Solace { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SQS message. + /// + [DataMember(Order = 13, Name = "sqs"), JsonPropertyOrder(13), JsonPropertyName("sqs"), YamlMember(Order = 13, Alias = "sqs")] + public virtual SqsMessageBindingDefinition? Sqs { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a STOMP message. + /// + [DataMember(Order = 14, Name = "stomp"), JsonPropertyOrder(14), JsonPropertyName("stomp"), YamlMember(Order = 14, Alias = "stomp")] + public virtual StompMessageBindingDefinition? Stomp { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Redis message. + /// + [DataMember(Order = 15, Name = "redis"), JsonPropertyOrder(15), JsonPropertyName("redis"), YamlMember(Order = 15, Alias = "redis")] + public virtual RedisMessageBindingDefinition? Redis { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Redis message. + /// + [DataMember(Order = 16, Name = "mercure"), JsonPropertyOrder(16), JsonPropertyName("mercure"), YamlMember(Order = 16, Alias = "mercure")] + public virtual MercureMessageBindingDefinition? Mercure { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for an IBM MQ message. + /// + [DataMember(Order = 17, Name = "ibmmq"), JsonPropertyOrder(17), JsonPropertyName("ibmmq"), YamlMember(Order = 17, Alias = "ibmmq")] + public virtual IbmMQMessageBindingDefinition? IbmMQ { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub message. + /// + [DataMember(Order = 18, Name = "googlepubsub"), JsonPropertyOrder(18), JsonPropertyName("googlepubsub"), YamlMember(Order = 18, Alias = "googlepubsub")] + public virtual GooglePubSubMessageBindingDefinition? GooglePubSub { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub message. + /// + [DataMember(Order = 19, Name = "pulsar"), JsonPropertyOrder(19), JsonPropertyName("pulsar"), YamlMember(Order = 19, Alias = "pulsar")] + public virtual PulsarMessageBindingDefinition? Pulsar { get; set; } + + /// + public override IEnumerable AsEnumerable() + { + if (this.Http != null) yield return this.Http; + if (this.Ws != null) yield return this.Ws; + if (this.Kafka != null) yield return this.Kafka; + if (this.AnypointMQ != null) yield return this.AnypointMQ; + if (this.Amqp != null) yield return this.Amqp; + if (this.Amqp1 != null) yield return this.Amqp1; + if (this.Mqtt != null) yield return this.Mqtt; + if (this.Mqtt5 != null) yield return this.Mqtt5; + if (this.Nats != null) yield return this.Nats; + if (this.Jms != null) yield return this.Jms; + if (this.Sns != null) yield return this.Sns; + if (this.Solace != null) yield return this.Solace; + if (this.Sqs != null) yield return this.Sqs; + if (this.Stomp != null) yield return this.Stomp; + if (this.Redis != null) yield return this.Redis; + if (this.Mercure != null) yield return this.Mercure; + if (this.IbmMQ != null) yield return this.IbmMQ; + if (this.GooglePubSub != null) yield return this.GooglePubSub; + if (this.Pulsar != null) yield return this.Pulsar; + } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Nats/NatsChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Nats/NatsChannelBindingDefinition.cs index b229ace..c1ead73 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Nats/NatsChannelBindingDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Nats/NatsChannelBindingDefinition.cs @@ -11,8 +11,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2.Bindings; - namespace Neuroglia.AsyncApi.v2.Bindings.Nats; /// diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/OperationBindingDefinitionCollection.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/OperationBindingDefinitionCollection.cs index 3f293e7..87c28b4 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/OperationBindingDefinitionCollection.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/OperationBindingDefinitionCollection.cs @@ -11,15 +11,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2; using Neuroglia.AsyncApi.v2.Bindings.Amqp; using Neuroglia.AsyncApi.v2.Bindings.AmqpV1; +using Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; +using Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; using Neuroglia.AsyncApi.v2.Bindings.Http; +using Neuroglia.AsyncApi.v2.Bindings.IbmMQ; +using Neuroglia.AsyncApi.v2.Bindings.Jms; using Neuroglia.AsyncApi.v2.Bindings.Kafka; +using Neuroglia.AsyncApi.v2.Bindings.Mercure; using Neuroglia.AsyncApi.v2.Bindings.Mqtt; using Neuroglia.AsyncApi.v2.Bindings.MqttV5; using Neuroglia.AsyncApi.v2.Bindings.Nats; +using Neuroglia.AsyncApi.v2.Bindings.Pulsar; using Neuroglia.AsyncApi.v2.Bindings.Redis; +using Neuroglia.AsyncApi.v2.Bindings.Sns; +using Neuroglia.AsyncApi.v2.Bindings.Solace; +using Neuroglia.AsyncApi.v2.Bindings.Sqs; +using Neuroglia.AsyncApi.v2.Bindings.Stomp; using Neuroglia.AsyncApi.v2.Bindings.WebSockets; namespace Neuroglia.AsyncApi.v2.Bindings; @@ -50,54 +59,124 @@ public record OperationBindingDefinitionCollection [DataMember(Order = 3, Name = "kafka"), JsonPropertyOrder(3), JsonPropertyName("kafka"), YamlMember(Order = 3, Alias = "kafka")] public virtual KafkaOperationBindingDefinition? Kafka { get; set; } + /// + /// Gets/sets the protocol-specific information for a Anypoint MQ operation. + /// + [DataMember(Order = 4, Name = "anypointmq"), JsonPropertyOrder(4), JsonPropertyName("anypointmq"), YamlMember(Order = 4, Alias = "anypointmq")] + public virtual AnypointMQOperationBindingDefinition? AnypointMQ { get; set; } + /// /// Gets/sets the protocol-specific information for an AMQP 0-9-1 operation. /// - [DataMember(Order = 4, Name = "amqp"), JsonPropertyOrder(4), JsonPropertyName("amqp"), YamlMember(Order = 4, Alias = "amqp")] + [DataMember(Order = 5, Name = "amqp"), JsonPropertyOrder(5), JsonPropertyName("amqp"), YamlMember(Order = 5, Alias = "amqp")] public virtual AmqpOperationBindingDefinition? Amqp { get; set; } /// /// Gets/sets the protocol-specific information for an information for an AMQP 1.0 operation. /// - [DataMember(Order = 5, Name = "amqp1"), JsonPropertyOrder(5), JsonPropertyName("amqp1"), YamlMember(Order = 5, Alias = "amqp1")] + [DataMember(Order = 6, Name = "amqp1"), JsonPropertyOrder(6), JsonPropertyName("amqp1"), YamlMember(Order = 6, Alias = "amqp1")] public virtual AmqpV1OperationBindingDefinition? Amqp1 { get; set; } /// /// Gets/sets the protocol-specific information for an information for an MQTT operation. /// - [DataMember(Order = 6, Name = "mqtt"), JsonPropertyOrder(6), JsonPropertyName("mqtt"), YamlMember(Order = 6, Alias = "mqtt")] + [DataMember(Order = 7, Name = "mqtt"), JsonPropertyOrder(7), JsonPropertyName("mqtt"), YamlMember(Order = 7, Alias = "mqtt")] public virtual MqttOperationBindingDefinition? Mqtt { get; set; } /// /// Gets/sets the protocol-specific information for an information for an MQTT 5 operation. /// - [DataMember(Order = 7, Name = "mqtt5"), JsonPropertyOrder(7), JsonPropertyName("mqtt5"), YamlMember(Order = 7, Alias = "mqtt5")] + [DataMember(Order = 8, Name = "mqtt5"), JsonPropertyOrder(8), JsonPropertyName("mqtt5"), YamlMember(Order = 8, Alias = "mqtt5")] public virtual MqttV5OperationBindingDefinition? Mqtt5 { get; set; } /// /// Gets/sets the protocol-specific information for an information for a NATS operation. /// - [DataMember(Order = 8, Name = "nats"), JsonPropertyOrder(8), JsonPropertyName("nats"), YamlMember(Order = 8, Alias = "nats")] + [DataMember(Order = 9, Name = "nats"), JsonPropertyOrder(9), JsonPropertyName("nats"), YamlMember(Order = 9, Alias = "nats")] public virtual NatsOperationBindingDefinition? Nats { get; set; } + /// + /// Gets/sets the protocol-specific information for an information for a JMS operation. + /// + [DataMember(Order = 10, Name = "jms"), JsonPropertyOrder(10), JsonPropertyName("jms"), YamlMember(Order = 10, Alias = "jms")] + public virtual JmsOperationBindingDefinition? Jms { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SNS operation. + /// + [DataMember(Order = 11, Name = "sns"), JsonPropertyOrder(11), JsonPropertyName("sns"), YamlMember(Order = 11, Alias = "sns")] + public virtual SnsOperationBindingDefinition? Sns { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Solace operation. + /// + [DataMember(Order = 12, Name = "solace"), JsonPropertyOrder(12), JsonPropertyName("solace"), YamlMember(Order = 12, Alias = "solace")] + public virtual SolaceOperationBindingDefinition? Solace { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SQS operation. + /// + [DataMember(Order = 13, Name = "sqs"), JsonPropertyOrder(13), JsonPropertyName("sqs"), YamlMember(Order = 13, Alias = "sqs")] + public virtual SqsOperationBindingDefinition? Sqs { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a STOMP operation. + /// + [DataMember(Order = 14, Name = "stomp"), JsonPropertyOrder(14), JsonPropertyName("stomp"), YamlMember(Order = 14, Alias = "stomp")] + public virtual StompOperationBindingDefinition? Stomp { get; set; } + /// /// Gets/sets the protocol-specific information for an information for a Redis operation. /// - [DataMember(Order = 9, Name = "redis"), JsonPropertyOrder(9), JsonPropertyName("redis"), YamlMember(Order = 9, Alias = "redis")] + [DataMember(Order = 15, Name = "redis"), JsonPropertyOrder(15), JsonPropertyName("redis"), YamlMember(Order = 15, Alias = "redis")] public virtual RedisOperationBindingDefinition? Redis { get; set; } + /// + /// Gets/sets the protocol-specific information for an information for a Redis operation. + /// + [DataMember(Order = 16, Name = "mercure"), JsonPropertyOrder(16), JsonPropertyName("mercure"), YamlMember(Order = 16, Alias = "mercure")] + public virtual MercureOperationBindingDefinition? Mercure { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for an IBM MQ operation. + /// + [DataMember(Order = 17, Name = "ibmmq"), JsonPropertyOrder(17), JsonPropertyName("ibmmq"), YamlMember(Order = 17, Alias = "ibmmq")] + public virtual IbmMQOperationBindingDefinition? IbmMQ { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub operation. + /// + [DataMember(Order = 18, Name = "googlepubsub"), JsonPropertyOrder(18), JsonPropertyName("googlepubsub"), YamlMember(Order = 18, Alias = "googlepubsub")] + public virtual GooglePubSubOperationBindingDefinition? GooglePubSub { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub operation. + /// + [DataMember(Order = 19, Name = "pulsar"), JsonPropertyOrder(19), JsonPropertyName("pulsar"), YamlMember(Order = 19, Alias = "pulsar")] + public virtual PulsarOperationBindingDefinition? Pulsar { get; set; } + /// public override IEnumerable AsEnumerable() { - if (Http != null) yield return Http; - if (Ws != null) yield return Ws; - if (Kafka != null) yield return Kafka; - if (Amqp != null) yield return Amqp; - if (Amqp1 != null) yield return Amqp1; - if (Mqtt != null) yield return Mqtt; - if (Mqtt5 != null) yield return Mqtt5; - if (Nats != null) yield return Nats; - if (Redis != null) yield return Redis; + if (this.Http != null) yield return this.Http; + if (this.Ws != null) yield return this.Ws; + if (this.Kafka != null) yield return this.Kafka; + if (this.AnypointMQ != null) yield return this.AnypointMQ; + if (this.Amqp != null) yield return this.Amqp; + if (this.Amqp1 != null) yield return this.Amqp1; + if (this.Mqtt != null) yield return this.Mqtt; + if (this.Mqtt5 != null) yield return this.Mqtt5; + if (this.Nats != null) yield return this.Nats; + if (this.Jms != null) yield return this.Jms; + if (this.Sns != null) yield return this.Sns; + if (this.Solace != null) yield return this.Solace; + if (this.Sqs != null) yield return this.Sqs; + if (this.Stomp != null) yield return this.Stomp; + if (this.Redis != null) yield return this.Redis; + if (this.Mercure != null) yield return this.Mercure; + if (this.IbmMQ != null) yield return this.IbmMQ; + if (this.GooglePubSub != null) yield return this.GooglePubSub; + if (this.Pulsar != null) yield return this.Pulsar; } -} \ No newline at end of file +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarBindingDefinition.cs new file mode 100644 index 0000000..9b1bce5 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Pulsar; + +/// +/// Represents the base record for all Pulsar implementations of the interface +/// +[DataContract] +public abstract record PulsarBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.Pulsar; + } + } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarChannelBindingDefinition.cs new file mode 100644 index 0000000..7aabf94 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarChannelBindingDefinition.cs @@ -0,0 +1,73 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Pulsar; + +/// +/// Represents the object used to configure a Pulsar channel binding +/// +[DataContract] +public record PulsarChannelBindingDefinition + : PulsarBindingDefinition, IChannelBindingDefinition +{ + + /// + /// Gets/sets the namespace the channel is associated with. + /// + [Required, MinLength(1)] + [DataMember(Order = 1, Name = "namespace"), JsonPropertyOrder(1), JsonPropertyName("namespace"), YamlMember(Order = 1, Alias = "namespace")] + public virtual string Namespace { get; set; } = null!; + + /// + /// Gets/sets the persistence of the topic in Pulsar. + /// + [DataMember(Order = 2, Name = "persistence"), JsonPropertyOrder(2), JsonPropertyName("persistence"), YamlMember(Order = 2, Alias = "persistence")] + public virtual PulsarTopicTypes Persistence { get; set; } + + /// + /// Gets/sets the topic compaction threshold given in Megabytes. + /// + [DataMember(Order = 3, Name = "compaction"), JsonPropertyOrder(3), JsonPropertyName("compaction"), YamlMember(Order = 3, Alias = "compaction")] + public virtual int? Compaction { get; set; } + + /// + /// Gets/sets the list of clusters the topic is replicated to. + /// + [DataMember(Order = 4, Name = "geo-replication"), JsonPropertyOrder(4), JsonPropertyName("geo-replication"), YamlMember(Order = 4, Alias = "geo-replication")] + public virtual EquatableList? GeoReplication { get; set; } + + /// + /// Gets/sets an object used to configure the channel's retention policy. + /// + [DataMember(Order = 5, Name = "retention"), JsonPropertyOrder(5), JsonPropertyName("retention"), YamlMember(Order = 5, Alias = "retention")] + public virtual PulsarRetentionPolicyDefinition? Retention { get; set; } + + /// + /// Gets/sets the message time-to-live in seconds. + /// + [DataMember(Order = 6, Name = "ttl"), JsonPropertyOrder(6), JsonPropertyName("ttl"), YamlMember(Order = 6, Alias = "ttl")] + public virtual int? Ttl { get; set; } + + /// + /// Gets/sets the list of clusters the topic is replicated to. + /// + [DataMember(Order = 7, Name = "deduplication"), JsonPropertyOrder(7), JsonPropertyName("deduplication"), YamlMember(Order = 7, Alias = "deduplication")] + public virtual bool? Deduplication { get; set; } + + /// + /// Gets/sets the version of this binding. If omitted, "latest" MUST be assumed. + /// + [DataMember(Order = 8, Name = "bindingVersion"), JsonPropertyOrder(8), JsonPropertyName("bindingVersion"), YamlMember(Order = 8, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarMessageBindingDefinition.cs new file mode 100644 index 0000000..99de6ef --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarMessageBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Pulsar; + +/// +/// Represents the object used to configure a Pulsar message binding +/// +[DataContract] +public record PulsarMessageBindingDefinition + : PulsarBindingDefinition, IMessageBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarOperationBindingDefinition.cs new file mode 100644 index 0000000..6877ec6 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarOperationBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Pulsar; + +/// +/// Represents the object used to configure a Pulsar operation binding +/// +[DataContract] +public record PulsarOperationBindingDefinition + : PulsarBindingDefinition, IOperationBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarRetentionPolicyDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarRetentionPolicyDefinition.cs new file mode 100644 index 0000000..cea8196 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarRetentionPolicyDefinition.cs @@ -0,0 +1,35 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Pulsar; + +/// +/// Represents the object used to configure a Pulsar channel's retention policy +/// +[DataContract] +public record PulsarRetentionPolicyDefinition +{ + + /// + /// Gets/sets the retention time, in minutes. + /// + [DataMember(Order = 1, Name = "time"), JsonPropertyOrder(1), JsonPropertyName("time"), YamlMember(Order = 1, Alias = "time")] + public virtual int Time { get; set; } = 0; + + /// + /// Gets/sets the retention size, in MB. + /// + [DataMember(Order = 2, Name = "size"), JsonPropertyOrder(2), JsonPropertyName("size"), YamlMember(Order = 2, Alias = "size")] + public virtual int Size { get; set; } = 0; + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarServerBindingDefinition.cs new file mode 100644 index 0000000..9a1845b --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarServerBindingDefinition.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Pulsar; + +/// +/// Represents the object used to configure a Pulsar server binding +/// +[DataContract] +public record PulsarServerBindingDefinition + : PulsarBindingDefinition, IServerBindingDefinition +{ + + /// + /// Gets/sets the pulsar tenant. If omitted, "public" MUST be assumed. + /// + [DataMember(Order = 1, Name = "tenant"), JsonPropertyOrder(1), JsonPropertyName("tenant"), YamlMember(Order = 1, Alias = "tenant")] + public virtual string? Tenant { get; set; } + + /// + /// Gets/sets the version of this binding. If omitted, "latest" MUST be assumed. + /// + [DataMember(Order = 2, Name = "bindingVersion"), JsonPropertyOrder(2), JsonPropertyName("bindingVersion"), YamlMember(Order = 2, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarTopicTypes.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarTopicTypes.cs new file mode 100644 index 0000000..c0297ae --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Pulsar/PulsarTopicTypes.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Pulsar; + +/// +/// Enumerates all Pulsar topic types +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum PulsarTopicTypes +{ + /// + /// Indicates a persistent topic + /// + [EnumMember(Value = "persistent")] + Persistent = 1, + /// + /// Indicates a non-persistent topic + /// + [EnumMember(Value = "non-persistent")] + NonPersistent = 2 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/ServerBindingDefinitionCollection.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/ServerBindingDefinitionCollection.cs index b2d609b..26ad948 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/Bindings/ServerBindingDefinitionCollection.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/ServerBindingDefinitionCollection.cs @@ -11,15 +11,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Neuroglia.AsyncApi.v2; using Neuroglia.AsyncApi.v2.Bindings.Amqp; using Neuroglia.AsyncApi.v2.Bindings.AmqpV1; +using Neuroglia.AsyncApi.v2.Bindings.AnypointMQ; +using Neuroglia.AsyncApi.v2.Bindings.GooglePubSub; using Neuroglia.AsyncApi.v2.Bindings.Http; +using Neuroglia.AsyncApi.v2.Bindings.IbmMQ; +using Neuroglia.AsyncApi.v2.Bindings.Jms; using Neuroglia.AsyncApi.v2.Bindings.Kafka; +using Neuroglia.AsyncApi.v2.Bindings.Mercure; using Neuroglia.AsyncApi.v2.Bindings.Mqtt; using Neuroglia.AsyncApi.v2.Bindings.MqttV5; using Neuroglia.AsyncApi.v2.Bindings.Nats; +using Neuroglia.AsyncApi.v2.Bindings.Pulsar; using Neuroglia.AsyncApi.v2.Bindings.Redis; +using Neuroglia.AsyncApi.v2.Bindings.Sns; +using Neuroglia.AsyncApi.v2.Bindings.Solace; +using Neuroglia.AsyncApi.v2.Bindings.Sqs; +using Neuroglia.AsyncApi.v2.Bindings.Stomp; using Neuroglia.AsyncApi.v2.Bindings.WebSockets; namespace Neuroglia.AsyncApi.v2.Bindings; @@ -50,54 +59,124 @@ public record ServerBindingDefinitionCollection [DataMember(Order = 3, Name = "kafka"), JsonPropertyOrder(3), JsonPropertyName("kafka"), YamlMember(Order = 3, Alias = "kafka")] public virtual KafkaServerBindingDefinition? Kafka { get; set; } + /// + /// Gets/sets the protocol-specific information for a Anypoint MQ server. + /// + [DataMember(Order = 4, Name = "anypointmq"), JsonPropertyOrder(4), JsonPropertyName("anypointmq"), YamlMember(Order = 4, Alias = "anypointmq")] + public virtual AnypointMQServerBindingDefinition? AnypointMQ { get; set; } + /// /// Gets/sets the protocol-specific information for an AMQP 0-9-1 server. /// - [DataMember(Order = 4, Name = "amqp"), JsonPropertyOrder(4), JsonPropertyName("amqp"), YamlMember(Order = 4, Alias = "amqp")] + [DataMember(Order = 5, Name = "amqp"), JsonPropertyOrder(5), JsonPropertyName("amqp"), YamlMember(Order = 5, Alias = "amqp")] public virtual AmqpServerBindingDefinition? Amqp { get; set; } /// /// Gets/sets the protocol-specific information for an information for an AMQP 1.0 server. /// - [DataMember(Order = 5, Name = "amqp1"), JsonPropertyOrder(5), JsonPropertyName("amqp1"), YamlMember(Order = 5, Alias = "amqp1")] + [DataMember(Order = 6, Name = "amqp1"), JsonPropertyOrder(6), JsonPropertyName("amqp1"), YamlMember(Order = 6, Alias = "amqp1")] public virtual AmqpV1ServerBindingDefinition? Amqp1 { get; set; } /// /// Gets/sets the protocol-specific information for an information for an MQTT server. /// - [DataMember(Order = 6, Name = "mqtt"), JsonPropertyOrder(6), JsonPropertyName("mqtt"), YamlMember(Order = 6, Alias = "mqtt")] + [DataMember(Order = 7, Name = "mqtt"), JsonPropertyOrder(7), JsonPropertyName("mqtt"), YamlMember(Order = 7, Alias = "mqtt")] public virtual MqttServerBindingDefinition? Mqtt { get; set; } /// /// Gets/sets the protocol-specific information for an information for an MQTT 5 server. /// - [DataMember(Order = 7, Name = "mqtt5"), JsonPropertyOrder(7), JsonPropertyName("mqtt5"), YamlMember(Order = 7, Alias = "mqtt5")] + [DataMember(Order = 8, Name = "mqtt5"), JsonPropertyOrder(8), JsonPropertyName("mqtt5"), YamlMember(Order = 8, Alias = "mqtt5")] public virtual MqttV5ServerBindingDefinition? Mqtt5 { get; set; } /// /// Gets/sets the protocol-specific information for an information for a NATS server. /// - [DataMember(Order = 8, Name = "nats"), JsonPropertyOrder(8), JsonPropertyName("nats"), YamlMember(Order = 8, Alias = "nats")] + [DataMember(Order = 9, Name = "nats"), JsonPropertyOrder(9), JsonPropertyName("nats"), YamlMember(Order = 9, Alias = "nats")] public virtual NatsServerBindingDefinition? Nats { get; set; } + /// + /// Gets/sets the protocol-specific information for an information for a JMS server. + /// + [DataMember(Order = 10, Name = "jms"), JsonPropertyOrder(10), JsonPropertyName("jms"), YamlMember(Order = 10, Alias = "jms")] + public virtual JmsServerBindingDefinition? Jms { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SNS server. + /// + [DataMember(Order = 11, Name = "sns"), JsonPropertyOrder(11), JsonPropertyName("sns"), YamlMember(Order = 11, Alias = "sns")] + public virtual SnsServerBindingDefinition? Sns { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Solace server. + /// + [DataMember(Order = 12, Name = "solace"), JsonPropertyOrder(12), JsonPropertyName("solace"), YamlMember(Order = 12, Alias = "solace")] + public virtual SolaceServerBindingDefinition? Solace { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a SQS server. + /// + [DataMember(Order = 13, Name = "sqs"), JsonPropertyOrder(13), JsonPropertyName("sqs"), YamlMember(Order = 13, Alias = "sqs")] + public virtual SqsServerBindingDefinition? Sqs { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a STOMP server. + /// + [DataMember(Order = 14, Name = "stomp"), JsonPropertyOrder(14), JsonPropertyName("stomp"), YamlMember(Order = 14, Alias = "stomp")] + public virtual StompServerBindingDefinition? Stomp { get; set; } + /// /// Gets/sets the protocol-specific information for an information for a Redis server. /// - [DataMember(Order = 9, Name = "redis"), JsonPropertyOrder(9), JsonPropertyName("redis"), YamlMember(Order = 9, Alias = "redis")] + [DataMember(Order = 15, Name = "redis"), JsonPropertyOrder(15), JsonPropertyName("redis"), YamlMember(Order = 15, Alias = "redis")] public virtual RedisServerBindingDefinition? Redis { get; set; } + /// + /// Gets/sets the protocol-specific information for an information for a Redis server. + /// + [DataMember(Order = 16, Name = "mercure"), JsonPropertyOrder(16), JsonPropertyName("mercure"), YamlMember(Order = 16, Alias = "mercure")] + public virtual MercureServerBindingDefinition? Mercure { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for an IBM MQ server. + /// + [DataMember(Order = 17, Name = "ibmmq"), JsonPropertyOrder(17), JsonPropertyName("ibmmq"), YamlMember(Order = 17, Alias = "ibmmq")] + public virtual IbmMQServerBindingDefinition? IbmMQ { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub server. + /// + [DataMember(Order = 18, Name = "googlepubsub"), JsonPropertyOrder(18), JsonPropertyName("googlepubsub"), YamlMember(Order = 18, Alias = "googlepubsub")] + public virtual GooglePubSubServerBindingDefinition? GooglePubSub { get; set; } + + /// + /// Gets/sets the protocol-specific information for an information for a Google Cloud Pub/Sub server. + /// + [DataMember(Order = 19, Name = "pulsar"), JsonPropertyOrder(19), JsonPropertyName("pulsar"), YamlMember(Order = 19, Alias = "pulsar")] + public virtual PulsarServerBindingDefinition? Pulsar { get; set; } + /// public override IEnumerable AsEnumerable() { - if (Http != null) yield return Http; - if (Ws != null) yield return Ws; - if (Kafka != null) yield return Kafka; - if (Amqp != null) yield return Amqp; - if (Amqp1 != null) yield return Amqp1; - if (Mqtt != null) yield return Mqtt; - if (Mqtt5 != null) yield return Mqtt5; - if (Nats != null) yield return Nats; - if (Redis != null) yield return Redis; + if (this.Http != null) yield return this.Http; + if (this.Ws != null) yield return this.Ws; + if (this.Kafka != null) yield return this.Kafka; + if (this.AnypointMQ != null) yield return this.AnypointMQ; + if (this.Amqp != null) yield return this.Amqp; + if (this.Amqp1 != null) yield return this.Amqp1; + if (this.Mqtt != null) yield return this.Mqtt; + if (this.Mqtt5 != null) yield return this.Mqtt5; + if (this.Nats != null) yield return this.Nats; + if (this.Jms != null) yield return this.Jms; + if (this.Sns != null) yield return this.Sns; + if (this.Solace != null) yield return this.Solace; + if (this.Sqs != null) yield return this.Sqs; + if (this.Stomp != null) yield return this.Stomp; + if (this.Redis != null) yield return this.Redis; + if (this.Mercure != null) yield return this.Mercure; + if (this.IbmMQ != null) yield return this.IbmMQ; + if (this.GooglePubSub != null) yield return this.GooglePubSub; + if (this.Pulsar != null) yield return this.Pulsar; } } diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsBackoffAlgorithm.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsBackoffAlgorithm.cs new file mode 100644 index 0000000..0889a6a --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsBackoffAlgorithm.cs @@ -0,0 +1,46 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Enumerates retry backoff algorithm supported by SNS +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SnsBackoffAlgorithm +{ + /// + /// Indicates the arithmetic backoff algorithm + /// + [EnumMember(Value = "arithmetic")] + Arithmetic = 1, + /// + /// Indicates the exponential backoff algorithm + /// + [EnumMember(Value = "exponential")] + Exponential = 2, + /// + /// Indicates the geometric backoff algorithm + /// + [EnumMember(Value = "geometric")] + Geometric = 4, + /// + /// Indicates the linear backoff algorithm + /// + [EnumMember(Value = "linear")] + Linear = 8 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsBindingDefinition.cs new file mode 100644 index 0000000..f4fefa5 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents the base record for all SNS implementations of the interface +/// +[DataContract] +public abstract record SnsBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.Sns; + } + } + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsChannelBindingDefinition.cs new file mode 100644 index 0000000..f1eaa1e --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsChannelBindingDefinition.cs @@ -0,0 +1,55 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents the object used to configure a SNS channel binding +/// +[DataContract] +public record SnsChannelBindingDefinition + : SnsBindingDefinition, IChannelBindingDefinition +{ + + /// + /// Gets/sets the name of the topic. Can be different from the channel name to allow flexibility around AWS resource naming limitations. + /// + [Required] + [DataMember(Order = 1, Name = "name"), JsonPropertyOrder(1), JsonPropertyName("name"), YamlMember(Order = 1, Alias = "name")] + public virtual string? Name { get; set; } + + /// + /// Gets/sets an object used to configure the SNS topic ordering + /// + [DataMember(Order = 2, Name = "ordering"), JsonPropertyOrder(2), JsonPropertyName("ordering"), YamlMember(Order = 2, Alias = "ordering")] + public virtual SnsTopicOrderingDefinition? Ordering { get; set; } + + /// + /// Gets/sets an object used to configure the SNS topic security + /// + [DataMember(Order = 3, Name = "policy"), JsonPropertyOrder(3), JsonPropertyName("policy"), YamlMember(Order = 3, Alias = "policy")] + public virtual SnsTopicSecurityPolicyDefinition? Policy { get; set; } + + /// + /// Gets key-value pairs that represent AWS tags on the topic. + /// + [DataMember(Order = 4, Name = "tags"), JsonPropertyOrder(4), JsonPropertyName("tags"), YamlMember(Order = 4, Alias = "tags")] + public virtual EquatableDictionary? Tags { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 5, Name = "bindingVersion"), JsonPropertyOrder(5), JsonPropertyName("bindingVersion"), YamlMember(Order = 5, Alias = "bindingVersion")] + public virtual string? BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumer.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumer.cs new file mode 100644 index 0000000..607851d --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumer.cs @@ -0,0 +1,73 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents an object used to configure an SNS consumer +/// +[DataContract] +public record SnsConsumer +{ + + /// + /// Gets/sets the protocol that this endpoint receives messages by. Can be http, https, email, email-json, sms, sqs, application, lambda or firehose + /// + [Required] + [DataMember(Order = 1, Name = "protocol"), JsonPropertyOrder(1), JsonPropertyName("protocol"), YamlMember(Order = 1, Alias = "protocol")] + public virtual SnsProtocol Protocol { get; set; } + + /// + /// Gets/sets the endpoint messages are delivered to. + /// + [Required] + [DataMember(Order = 2, Name = "endpoint"), JsonPropertyOrder(2), JsonPropertyName("endpoint"), YamlMember(Order = 2, Alias = "endpoint")] + public virtual SnsIdentifier Endpoint { get; set; } = null!; + + /// + /// Gets/sets the policy used to configure the subset of messages to receive from the channel + /// + [DataMember(Order = 3, Name = "filterPolicy"), JsonPropertyOrder(3), JsonPropertyName("filterPolicy"), YamlMember(Order = 3, Alias = "filterPolicy")] + public virtual object? FilterPolicy { get; set; } + + /// + /// Gets/sets a value that determines whether the FilterPolicy applies to MessageAttributes (default) or MessageBody. + /// + [DataMember(Order = 4, Name = "filterPolicyScope"), JsonPropertyOrder(4), JsonPropertyName("filterPolicyScope"), YamlMember(Order = 4, Alias = "filterPolicyScope")] + public virtual SnsConsumerFilterPolicyScope FilterPolicyScope { get; set; } = SnsConsumerFilterPolicyScope.MessageAttributes; + + /// + /// Gets/sets a value used to configure whether or not to support raw message delivery. If true AWS SNS attributes are removed from the body, and for SQS, SNS message attributes are copied to SQS message attributes. If false the SNS attributes are included in the body. + /// + [DataMember(Order = 5, Name = "rawMessageDelivery"), JsonPropertyOrder(5), JsonPropertyName("rawMessageDelivery"), YamlMember(Order = 5, Alias = "rawMessageDelivery")] + public virtual bool RawMessageDelivery { get; set; } + + /// + /// Gets/sets an object used to configure the consumer's redrive policy. Prevents poison pill messages by moving un-processable messages to an SQS dead letter queue. + /// + [DataMember(Order = 6, Name = "redrivePolicy"), JsonPropertyOrder(6), JsonPropertyName("redrivePolicy"), YamlMember(Order = 6, Alias = "redrivePolicy")] + public virtual SnsConsumerRedrivePolicy? RedrivePolicy { get; set; } + + /// + /// Gets/sets the policy for retries to HTTP. The parameter is for that SNS Subscription and overrides any policy on the SNS Topic. + /// + [DataMember(Order = 7, Name = "deliveryPolicy"), JsonPropertyOrder(7), JsonPropertyName("deliveryPolicy"), YamlMember(Order = 7, Alias = "deliveryPolicy")] + public virtual SnsConsumerDeliveryPolicy? DeliveryPolicy { get; set; } + + /// + /// Gets/sets the display name to use with an SMS subscription + /// + [DataMember(Order = 8, Name = "displayName"), JsonPropertyOrder(8), JsonPropertyName("displayName"), YamlMember(Order = 8, Alias = "displayName")] + public virtual string? DisplayName { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerDeliveryPolicy.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerDeliveryPolicy.cs new file mode 100644 index 0000000..00d51fc --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerDeliveryPolicy.cs @@ -0,0 +1,71 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents an object used to configure an SNS consumer's delivery policy +/// +[DataContract] +public record SnsConsumerDeliveryPolicy +{ + + /// + /// Gets/sets the minimum delay for a retry in seconds + /// + [DataMember(Order = 1, Name = "minDelayTarget"), JsonPropertyOrder(1), JsonPropertyName("minDelayTarget"), YamlMember(Order = 1, Alias = "minDelayTarget")] + public virtual int? MinDelayTarget { get; set; } + + /// + /// Gets/sets the minimum delay for a retry in seconds + /// + [DataMember(Order = 2, Name = "maxDelayTarget"), JsonPropertyOrder(2), JsonPropertyName("maxDelayTarget"), YamlMember(Order = 2, Alias = "maxDelayTarget")] + public virtual int? MaxDelayTarget { get; set; } + + /// + /// Gets/sets the total number of retries, including immediate, pre-backoff, backoff, and post-backoff retries + /// + [DataMember(Order = 3, Name = "numRetries"), JsonPropertyOrder(3), JsonPropertyName("numRetries"), YamlMember(Order = 3, Alias = "numRetries")] + public virtual int? NumRetries { get; set; } + + /// + /// Gets/sets the number of immediate retries (with no delay) + /// + [DataMember(Order = 4, Name = "numNoDelayRetries"), JsonPropertyOrder(4), JsonPropertyName("numNoDelayRetries"), YamlMember(Order = 4, Alias = "numNoDelayRetries")] + public virtual int? NumNoDelayRetries { get; set; } + + /// + /// Gets/sets the number of immediate retries (with delay) + /// + [DataMember(Order = 5, Name = "numMinDelayRetries"), JsonPropertyOrder(5), JsonPropertyName("numMinDelayRetries"), YamlMember(Order = 5, Alias = "numMinDelayRetries")] + public virtual int? NumMinDelayRetries { get; set; } + + /// + /// Gets/sets the number of post-backoff phase retries, with the maximum delay between retries + /// + [DataMember(Order = 6, Name = "numMaxDelayRetries"), JsonPropertyOrder(6), JsonPropertyName("numMaxDelayRetries"), YamlMember(Order = 6, Alias = "numMaxDelayRetries")] + public virtual int? NumMaxDelayRetries { get; set; } + + /// + /// Gets/sets the algorithm for backoff between retries + /// + [DataMember(Order = 7, Name = "backoffFunction"), JsonPropertyOrder(7), JsonPropertyName("backoffFunction"), YamlMember(Order = 7, Alias = "backoffFunction")] + public virtual SnsBackoffAlgorithm? BackoffFunction { get; set; } + + /// + /// Gets/sets the maximum number of deliveries per second, per subscription + /// + [DataMember(Order = 8, Name = "maxReceivesPerSecond"), JsonPropertyOrder(8), JsonPropertyName("maxReceivesPerSecond"), YamlMember(Order = 8, Alias = "maxReceivesPerSecond")] + public virtual int? maxReceivesPerSecond { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerFilterPolicyScope.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerFilterPolicyScope.cs new file mode 100644 index 0000000..926a7c0 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerFilterPolicyScope.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Enumerates all supported SNS consumer filter policy scopes +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SnsConsumerFilterPolicyScope +{ + /// + /// Indicates that the filter policy applies to the message attributes + /// + [EnumMember(Value = "MessageAttributes")] + MessageAttributes = 0, + /// + /// Indicates that the filter policy applies to the message body + /// + [EnumMember(Value = "MessageBody")] + MessageBody = 1 +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerRedrivePolicy.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerRedrivePolicy.cs new file mode 100644 index 0000000..81978bc --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsConsumerRedrivePolicy.cs @@ -0,0 +1,38 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents an object used to configure an SNS consumer's redrive policy +/// +[DataContract] +public record SnsConsumerRedrivePolicy +{ + + /// + /// Gets/sets the SQS queue to use as a dead letter queue (DLQ). + /// Note that you may have a Redrive Policy to put messages that cannot be delivered to an SQS queue, even if you use another protocol to consume messages from the queue, so it is defined at the level of the SNS Operation Binding Object in a Consumer Object (and is applied as part of an SNS Subscription). + /// The SQS Binding describes how to define an SQS Binding that supports defining the target SQS of the Redrive Policy. + /// + [Required] + [DataMember(Order = 1, Name = "deadLetterQueue"), JsonPropertyOrder(1), JsonPropertyName("deadLetterQueue"), YamlMember(Order = 1, Alias = "deadLetterQueue")] + public virtual SnsIdentifier DeadLetterQueue { get; set; } = null!; + + /// + /// Gets/sets the number of times a message is delivered to the source queue before being moved to the dead-letter queue. Defaults to 10. + /// + [DataMember(Order = 2, Name = "maxReceiveCount"), JsonPropertyOrder(2), JsonPropertyName("maxReceiveCount"), YamlMember(Order = 2, Alias = "maxReceiveCount")] + public virtual int MaxReceiveCount { get; set; } = 10; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsIdentifier.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsIdentifier.cs new file mode 100644 index 0000000..979ad28 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsIdentifier.cs @@ -0,0 +1,53 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents an object used to configure an SNS identifier +/// +[DataContract] +public record SnsIdentifier +{ + + /// + /// Gets/sets the endpoint's URL + /// + [DataMember(Order = 1, Name = "url"), JsonPropertyOrder(1), JsonPropertyName("url"), YamlMember(Order = 1, Alias = "url")] + public virtual Uri? Url { get; set; } + + /// + /// Gets/sets the endpoint's email + /// + [DataMember(Order = 2, Name = "email"), JsonPropertyOrder(2), JsonPropertyName("email"), YamlMember(Order = 2, Alias = "email")] + public virtual string? Email { get; set; } + + /// + /// Gets/sets the endpoint's phone number + /// + [DataMember(Order = 3, Name = "phone"), JsonPropertyOrder(3), JsonPropertyName("phone"), YamlMember(Order = 3, Alias = "phone")] + public virtual string? Phone { get; set; } + + /// + /// Gets/sets the endpoint's arn + /// + [DataMember(Order = 4, Name = "arn"), JsonPropertyOrder(4), JsonPropertyName("arn"), YamlMember(Order = 4, Alias = "arn")] + public virtual string? Arn { get; set; } + + /// + /// Gets/sets the endpoint's name + /// + [DataMember(Order = 5, Name = "name"), JsonPropertyOrder(5), JsonPropertyName("name"), YamlMember(Order = 5, Alias = "name")] + public virtual string? Name { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsMessageBindingDefinition.cs new file mode 100644 index 0000000..6296ac7 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsMessageBindingDefinition.cs @@ -0,0 +1,25 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents the object used to configure a SNS message binding +/// +[DataContract] +public record SnsMessageBindingDefinition + : SnsBindingDefinition, IMessageBindingDefinition +{ + + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsOperationBindingDefinition.cs new file mode 100644 index 0000000..1a209ba --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsOperationBindingDefinition.cs @@ -0,0 +1,49 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents the object used to configure a SNS operation binding +/// +[DataContract] +public record SnsOperationBindingDefinition + : SnsBindingDefinition, IOperationBindingDefinition +{ + + /// + /// Gets/sets the SNS Topic, which can often be assumed to be the channel name. The field is provided in case you need to supply the ARN, or the Topic name when it is not the equal to the channel name in the AsyncAPI document. + /// + [DataMember(Order = 1, Name = "topic"), JsonPropertyOrder(1), JsonPropertyName("topic"), YamlMember(Order = 1, Alias = "topic")] + public virtual SnsIdentifier? Topic { get; set; } + + /// + /// Gets/sets the protocols that listen to this topic and their endpoints. + /// + [Required, MinLength(1)] + [DataMember(Order = 2, Name = "consumers"), JsonPropertyOrder(2), JsonPropertyName("consumers"), YamlMember(Order = 2, Alias = "consumers")] + public virtual EquatableList Consumers { get; set; } = []; + + /// + /// Gets/sets the policy for retries to HTTP. The field is the default for HTTP receivers of the SNS Topic which may be overridden by a specific consumer.olicy for retries to HTTP. The field is the default for HTTP receivers of the SNS Topic which may be overridden by a specific consumer. + /// + [DataMember(Order = 3, Name = "deliveryPolicy"), JsonPropertyOrder(3), JsonPropertyName("deliveryPolicy"), YamlMember(Order = 3, Alias = "deliveryPolicy")] + public virtual SnsConsumerDeliveryPolicy? DeliveryPolicy { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 4, Name = "bindingVersion"), JsonPropertyOrder(4), JsonPropertyName("bindingVersion"), YamlMember(Order = 4, Alias = "bindingVersion")] + public virtual string? BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsProtocol.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsProtocol.cs new file mode 100644 index 0000000..7a39578 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsProtocol.cs @@ -0,0 +1,71 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Enumerates all supported SNS protocols +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SnsProtocol +{ + /// + /// Indicates the http protocol + /// + [EnumMember(Value = "http")] + Http, + /// + /// Indicates the https protocol + /// + [EnumMember(Value = "https")] + Https, + /// + /// Indicates the email protocol + /// + [EnumMember(Value = "email")] + Email, + /// + /// Indicates the email JSON protocol + /// + [EnumMember(Value = "email-json")] + EmailJson, + /// + /// Indicates the SMS protocol + /// + [EnumMember(Value = "sms")] + Sms, + /// + /// Indicates the SQS protocol + /// + [EnumMember(Value = "sqs")] + Sqs, + /// + /// Indicates the application protocol + /// + [EnumMember(Value = "application")] + Application, + /// + /// Indicates the lambda protocol + /// + [EnumMember(Value = "lambda")] + Lambda, + /// + /// Indicates the firehose protocol + /// + [EnumMember(Value = "firehose")] + Firehose +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsServerBindingDefinition.cs new file mode 100644 index 0000000..2db47b2 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsServerBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents the object used to configure a SNS server binding +/// +[DataContract] +public record SnsServerBindingDefinition + : SnsBindingDefinition, IServerBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicOrderingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicOrderingDefinition.cs new file mode 100644 index 0000000..de788eb --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicOrderingDefinition.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents an object used to configure topic ordering on an SNS channel +/// +[DataContract] +public record SnsTopicOrderingDefinition +{ + + /// + /// Gets/sets the type of SNS Topic. Can be either standard or FIFO. + /// + [Required] + [DataMember(Order = 1, Name = "type"), JsonPropertyOrder(1), JsonPropertyName("type"), YamlMember(Order = 1, Alias = "type")] + public virtual SnsTopicOrderingType Type { get; set; } + + /// + /// Gets/sets ta boolean indicating whether the de-duplication of messages should be turned on. Defaults to false. + /// + [DataMember(Order = 2, Name = "contentBasedDeduplication"), JsonPropertyOrder(2), JsonPropertyName("contentBasedDeduplication"), YamlMember(Order = 2, Alias = "contentBasedDeduplication")] + public virtual bool ContentBasedDeduplication { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicOrderingType.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicOrderingType.cs new file mode 100644 index 0000000..c4866e2 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicOrderingType.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Enumerates all supported SNS topic ordering types +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SnsTopicOrderingType +{ + /// + /// Indicates a standard SNS topic + /// + [EnumMember(Value = "standard")] + Standard, + /// + /// Indicates a FIFO SNS topic + /// + [EnumMember(Value = "FIFO")] + Fifo +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityPolicyDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityPolicyDefinition.cs new file mode 100644 index 0000000..b6f11ce --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityPolicyDefinition.cs @@ -0,0 +1,30 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents an object used to configure topic security on an SNS channel +/// +[DataContract] +public record SnsTopicSecurityPolicyDefinition +{ + + /// + /// Gets/sets the type of SNS Topic. Can be either standard or FIFO. + /// + [Required, MinLength(1)] + [DataMember(Order = 1, Name = "statements"), JsonPropertyOrder(1), JsonPropertyName("statements"), YamlMember(Order = 1, Alias = "statements")] + public virtual EquatableList Statements { get; set; } = []; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityStatementDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityStatementDefinition.cs new file mode 100644 index 0000000..392fee4 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityStatementDefinition.cs @@ -0,0 +1,41 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Represents an object used to configure an SNS topic security statement +/// +[DataContract] +public record SnsTopicSecurityStatementDefinition +{ + + /// + /// Gets/sets the type of SNS Topic. Can be either standard or FIFO. + /// + [DataMember(Order = 1, Name = "effect"), JsonPropertyOrder(1), JsonPropertyName("effect"), YamlMember(Order = 1, Alias = "effect")] + public virtual SnsTopicSecurityStatementEffect Effect { get; set; } + + /// + /// Gets/sets the AWS account or resource ARN that this statement applies to. Can be a string or a list of string. + /// + [DataMember(Order = 2, Name = "principal"), JsonPropertyOrder(2), JsonPropertyName("principal"), YamlMember(Order = 2, Alias = "principal")] + public virtual object? Principal { get; set; } + + /// + /// Gets/sets the SNS permission being allowed or denied e.g. sns:Publish. Can be a string or a list of string. + /// + [DataMember(Order = 3, Name = "action"), JsonPropertyOrder(3), JsonPropertyName("action"), YamlMember(Order = 3, Alias = "action")] + public virtual object? Action { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityStatementEffect.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityStatementEffect.cs new file mode 100644 index 0000000..3fddd76 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sns/SnsTopicSecurityStatementEffect.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sns; + +/// +/// Enumerates all supported SNS topic security statement effects +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SnsTopicSecurityStatementEffect +{ + /// + /// Indicates a statement that allows the configured principal(s) and/or action(s) + /// + [EnumMember(Value = "allow")] + Allow = 0, + /// + /// Indicates a statement that denies the configured principal(s) and/or action(s) + /// + [EnumMember(Value = "deny")] + Deny = 1 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceBindingDefinition.cs new file mode 100644 index 0000000..82597ae --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents the base record for all Solace implementations of the interface +/// +[DataContract] +public abstract record SolaceBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.Solace; + } + } + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceChannelBindingDefinition.cs new file mode 100644 index 0000000..f232353 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceChannelBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents the object used to configure a Solace channel binding +/// +[DataContract] +public record SolaceChannelBindingDefinition + : SolaceBindingDefinition, IChannelBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDeliveryMode.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDeliveryMode.cs new file mode 100644 index 0000000..8efd4f7 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDeliveryMode.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Enumerates all supported Solace delivery modes +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SolaceDeliveryMode +{ + /// + /// Indicates the persistent delivery mode + /// + [EnumMember(Value = "persistent")] + Persistent = 0, + /// + /// Indicates a direct delivery mode + /// + [EnumMember(Value = "direct")] + Direct = 1 +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDestinationDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDestinationDefinition.cs new file mode 100644 index 0000000..640b88e --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDestinationDefinition.cs @@ -0,0 +1,53 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents an object used to configure a Solace destination +/// +[DataContract] +public record SolaceDestinationDefinition +{ + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 1, Name = "bindingVersion"), JsonPropertyOrder(1), JsonPropertyName("bindingVersion"), YamlMember(Order = 1, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "0.4.0"; + + /// + /// Gets/sets the destination's type. + /// + [DataMember(Order = 2, Name = "destinationType"), JsonPropertyOrder(2), JsonPropertyName("destinationType"), YamlMember(Order = 2, Alias = "destinationType")] + public virtual SolaceDestinationType DestinationType { get; set; } + + /// + /// Gets/sets the destination's delivery mode. + /// + [DataMember(Order = 3, Name = "deliveryMode"), JsonPropertyOrder(3), JsonPropertyName("deliveryMode"), YamlMember(Order = 3, Alias = "deliveryMode")] + public virtual SolaceDeliveryMode DeliveryMode { get; set; } + + /// + /// Gets/sets an object used to configure the destination's queue, in case the destination type has been set to 'queue'. + /// + [DataMember(Order = 4, Name = "queue"), JsonPropertyOrder(4), JsonPropertyName("queue"), YamlMember(Order = 4, Alias = "queue")] + public virtual SolaceQueueDefinition? Queue { get; set; } + + /// + /// Gets/sets an object used to configure the destination's topic, in case the destination type has been set to 'topic'. + /// + [DataMember(Order = 5, Name = "topic"), JsonPropertyOrder(5), JsonPropertyName("topic"), YamlMember(Order = 5, Alias = "topic")] + public virtual SolaceQueueDefinition? Topic { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDestinationType.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDestinationType.cs new file mode 100644 index 0000000..a65ce83 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceDestinationType.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Enumerates all types of Solace destinations +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SolaceDestinationType +{ + /// + /// Indicates a queue, which in turn will subscribe to the topic as represented by the channel name + /// + [EnumMember(Value = "queue")] + Queue = 0, + /// + /// Indicates a topic + /// + [EnumMember(Value = "topic")] + Topic = 1 +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceMessageBindingDefinition.cs new file mode 100644 index 0000000..21cbd59 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceMessageBindingDefinition.cs @@ -0,0 +1,25 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents the object used to configure a JMS message binding +/// +[DataContract] +public record SolaceMessageBindingDefinition + : SolaceBindingDefinition, IMessageBindingDefinition +{ + + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceOperationBindingDefinition.cs new file mode 100644 index 0000000..8324ec4 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceOperationBindingDefinition.cs @@ -0,0 +1,54 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents the object used to configure a JMS operation binding +/// +[DataContract] +public record SolaceOperationBindingDefinition + : SolaceBindingDefinition, IOperationBindingDefinition +{ + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 1, Name = "bindingVersion"), JsonPropertyOrder(1), JsonPropertyName("bindingVersion"), YamlMember(Order = 1, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "0.4.0"; + + /// + /// Gets/sets a list of the destinations to use. + /// + [DataMember(Order = 2, Name = "destinations"), JsonPropertyOrder(2), JsonPropertyName("destinations"), YamlMember(Order = 2, Alias = "destinations")] + public virtual EquatableList? Destinations { get; set; } + + /// + /// Gets/sets the destination's time to live. Can be a integer representing the interval in milliseconds, a schema or reference. + /// + [DataMember(Order = 3, Name = "timeToLive"), JsonPropertyOrder(3), JsonPropertyName("timeToLive"), YamlMember(Order = 3, Alias = "timeToLive")] + public virtual object? TimeToLive { get; set; } + + /// + /// Gets/sets the destination's priority. Can be a integer between 0-255 with 0 as the lowest priority and 255 as the highest, a schema or reference. + /// + [DataMember(Order = 4, Name = "priority"), JsonPropertyOrder(4), JsonPropertyName("priority"), YamlMember(Order = 4, Alias = "priority")] + public virtual object? Priority { get; set; } + + /// + /// Gets/sets a boolean indicating whether or not the operation messages are eligible to be moved to a Dead Message Queue. + /// + [DataMember(Order = 5, Name = "dmqEligible"), JsonPropertyOrder(5), JsonPropertyName("dmqEligible"), YamlMember(Order = 5, Alias = "dmqEligible")] + public virtual bool DmqEligible { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceQueueAccessType.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceQueueAccessType.cs new file mode 100644 index 0000000..76b41eb --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceQueueAccessType.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Enumerates all supported Solace queue access types +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SolaceQueueAccessType +{ + /// + /// Indicates an exclusive queue access + /// + [EnumMember(Value = "exclusive")] + Exclusive = 0, + /// + /// Indicates a non-exclusive queue access + /// + [EnumMember(Value = "nonexclusive")] + NonExclusive = 1 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceQueueDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceQueueDefinition.cs new file mode 100644 index 0000000..51bb935 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceQueueDefinition.cs @@ -0,0 +1,53 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents an object used to configure a Solace queue +/// +[DataContract] +public record SolaceQueueDefinition +{ + + /// + /// Gets/sets the name of the queue. + /// + [DataMember(Order = 1, Name = "name"), JsonPropertyOrder(1), JsonPropertyName("name"), YamlMember(Order = 1, Alias = "name")] + public virtual string? Name { get; set; } + + /// + /// Gets/sets a list of topics that the queue subscribes to. If none is given, the queue subscribes to the topic as represented by the channel name. + /// + [DataMember(Order = 2, Name = "topicSubscriptions"), JsonPropertyOrder(2), JsonPropertyName("topicSubscriptions"), YamlMember(Order = 2, Alias = "topicSubscriptions")] + public virtual EquatableList? TopicSubscriptions { get; set; } + + /// + /// Gets/sets the queue's access type. + /// + [DataMember(Order = 3, Name = "accessType"), JsonPropertyOrder(3), JsonPropertyName("accessType"), YamlMember(Order = 3, Alias = "accessType")] + public virtual SolaceQueueAccessType AccessType { get; set; } + + /// + /// Gets/sets the maximum amount of message spool that the given queue may use. + /// + [DataMember(Order = 4, Name = "maxMsgSpoolSize"), JsonPropertyOrder(4), JsonPropertyName("maxMsgSpoolSize"), YamlMember(Order = 4, Alias = "maxMsgSpoolSize")] + public virtual string? MaxMsgSpoolSize { get; set; } + + /// + /// Gets/sets the maximum TTL to apply to messages to be spooled. This is documented here. + /// + [DataMember(Order = 5, Name = "maxTtl"), JsonPropertyOrder(5), JsonPropertyName("maxTtl"), YamlMember(Order = 5, Alias = "maxTtl")] + public virtual string? MaxTtl { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceServerBindingDefinition.cs new file mode 100644 index 0000000..8a24a01 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceServerBindingDefinition.cs @@ -0,0 +1,43 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents the object used to configure a JMS server binding +/// +[DataContract] +public record SolaceServerBindingDefinition + : SolaceBindingDefinition, IServerBindingDefinition +{ + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 1, Name = "bindingVersion"), JsonPropertyOrder(1), JsonPropertyName("bindingVersion"), YamlMember(Order = 1, Alias = "bindingVersion")] + public virtual string BindingVersion { get; set; } = "0.4.0"; + + /// + /// Gets/sets the Virtual Private Network name on the Solace broker. + /// + [Required] + [DataMember(Order = 2, Name = "msgVpn"), JsonPropertyOrder(2), JsonPropertyName("msgVpn"), YamlMember(Order = 2, Alias = "msgVpn")] + public virtual string MsgVpn { get; set; } = null!; + + /// + /// Gets/sets a unique client name to use to register to the appliance. If specified, it must be a valid Topic name, and a maximum of 160 bytes in length when encoded as UTF-8. + /// + [DataMember(Order = 3, Name = "clientName"), JsonPropertyOrder(3), JsonPropertyName("clientName"), YamlMember(Order = 3, Alias = "clientName")] + public virtual string? ClientName { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceTopicDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceTopicDefinition.cs new file mode 100644 index 0000000..1578dab --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Solace/SolaceTopicDefinition.cs @@ -0,0 +1,29 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Solace; + +/// +/// Represents an object used to configure a Solace topic +/// +[DataContract] +public record SolaceTopicDefinition +{ + + /// + /// Gets/sets a list of topics that the client subscribes to. If none is given, the client subscribes to the topic as represented by the channel name. + /// + [DataMember(Order = 1, Name = "topicSubscriptions"), JsonPropertyOrder(1), JsonPropertyName("topicSubscriptions"), YamlMember(Order = 1, Alias = "topicSubscriptions")] + public virtual EquatableList? TopicSubscriptions { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsBindingDefinition.cs new file mode 100644 index 0000000..05d9ace --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents the base record for all SQS implementations of the interface +/// +[DataContract] +public abstract record SqsBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.Sqs; + } + } + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsChannelBindingDefinition.cs new file mode 100644 index 0000000..2fe3a87 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsChannelBindingDefinition.cs @@ -0,0 +1,44 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents the object used to configure a SQS channel binding +/// +[DataContract] +public record SqsChannelBindingDefinition + : SqsBindingDefinition, IChannelBindingDefinition +{ + + /// + /// Gets/sets a definition of the queue that will be used as the channel. + /// + [Required] + [DataMember(Order = 1, Name = "queue"), JsonPropertyOrder(1), JsonPropertyName("queue"), YamlMember(Order = 1, Alias = "queue")] + public virtual SqsQueueDefinition Queue { get; set; } = null!; + + /// + /// Gets/sets a definition of the queue, if any, that will be used for un-processable messages. + /// + [Required] + [DataMember(Order = 2, Name = "deadLetterQueue"), JsonPropertyOrder(2), JsonPropertyName("deadLetterQueue"), YamlMember(Order = 2, Alias = "deadLetterQueue")] + public virtual SqsQueueDefinition? DeadLetterQueue { get; set; } + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 3, Name = "bindingVersion"), JsonPropertyOrder(3), JsonPropertyName("bindingVersion"), YamlMember(Order = 3, Alias = "bindingVersion")] + public virtual string? BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsDeduplicationScope.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsDeduplicationScope.cs new file mode 100644 index 0000000..1c4aa52 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsDeduplicationScope.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Enumerates all supported SQS deduplication scopes +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SqsDeduplicationScope +{ + /// + /// Indicates that message deduplication occurs at the message group level + /// + [EnumMember(Value = "messageGroup")] + MessageGroup = 1, + /// + /// Indicates that message deduplication occurs at the queue level + /// v + [EnumMember(Value = "queue")] + Queue = 2 +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsFifoThroughputLimit.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsFifoThroughputLimit.cs new file mode 100644 index 0000000..d3dc753 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsFifoThroughputLimit.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Enumerates all supported SQS FIFO throughput limits +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SqsFifoThroughputLimit +{ + /// + /// Indicates a per queue throughput limit + /// + [EnumMember(Value = "perQueue")] + PerQueue = 1, + /// + /// Indicates a per message group id throughput limit + /// + [EnumMember(Value = "perMessageGroupId")] + PerMessageGroupId = 2 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsIdentifier.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsIdentifier.cs new file mode 100644 index 0000000..cda862a --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsIdentifier.cs @@ -0,0 +1,35 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents an SQS identifier +/// +[DataContract] +public record SqsIdentifier +{ + + /// + /// Gets/sets the endpoint's arn + /// + [DataMember(Order = 1, Name = "arn"), JsonPropertyOrder(1), JsonPropertyName("arn"), YamlMember(Order = 1, Alias = "arn")] + public virtual string? Arn { get; set; } + + /// + /// Gets/sets the endpoint's name + /// + [DataMember(Order = 2, Name = "name"), JsonPropertyOrder(2), JsonPropertyName("name"), YamlMember(Order = 2, Alias = "name")] + public virtual string? Name { get; set; } + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsMessageBindingDefinition.cs new file mode 100644 index 0000000..6035597 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsMessageBindingDefinition.cs @@ -0,0 +1,25 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents the object used to configure a SQS message binding +/// +[DataContract] +public record SqsMessageBindingDefinition + : SqsBindingDefinition, IMessageBindingDefinition +{ + + +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsOperationBindingDefinition.cs new file mode 100644 index 0000000..972eaf0 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsOperationBindingDefinition.cs @@ -0,0 +1,37 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents the object used to configure a SQS operation binding +/// +[DataContract] +public record SqsOperationBindingDefinition + : SqsBindingDefinition, IOperationBindingDefinition +{ + + /// + /// Gets/sets the queues that are either the endpoint for an SNS Operation Binding Object, or the deadLetterQueue of the SQS Operation Binding Object + /// + [Required, MinLength(1)] + [DataMember(Order = 1, Name = "queues"), JsonPropertyOrder(1), JsonPropertyName("queues"), YamlMember(Order = 1, Alias = "queues")] + public virtual EquatableList Queues { get; set; } = []; + + /// + /// Gets/sets the version of this binding. + /// + [DataMember(Order = 2, Name = "bindingVersion"), JsonPropertyOrder(2), JsonPropertyName("bindingVersion"), YamlMember(Order = 2, Alias = "bindingVersion")] + public virtual string? BindingVersion { get; set; } = "latest"; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueDefinition.cs new file mode 100644 index 0000000..1e67bfc --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueDefinition.cs @@ -0,0 +1,90 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents the object used to configure an SQS queue +/// +[DataContract] +public record SqsQueueDefinition +{ + + /// + /// Gets/sets the name of the queue. When an SNS Operation Binding Object references an SQS queue by name, the identifier should be the one in this field. + /// + [Required] + [DataMember(Order = 1, Name = "name"), JsonPropertyOrder(1), JsonPropertyName("name"), YamlMember(Order = 1, Alias = "name")] + public virtual string Name { get; set; } = null!; + + /// + /// Gets/sets a boolean indicating whether or not the queue is a FIFO queue. + /// + [DataMember(Order = 2, Name = "fifoQueue"), JsonPropertyOrder(2), JsonPropertyName("fifoQueue"), YamlMember(Order = 2, Alias = "fifoQueue")] + public virtual bool FifoQueue { get; set; } + + /// + /// Gets/sets the queue's deduplication scope + /// + [DataMember(Order = 3, Name = "deduplicationScope"), JsonPropertyOrder(3), JsonPropertyName("deduplicationScope"), YamlMember(Order = 3, Alias = "deduplicationScope")] + public virtual SqsDeduplicationScope? DeduplicationScope { get; set; } + + /// + /// Gets/sets a value indicating whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are perQueue and perMessageGroupId. The perMessageGroupId value is allowed only when the value for DeduplicationScope is messageGroup. Setting both these values as such will enable high throughput on a FIFO queue. As above, this property applies only to high throughput for FIFO queues. + /// + [DataMember(Order = 4, Name = "fifoThroughputLimit"), JsonPropertyOrder(4), JsonPropertyName("fifoThroughputLimit"), YamlMember(Order = 4, Alias = "fifoThroughputLimit")] + public virtual SqsFifoThroughputLimit? FifoThroughputLimit { get; set; } + + /// + /// Gets/sets the number of seconds to delay before a message sent to the queue can be received. Used to create a delay queue. Range is 0 to 15 minutes. Defaults to 0. + /// + [DataMember(Order = 5, Name = "deliveryDelay"), JsonPropertyOrder(5), JsonPropertyName("deliveryDelay"), YamlMember(Order = 5, Alias = "deliveryDelay")] + public virtual int DeliveryDelay { get; set; } = 0; + + /// + /// Gets/sets the length of time, in seconds, that a consumer locks a message - hiding it from reads - before it is unlocked and can be read again. Range from 0 to 12 hours (43200 seconds). Defaults to 30 seconds. + /// + [DataMember(Order = 6, Name = "visibilityTimeout"), JsonPropertyOrder(6), JsonPropertyName("visibilityTimeout"), YamlMember(Order = 6, Alias = "visibilityTimeout")] + public virtual int? VisibilityTimeout { get; set; } + + /// + /// Gets/sets a value that determines if the queue uses short polling or long polling. Set to zero (the default) the queue reads available messages and returns immediately. Set to a non-zero integer, long polling waits the specified number of seconds for messages to arrive before returning. + /// + [DataMember(Order = 7, Name = "receiveMessageWaitTime"), JsonPropertyOrder(7), JsonPropertyName("receiveMessageWaitTime"), YamlMember(Order = 7, Alias = "receiveMessageWaitTime")] + public virtual int? ReceiveMessageWaitTime { get; set; } + + /// + /// Gets/sets a value that determines how long to retain a message on the queue in seconds, unless deleted. The range is 60 (1 minute) to 1,209,600 (14 days). The default is 345,600 (4 days). long to retain a message on the queue in seconds, unless deleted. The range is 60 (1 minute) to 1,209,600 (14 days). The default is 345,600 (4 days). + /// + [DataMember(Order = 8, Name = "messageRetentionPeriod"), JsonPropertyOrder(8), JsonPropertyName("messageRetentionPeriod"), YamlMember(Order = 8, Alias = "messageRetentionPeriod")] + public virtual int? MessageRetentionPeriod { get; set; } + + /// + /// Gets/sets an object used to configure the queue's redrive policy + /// + [DataMember(Order = 9, Name = "redrivePolicy"), JsonPropertyOrder(9), JsonPropertyName("redrivePolicy"), YamlMember(Order = 9, Alias = "redrivePolicy")] + public virtual SqsQueueRedrivePolicyDefinition? RedrivePolicy { get; set; } + + /// + /// Gets/sets an object used to configure the queue's security policy + /// + [DataMember(Order = 10, Name = "policy"), JsonPropertyOrder(10), JsonPropertyName("policy"), YamlMember(Order = 10, Alias = "policy")] + public virtual SqsQueueSecurityPolicyDefinition? Policy { get; set; } + + /// + /// Gets/sets a key/value mapping of the queue's AWS tags, if any + /// + [DataMember(Order = 11, Name = "tags"), JsonPropertyOrder(11), JsonPropertyName("tags"), YamlMember(Order = 11, Alias = "tags")] + public virtual EquatableDictionary? Tags { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueRedrivePolicyDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueRedrivePolicyDefinition.cs new file mode 100644 index 0000000..c8b7d6d --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueRedrivePolicyDefinition.cs @@ -0,0 +1,38 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.AsyncApi.v2.Bindings.Sns; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents an object used to configure the redrive policy of an SQS queue +/// +[DataContract] +public record SqsQueueRedrivePolicyDefinition +{ + + /// + /// Gets/sets the SQS queue to use as a dead letter queue (DLQ). + /// + [Required] + [DataMember(Order = 1, Name = "deadLetterQueue"), JsonPropertyOrder(1), JsonPropertyName("deadLetterQueue"), YamlMember(Order = 1, Alias = "deadLetterQueue")] + public virtual SnsIdentifier DeadLetterQueue { get; set; } = null!; + + /// + /// Gets/sets the number of times a message is delivered to the source queue before being moved to the dead-letter queue. Default is 10. + /// + [DataMember(Order = 2, Name = "maxReceiveCount"), JsonPropertyOrder(2), JsonPropertyName("maxReceiveCount"), YamlMember(Order = 2, Alias = "maxReceiveCount")] + public virtual int MaxReceiveCount { get; set; } = 10; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueSecurityPolicyDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueSecurityPolicyDefinition.cs new file mode 100644 index 0000000..515289b --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsQueueSecurityPolicyDefinition.cs @@ -0,0 +1,30 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents an object used to configure the security policy of an SQS queue +/// +[DataContract] +public record SqsQueueSecurityPolicyDefinition +{ + + /// + /// Gets/sets the statements that each controls a permission for this queue. + /// + [Required, MinLength(1)] + [DataMember(Order = 1, Name = "statements"), JsonPropertyOrder(1), JsonPropertyName("statements"), YamlMember(Order = 1, Alias = "statements")] + public virtual EquatableList Statements { get; set; } = []; + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsServerBindingDefinition.cs new file mode 100644 index 0000000..4908c85 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsServerBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents the object used to configure a SQS server binding +/// +[DataContract] +public record SqsServerBindingDefinition + : SqsBindingDefinition, IServerBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsTopicSecurityStatementDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsTopicSecurityStatementDefinition.cs new file mode 100644 index 0000000..36b58e1 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsTopicSecurityStatementDefinition.cs @@ -0,0 +1,41 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Represents an object used to configure an SQS topic security statement +/// +[DataContract] +public record SqsTopicSecurityStatementDefinition +{ + + /// + /// Gets/sets the type of SQS Topic. Can be either standard or FIFO. + /// + [DataMember(Order = 1, Name = "effect"), JsonPropertyOrder(1), JsonPropertyName("effect"), YamlMember(Order = 1, Alias = "effect")] + public virtual SqsTopicSecurityStatementEffect Effect { get; set; } + + /// + /// Gets/sets the AWS account or resource ARN that this statement applies to. Can be a string or a list of string. + /// + [DataMember(Order = 2, Name = "principal"), JsonPropertyOrder(2), JsonPropertyName("principal"), YamlMember(Order = 2, Alias = "principal")] + public virtual object? Principal { get; set; } + + /// + /// Gets/sets the SQS permission being allowed or denied e.g. sns:Publish. Can be a string or a list of string. + /// + [DataMember(Order = 3, Name = "action"), JsonPropertyOrder(3), JsonPropertyName("action"), YamlMember(Order = 3, Alias = "action")] + public virtual object? Action { get; set; } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsTopicSecurityStatementEffect.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsTopicSecurityStatementEffect.cs new file mode 100644 index 0000000..3b8397b --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Sqs/SqsTopicSecurityStatementEffect.cs @@ -0,0 +1,36 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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. + +using Neuroglia.Serialization.Json.Converters; +using System.ComponentModel; + +namespace Neuroglia.AsyncApi.v2.Bindings.Sqs; + +/// +/// Enumerates all supported SNS topic security statement effects +/// +[JsonConverter(typeof(StringEnumConverter))] +[TypeConverter(typeof(EnumMemberTypeConverter))] +public enum SqsTopicSecurityStatementEffect +{ + /// + /// Indicates a statement that allows the configured principal(s) and/or action(s) + /// + [EnumMember(Value = "allow")] + Allow = 0, + /// + /// Indicates a statement that denies the configured principal(s) and/or action(s) + /// + [EnumMember(Value = "deny")] + Deny = 1 +} \ No newline at end of file diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompBindingDefinition.cs new file mode 100644 index 0000000..477744e --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompBindingDefinition.cs @@ -0,0 +1,34 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Stomp; + +/// +/// Represents the base record for all STOMP implementations of the interface +/// +[DataContract] +public abstract record StompBindingDefinition + : IBindingDefinition +{ + + /// + [IgnoreDataMember, JsonIgnore, YamlIgnore] + public IEnumerable Protocols + { + get + { + yield return AsyncApiProtocol.Stomp; + } + } + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompChannelBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompChannelBindingDefinition.cs new file mode 100644 index 0000000..1e2cffe --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompChannelBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Stomp; + +/// +/// Represents the object used to configure a STOMP channel binding +/// +[DataContract] +public record StompChannelBindingDefinition + : StompBindingDefinition, IChannelBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompMessageBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompMessageBindingDefinition.cs new file mode 100644 index 0000000..f201efa --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompMessageBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Stomp; + +/// +/// Represents the object used to configure a STOMP message binding +/// +[DataContract] +public record StompMessageBindingDefinition + : StompBindingDefinition, IMessageBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompOperationBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompOperationBindingDefinition.cs new file mode 100644 index 0000000..52c16eb --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompOperationBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Stomp; + +/// +/// Represents the object used to configure a STOMP operation binding +/// +[DataContract] +public record StompOperationBindingDefinition + : StompBindingDefinition, IOperationBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompServerBindingDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompServerBindingDefinition.cs new file mode 100644 index 0000000..2f32cb8 --- /dev/null +++ b/src/Neuroglia.AsyncApi.Core/v2/Bindings/Stomp/StompServerBindingDefinition.cs @@ -0,0 +1,26 @@ +// Copyright © 2021-Present Neuroglia SRL. All rights reserved. +// +// 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 Neuroglia.AsyncApi.v2.Bindings.Stomp; + +/// +/// Represents the object used to configure a STOMP server binding +/// +[DataContract] +public record StompServerBindingDefinition + : StompBindingDefinition, IServerBindingDefinition +{ + + + +} diff --git a/src/Neuroglia.AsyncApi.Core/v2/ComponentDefinitionCollection.cs b/src/Neuroglia.AsyncApi.Core/v2/ComponentDefinitionCollection.cs index 5b4ddee..b0276d8 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/ComponentDefinitionCollection.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/ComponentDefinitionCollection.cs @@ -85,9 +85,9 @@ public record ComponentDefinitionCollection public virtual EquatableDictionary? OperationBindings { get; set; } /// - /// Gets/sets a used to hold reusable s + /// Gets/sets a used to hold reusable s /// [DataMember(Order = 11, Name = "messageBindings"), JsonPropertyOrder(11), JsonPropertyName("messageBindings"), YamlMember(Order = 11, Alias = "messageBindings")] - public virtual EquatableDictionary? MessageBindings { get; set; } + public virtual EquatableDictionary? MessageBindings { get; set; } } diff --git a/src/Neuroglia.AsyncApi.Core/v2/MessageTraitDefinition.cs b/src/Neuroglia.AsyncApi.Core/v2/MessageTraitDefinition.cs index d925e9d..1506199 100644 --- a/src/Neuroglia.AsyncApi.Core/v2/MessageTraitDefinition.cs +++ b/src/Neuroglia.AsyncApi.Core/v2/MessageTraitDefinition.cs @@ -90,7 +90,7 @@ public record MessageTraitDefinition /// Gets/sets an object used to configure the 's s /// [DataMember(Order = 11, Name = "bindings"), JsonPropertyOrder(11), JsonPropertyName("bindings"), YamlMember(Order = 11, Alias = "bindings")] - public virtual MessageBindingCollection? Bindings { get; set; } + public virtual MessageBindingDefinitionCollection? Bindings { get; set; } /// /// Gets/sets an where keys MUST be either headers and/or payload. diff --git a/src/Neuroglia.AsyncApi.DependencyInjectionExtensions/Neuroglia.AsyncApi.DependencyInjectionExtensions.csproj b/src/Neuroglia.AsyncApi.DependencyInjectionExtensions/Neuroglia.AsyncApi.DependencyInjectionExtensions.csproj index 2225260..dca18c6 100644 --- a/src/Neuroglia.AsyncApi.DependencyInjectionExtensions/Neuroglia.AsyncApi.DependencyInjectionExtensions.csproj +++ b/src/Neuroglia.AsyncApi.DependencyInjectionExtensions/Neuroglia.AsyncApi.DependencyInjectionExtensions.csproj @@ -11,7 +11,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api dependency injection di extensions - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.FluentBuilders/AsyncApiDocumentBuilder.cs b/src/Neuroglia.AsyncApi.FluentBuilders/AsyncApiDocumentBuilder.cs index b07d841..a5d7673 100644 --- a/src/Neuroglia.AsyncApi.FluentBuilders/AsyncApiDocumentBuilder.cs +++ b/src/Neuroglia.AsyncApi.FluentBuilders/AsyncApiDocumentBuilder.cs @@ -325,7 +325,7 @@ public virtual IAsyncApiDocumentBuilder WithOperationBindingComponent(string nam } /// - public virtual IAsyncApiDocumentBuilder WithMessageBindingComponent(string name, MessageBindingCollection bindings) + public virtual IAsyncApiDocumentBuilder WithMessageBindingComponent(string name, MessageBindingDefinitionCollection bindings) { if (string.IsNullOrWhiteSpace(name))throw new ArgumentNullException(nameof(name)); ArgumentNullException.ThrowIfNull(bindings); diff --git a/src/Neuroglia.AsyncApi.FluentBuilders/Interfaces/IAsyncApiDocumentBuilder.cs b/src/Neuroglia.AsyncApi.FluentBuilders/Interfaces/IAsyncApiDocumentBuilder.cs index ca8b36e..600184d 100644 --- a/src/Neuroglia.AsyncApi.FluentBuilders/Interfaces/IAsyncApiDocumentBuilder.cs +++ b/src/Neuroglia.AsyncApi.FluentBuilders/Interfaces/IAsyncApiDocumentBuilder.cs @@ -240,12 +240,12 @@ public interface IAsyncApiDocumentBuilder IAsyncApiDocumentBuilder WithOperationBindingComponent(string name, OperationBindingDefinitionCollection bindings); /// - /// Adds the specified + /// Adds the specified /// - /// The name of the to add - /// The to add + /// The name of the to add + /// The to add /// The configured - IAsyncApiDocumentBuilder WithMessageBindingComponent(string name, MessageBindingCollection bindings); + IAsyncApiDocumentBuilder WithMessageBindingComponent(string name, MessageBindingDefinitionCollection bindings); /// /// Builds a new diff --git a/src/Neuroglia.AsyncApi.FluentBuilders/Neuroglia.AsyncApi.FluentBuilders.csproj b/src/Neuroglia.AsyncApi.FluentBuilders/Neuroglia.AsyncApi.FluentBuilders.csproj index f87386f..2487f96 100644 --- a/src/Neuroglia.AsyncApi.FluentBuilders/Neuroglia.AsyncApi.FluentBuilders.csproj +++ b/src/Neuroglia.AsyncApi.FluentBuilders/Neuroglia.AsyncApi.FluentBuilders.csproj @@ -11,7 +11,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api fluent builders - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.Generation/AsyncApiDocumentGenerator.cs b/src/Neuroglia.AsyncApi.Generation/AsyncApiDocumentGenerator.cs index af682a1..420c701 100644 --- a/src/Neuroglia.AsyncApi.Generation/AsyncApiDocumentGenerator.cs +++ b/src/Neuroglia.AsyncApi.Generation/AsyncApiDocumentGenerator.cs @@ -143,7 +143,7 @@ protected virtual void ConfigureOperationMessageFor(IMessageDefinitionBuilder me JsonSchema messageSchema; if (messageType == null) { - if (parameters.Length == 1) + if (parameters.Length == 1 || parameters.Length == 2 && parameters[1].ParameterType == typeof(CancellationToken)) { messageType = parameters.First().ParameterType; messageSchema = new JsonSchemaBuilder().FromType(parameters.First().ParameterType, JsonSchemaGeneratorConfiguration.Default); @@ -156,6 +156,7 @@ protected virtual void ConfigureOperationMessageFor(IMessageDefinitionBuilder me messageType = typeof(object); foreach (var parameter in parameters) { + if (parameter.TryGetCustomAttribute(out _)) continue; var parameterSchema = messageSchemaBuilder.FromType(parameter.ParameterType, JsonSchemaGeneratorConfiguration.Default); messageSchemaProperties.Add(parameter.Name!, parameterSchema); if (parameter.TryGetCustomAttribute(out _)|| !parameter.ParameterType.IsNullable()|| parameter.DefaultValue == DBNull.Value) requiredProperties.Add(parameter.Name!); diff --git a/src/Neuroglia.AsyncApi.Generation/Neuroglia.AsyncApi.Generation.csproj b/src/Neuroglia.AsyncApi.Generation/Neuroglia.AsyncApi.Generation.csproj index b40e096..3501ba7 100644 --- a/src/Neuroglia.AsyncApi.Generation/Neuroglia.AsyncApi.Generation.csproj +++ b/src/Neuroglia.AsyncApi.Generation/Neuroglia.AsyncApi.Generation.csproj @@ -11,7 +11,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api generation - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.IO/Neuroglia.AsyncApi.IO.csproj b/src/Neuroglia.AsyncApi.IO/Neuroglia.AsyncApi.IO.csproj index 9cf3bcf..5b9426a 100644 --- a/src/Neuroglia.AsyncApi.IO/Neuroglia.AsyncApi.IO.csproj +++ b/src/Neuroglia.AsyncApi.IO/Neuroglia.AsyncApi.IO.csproj @@ -11,7 +11,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api io - 2.6.5 + 2.6.6 en Apache-2.0 true diff --git a/src/Neuroglia.AsyncApi.Validation/Neuroglia.AsyncApi.Validation.csproj b/src/Neuroglia.AsyncApi.Validation/Neuroglia.AsyncApi.Validation.csproj index db55270..b34aade 100644 --- a/src/Neuroglia.AsyncApi.Validation/Neuroglia.AsyncApi.Validation.csproj +++ b/src/Neuroglia.AsyncApi.Validation/Neuroglia.AsyncApi.Validation.csproj @@ -11,7 +11,7 @@ https://github.com/neuroglia-io/asyncapi git neuroglia asyncapi async api validation - 2.6.5 + 2.6.6 en Apache-2.0 true