-
Notifications
You must be signed in to change notification settings - Fork 18
feat(bindings): add SNS AWS bindings #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
578e237
feat: WIP Add sns channel bindings
861ee6f
feat!: separate bindings and allow for custom bindings. (#107)
VisualBean 222ad97
chore: add readme.md to bindings pack
VisualBean 44354de
feat: WIP bring in line with new bindings wf
d856ccc
feat: WIP fix file overwrite
1fac669
feat: WIP further attempts at serde
0edd5c9
feat: WIP fix typo
e7bc0df
feat: WIP more node work
980bf81
feat: WIP switch to display enum
8221472
feat: WIP fixed lists
ab5550f
feat: WIP fix write issues
286e64d
feat: WIP remove commented function
b8aceea
feat: WIP Complete SNS body
d0f0ceb
feat: WIP finish SNS channel binding
41ea55d
feat: WIP Add basic SNS operation serialization
11755d5
refactor: binding improvement
VisualBean 9c0f0c6
Merge branch 'main' into feat-add-sns-aws-bindings
33769c3
feat: WIP Add sns op fix fields
6a9266f
feat: WIP Add correct required properties
6bcf4e2
feat: WIP remove constants
b4d3a56
feat: WIP move to block scoped namespaces
0e1a445
ci: pull_request_target
VisualBean 2690f4c
ci: add build and test run for forks (#110)
VisualBean a7c3305
Merge branch 'main' into feat-add-sns-aws-bindings
VisualBean b244161
ci: delete new workflow
VisualBean 7f10a91
Merge branch 'main' into feat-add-sns-aws-bindings
VisualBean eedb2fa
fix: update AsyncApiTextReader class name (#109)
gokerakc e948e3d
Merge branch 'main' into feat-add-sns-aws-bindings
dpwdec 21caee9
feat: fix identifier fixed fields bug
e120788
feat: correct type property to be required
783a1d2
feat: rename ordering to match spec
e01e26c
chore: add bindings to labeler
VisualBean 30b87fb
test: add 'any' example
VisualBean 7a28082
Merge remote-tracking branch 'origin/main' into main
VisualBean a09cdac
Merge branch 'main' into feat-add-sns-aws-bindings
dpwdec 2277518
feat: add any filter policy handling
ce6d084
feat: correct policy effect casing
55f22bd
feat: use write any
b589e4f
feat!: separate bindings and allow for custom bindings. (#107)
VisualBean d242484
ci: force pre-releases
VisualBean 2e4bf25
chore: update readme with pre-release shields
VisualBean 79f11a8
sync changes
b4f8cb1
feat: sync with main
2c934e7
feat: update nested extensible objects and tests
4a2386a
Merge branch 'main' of github.com:dpwdec/AsyncAPI.NET into main
ea82b09
Merge branch 'main' into feat-add-sns-aws-bindings
VisualBean bbf391d
feat: merge main
6c4b0da
feat: integrate StringOrStringList to SNS
cd94f2c
feat: reformat files
8a7befe
feat: integrate remote changes
8f08e2b
feat: update consumer description wording
57e16d9
Merge branch 'main' into feat-add-sns-aws-bindings
dpwdec da4e8d6
feat: match wording to spec
c17f85b
Merge remote-tracking branch 'origin/feat-add-sns-aws-bindings' into …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| namespace LEGO.AsyncAPI.Bindings.Sns | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using LEGO.AsyncAPI.Attributes; | ||
| using LEGO.AsyncAPI.Models.Interfaces; | ||
| using LEGO.AsyncAPI.Writers; | ||
|
|
||
| public class Consumer : IAsyncApiExtensible | ||
| { | ||
| /// <summary> | ||
| /// The protocol that this endpoint will receive messages by. | ||
| /// </summary> | ||
| public Protocol Protocol { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The endpoint messages are delivered to. | ||
| /// </summary> | ||
| public Identifier Endpoint { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Only receive a subset of messages from the channel, determined by this policy. | ||
| /// </summary> | ||
| public FilterPolicy FilterPolicy { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 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. | ||
| /// </summary> | ||
| public bool RawMessageDelivery { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue. | ||
| /// </summary> | ||
| public RedrivePolicy RedrivePolicy { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Policy for retries to HTTP. The parameter is for that SNS Subscription and overrides any policy on the SNS Topic. | ||
| /// </summary> | ||
| public DeliveryPolicy DeliveryPolicy { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The display name to use with an SNS subscription. | ||
| /// </summary> | ||
| public string DisplayName { get; set; } | ||
|
|
||
| public IDictionary<string, IAsyncApiExtension> Extensions { get; set; } = new Dictionary<string, IAsyncApiExtension>(); | ||
|
|
||
| public void Serialize(IAsyncApiWriter writer) | ||
| { | ||
| if (writer is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(writer)); | ||
| } | ||
|
|
||
| writer.WriteStartObject(); | ||
| writer.WriteRequiredProperty("protocol", this.Protocol.GetDisplayName()); | ||
| writer.WriteRequiredObject("endpoint", this.Endpoint, (w, e) => e.Serialize(w)); | ||
| writer.WriteOptionalObject("filterPolicy", this.FilterPolicy, (w, f) => f.Serialize(w)); | ||
| writer.WriteRequiredProperty("rawMessageDelivery", this.RawMessageDelivery); | ||
| writer.WriteOptionalObject("redrivePolicy", this.RedrivePolicy, (w, p) => p.Serialize(w)); | ||
| writer.WriteOptionalObject("deliveryPolicy", this.DeliveryPolicy, (w, p) => p.Serialize(w)); | ||
| writer.WriteOptionalProperty("displayName", this.DisplayName); | ||
| writer.WriteExtensions(this.Extensions); | ||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
|
|
||
| public enum Protocol | ||
| { | ||
| [Display("http")] Http, | ||
| [Display("https")] Https, | ||
| [Display("email")] Email, | ||
| [Display("email-json")] EmailJson, | ||
| [Display("sms")] Sms, | ||
| [Display("sqs")] Sqs, | ||
| [Display("application")] Application, | ||
| [Display("lambda")] Lambda, | ||
| [Display("firehose")] Firehose, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| namespace LEGO.AsyncAPI.Bindings.Sns | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using LEGO.AsyncAPI.Attributes; | ||
| using LEGO.AsyncAPI.Models.Interfaces; | ||
| using LEGO.AsyncAPI.Writers; | ||
|
|
||
| public class DeliveryPolicy : IAsyncApiExtensible | ||
| { | ||
| /// <summary> | ||
| /// The minimum delay for a retry in seconds. | ||
| /// </summary> | ||
| public int? MinDelayTarget { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The maximum delay for a retry in seconds. | ||
| /// </summary> | ||
| public int? MaxDelayTarget { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The total number of retries, including immediate, pre-backoff, backoff, and post-backoff retries. | ||
| /// </summary> | ||
| public int? NumRetries { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The number of immediate retries (with no delay). | ||
| /// </summary> | ||
| public int? NumNoDelayRetries { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The number of immediate retries (with delay). | ||
| /// </summary> | ||
| public int? NumMinDelayRetries { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The number of post-backoff phase retries, with the maximum delay between retries. | ||
| /// </summary> | ||
| public int? NumMaxDelayRetries { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The algorithm for backoff between retries. | ||
| /// </summary> | ||
| public BackoffFunction BackoffFunction { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The maximum number of deliveries per second, per subscription. | ||
| /// </summary> | ||
| public int? MaxReceivesPerSecond { get; set; } | ||
|
|
||
| public IDictionary<string, IAsyncApiExtension> Extensions { get; set; } = new Dictionary<string, IAsyncApiExtension>(); | ||
|
|
||
| public void Serialize(IAsyncApiWriter writer) | ||
| { | ||
| if (writer is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(writer)); | ||
| } | ||
|
|
||
| writer.WriteStartObject(); | ||
| writer.WriteOptionalProperty("minDelayTarget", this.MinDelayTarget); | ||
| writer.WriteOptionalProperty("maxDelayTarget", this.MaxDelayTarget); | ||
| writer.WriteOptionalProperty("numRetries", this.NumRetries); | ||
| writer.WriteOptionalProperty("numNoDelayRetries", this.NumNoDelayRetries); | ||
| writer.WriteOptionalProperty("numMinDelayRetries", this.NumMinDelayRetries); | ||
| writer.WriteOptionalProperty("numMaxDelayRetries", this.NumMaxDelayRetries); | ||
| writer.WriteOptionalProperty("backoffFunction", this.BackoffFunction.GetDisplayName()); | ||
| writer.WriteOptionalProperty("maxReceivesPerSecond", this.MaxReceivesPerSecond); | ||
| writer.WriteExtensions(this.Extensions); | ||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
|
|
||
| public enum BackoffFunction | ||
| { | ||
| [Display("arithmetic")] Arithmetic, | ||
| [Display("exponential")] Exponential, | ||
| [Display("geometric")] Geometric, | ||
| [Display("linear")] Linear, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| namespace LEGO.AsyncAPI.Bindings.Sns | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using LEGO.AsyncAPI.Models.Interfaces; | ||
| using LEGO.AsyncAPI.Writers; | ||
|
|
||
| public class FilterPolicy : IAsyncApiExtensible | ||
| { | ||
| /// <summary> | ||
| /// A map of a message attribute to an array of possible matches. The match may be a simple string for an exact match, but it may also be an object that represents a constraint and values for that constraint. | ||
| /// </summary> | ||
| public IAsyncApiAny Attributes { get; set; } | ||
|
|
||
| public IDictionary<string, IAsyncApiExtension> Extensions { get; set; } = new Dictionary<string, IAsyncApiExtension>(); | ||
|
|
||
| public void Serialize(IAsyncApiWriter writer) | ||
| { | ||
| if (writer is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(writer)); | ||
| } | ||
|
|
||
| writer.WriteStartObject(); | ||
| writer.WriteRequiredObject("attributes", this.Attributes, (w, a) => w.WriteAny(a)); | ||
| writer.WriteExtensions(this.Extensions); | ||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| namespace LEGO.AsyncAPI.Bindings.Sns | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using LEGO.AsyncAPI.Models.Interfaces; | ||
| using LEGO.AsyncAPI.Writers; | ||
|
|
||
| public class Identifier : IAsyncApiExtensible | ||
| { | ||
| public string Url { get; set; } | ||
|
|
||
| public string Email { get; set; } | ||
|
|
||
| public string Phone { get; set; } | ||
|
|
||
| public string Arn { get; set; } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public IDictionary<string, IAsyncApiExtension> Extensions { get; set; } = new Dictionary<string, IAsyncApiExtension>(); | ||
|
|
||
| public void Serialize(IAsyncApiWriter writer) | ||
| { | ||
| if (writer is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(writer)); | ||
| } | ||
|
|
||
| writer.WriteStartObject(); | ||
| writer.WriteOptionalProperty("url", this.Url); | ||
| writer.WriteOptionalProperty("email", this.Email); | ||
| writer.WriteOptionalProperty("phone", this.Phone); | ||
| writer.WriteOptionalProperty("arn", this.Arn); | ||
| writer.WriteOptionalProperty("name", this.Name); | ||
| writer.WriteExtensions(this.Extensions); | ||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| namespace LEGO.AsyncAPI.Bindings.Sns | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using LEGO.AsyncAPI.Attributes; | ||
| using LEGO.AsyncAPI.Models.Interfaces; | ||
| using LEGO.AsyncAPI.Writers; | ||
|
|
||
| public class Ordering : IAsyncApiExtensible | ||
| { | ||
| /// <summary> | ||
| /// What type of SNS Topic is this? | ||
| /// </summary> | ||
| public OrderingType Type { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// True to turn on de-duplication of messages for a channel. | ||
| /// </summary> | ||
| public bool ContentBasedDeduplication { get; set; } | ||
|
|
||
| public IDictionary<string, IAsyncApiExtension> Extensions { get; set; } = new Dictionary<string, IAsyncApiExtension>(); | ||
|
|
||
| public void Serialize(IAsyncApiWriter writer) | ||
| { | ||
| if (writer is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(writer)); | ||
| } | ||
|
|
||
| writer.WriteStartObject(); | ||
| writer.WriteRequiredProperty("type", this.Type.GetDisplayName()); | ||
| writer.WriteOptionalProperty("contentBasedDeduplication", this.ContentBasedDeduplication); | ||
| writer.WriteExtensions(this.Extensions); | ||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
|
|
||
| public enum OrderingType | ||
| { | ||
| [Display("standard")] | ||
| Standard, | ||
| [Display("FIFO")] | ||
| Fifo, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| namespace LEGO.AsyncAPI.Bindings.Sns | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using LEGO.AsyncAPI.Models; | ||
| using LEGO.AsyncAPI.Models.Interfaces; | ||
| using LEGO.AsyncAPI.Writers; | ||
|
|
||
| public class Policy : IAsyncApiExtensible | ||
| { | ||
| /// <summary> | ||
| /// An array of statement objects, each of which controls a permission for this topic. | ||
| /// </summary> | ||
| public List<Statement> Statements { get; set; } | ||
|
|
||
| public IDictionary<string, IAsyncApiExtension> Extensions { get; set; } = new Dictionary<string, IAsyncApiExtension>(); | ||
|
|
||
| public void Serialize(IAsyncApiWriter writer) | ||
| { | ||
| if (writer is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(writer)); | ||
| } | ||
|
|
||
| writer.WriteStartObject(); | ||
| writer.WriteOptionalCollection("statements", this.Statements, (w, t) => t.Serialize(w)); | ||
| writer.WriteExtensions(this.Extensions); | ||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| namespace LEGO.AsyncAPI.Bindings.Sns | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using LEGO.AsyncAPI.Models.Interfaces; | ||
| using LEGO.AsyncAPI.Writers; | ||
|
|
||
| public class RedrivePolicy : IAsyncApiExtensible | ||
| { | ||
| /// <summary> | ||
| /// Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue. | ||
| /// </summary> | ||
| public Identifier DeadLetterQueue { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The number of times a message is delivered to the source queue before being moved to the dead-letter queue. | ||
| /// </summary> | ||
| public int? MaxReceiveCount { get; set; } | ||
|
|
||
| public IDictionary<string, IAsyncApiExtension> Extensions { get; set; } = new Dictionary<string, IAsyncApiExtension>(); | ||
|
|
||
| public void Serialize(IAsyncApiWriter writer) | ||
| { | ||
| if (writer is null) | ||
| { | ||
| throw new ArgumentNullException(nameof(writer)); | ||
| } | ||
|
|
||
| writer.WriteStartObject(); | ||
| writer.WriteRequiredObject("deadLetterQueue", this.DeadLetterQueue, (w, q) => q.Serialize(w)); | ||
| writer.WriteOptionalProperty("maxReceiveCount", this.MaxReceiveCount); | ||
| writer.WriteExtensions(this.Extensions); | ||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put a question in the sns binding PR to get clarification.
But if it's how it is, in the binding it should be Any type, of string, array or object. Which could be solved with a validation rule.
ReadAny exists but is probably still internal in the readers project.