From 2feba21c5826a765ff4ea75af1928418344c9b75 Mon Sep 17 00:00:00 2001 From: "adam.gloyne" Date: Wed, 26 Jun 2024 15:59:03 +0100 Subject: [PATCH 1/5] feat: extend aws policy configuration --- bindings/sns/0.1.0/channel.json | 58 +++++++++++++++++++++++++++++++ bindings/sqs/0.2.0/channel.json | 58 +++++++++++++++++++++++++++++++ bindings/sqs/0.2.0/operation.json | 58 +++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+) diff --git a/bindings/sns/0.1.0/channel.json b/bindings/sns/0.1.0/channel.json index 552b63e0..4a7e0cb8 100644 --- a/bindings/sns/0.1.0/channel.json +++ b/bindings/sns/0.1.0/channel.json @@ -108,6 +108,24 @@ "items": { "type": "string" } + }, + { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } } ] }, @@ -124,6 +142,46 @@ } } ] + }, + "resource": { + "description": "The resource that this policy applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "condition": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + } } }, "required": [ diff --git a/bindings/sqs/0.2.0/channel.json b/bindings/sqs/0.2.0/channel.json index 91431157..353a1d20 100644 --- a/bindings/sqs/0.2.0/channel.json +++ b/bindings/sqs/0.2.0/channel.json @@ -193,6 +193,24 @@ "items": { "type": "string" } + }, + { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } } ] }, @@ -209,6 +227,46 @@ } } ] + }, + "resource": { + "description": "The resource that this policy applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "condition": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + } } }, "required": [ diff --git a/bindings/sqs/0.2.0/operation.json b/bindings/sqs/0.2.0/operation.json index f25d4423..6f4bc3c6 100644 --- a/bindings/sqs/0.2.0/operation.json +++ b/bindings/sqs/0.2.0/operation.json @@ -195,6 +195,24 @@ "items": { "type": "string" } + }, + { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } } ] }, @@ -211,6 +229,46 @@ } } ] + }, + "resource": { + "description": "The resource that this policy applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "condition": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + } } }, "required": [ From 3723ae977cfb32528bd9cd05b7214993ce46388a Mon Sep 17 00:00:00 2001 From: "adam.gloyne" Date: Wed, 26 Jun 2024 16:05:31 +0100 Subject: [PATCH 2/5] update descriptions --- bindings/sns/0.1.0/channel.json | 7 ++++--- bindings/sqs/0.2.0/channel.json | 7 ++++--- bindings/sqs/0.2.0/operation.json | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bindings/sns/0.1.0/channel.json b/bindings/sns/0.1.0/channel.json index 4a7e0cb8..9d60d81d 100644 --- a/bindings/sns/0.1.0/channel.json +++ b/bindings/sns/0.1.0/channel.json @@ -98,7 +98,7 @@ ] }, "principal": { - "description": "The AWS account or resource ARN that this statement applies to.", + "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", "oneOf": [ { "type": "string" @@ -130,7 +130,7 @@ ] }, "action": { - "description": "The SNS permission being allowed or denied e.g. sns:Publish", + "description": "The SNS permission(s) being allowed or denied e.g. sns:Publish", "oneOf": [ { "type": "string" @@ -144,7 +144,7 @@ ] }, "resource": { - "description": "The resource that this policy applies to.", + "description": "The resource(s) that this policy applies to.", "oneOf": [ { "type": "string" @@ -158,6 +158,7 @@ ] }, "condition": { + "description": "Specific circumstances under which the policy grants permission", "type": "object", "patternProperties": { ".*": { diff --git a/bindings/sqs/0.2.0/channel.json b/bindings/sqs/0.2.0/channel.json index 353a1d20..8e0679a4 100644 --- a/bindings/sqs/0.2.0/channel.json +++ b/bindings/sqs/0.2.0/channel.json @@ -183,7 +183,7 @@ ] }, "principal": { - "description": "The AWS account or resource ARN that this statement applies to.", + "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", "oneOf": [ { "type": "string" @@ -215,7 +215,7 @@ ] }, "action": { - "description": "The SQS permission being allowed or denied e.g. sqs:ReceiveMessage", + "description": "The SQS permission(s) being allowed or denied e.g. sqs:ReceiveMessage", "oneOf": [ { "type": "string" @@ -229,7 +229,7 @@ ] }, "resource": { - "description": "The resource that this policy applies to.", + "description": "The resource(s) that this policy applies to.", "oneOf": [ { "type": "string" @@ -243,6 +243,7 @@ ] }, "condition": { + "description": "Specific circumstances under which the policy grants permission", "type": "object", "patternProperties": { ".*": { diff --git a/bindings/sqs/0.2.0/operation.json b/bindings/sqs/0.2.0/operation.json index 6f4bc3c6..b6a4aed4 100644 --- a/bindings/sqs/0.2.0/operation.json +++ b/bindings/sqs/0.2.0/operation.json @@ -185,7 +185,7 @@ ] }, "principal": { - "description": "The AWS account or resource ARN that this statement applies to.", + "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", "oneOf": [ { "type": "string" @@ -217,7 +217,7 @@ ] }, "action": { - "description": "The SQS permission being allowed or denied e.g. sqs:ReceiveMessage", + "description": "The SQS permission(s) being allowed or denied e.g. sqs:ReceiveMessage", "oneOf": [ { "type": "string" @@ -231,7 +231,7 @@ ] }, "resource": { - "description": "The resource that this policy applies to.", + "description": "The resource(s) that this policy applies to.", "oneOf": [ { "type": "string" @@ -245,6 +245,7 @@ ] }, "condition": { + "description": "Specific circumstances under which the policy grants permission", "type": "object", "patternProperties": { ".*": { From ff59ac95ef6587665ad5c4834a0ae8b565cdeb0f Mon Sep 17 00:00:00 2001 From: "adam.gloyne" Date: Thu, 27 Jun 2024 14:58:41 +0100 Subject: [PATCH 3/5] use new version --- bindings/sns/0.1.0/channel.json | 63 +----- bindings/sns/0.2.0/channel.json | 200 +++++++++++++++++++ bindings/sns/0.2.0/operation.json | 273 ++++++++++++++++++++++++++ bindings/sqs/0.2.0/channel.json | 63 +----- bindings/sqs/0.2.0/operation.json | 63 +----- bindings/sqs/0.3.0/channel.json | 314 ++++++++++++++++++++++++++++++ bindings/sqs/0.3.0/operation.json | 308 +++++++++++++++++++++++++++++ 7 files changed, 1101 insertions(+), 183 deletions(-) create mode 100644 bindings/sns/0.2.0/channel.json create mode 100644 bindings/sns/0.2.0/operation.json create mode 100644 bindings/sqs/0.3.0/channel.json create mode 100644 bindings/sqs/0.3.0/operation.json diff --git a/bindings/sns/0.1.0/channel.json b/bindings/sns/0.1.0/channel.json index 9d60d81d..552b63e0 100644 --- a/bindings/sns/0.1.0/channel.json +++ b/bindings/sns/0.1.0/channel.json @@ -98,7 +98,7 @@ ] }, "principal": { - "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", + "description": "The AWS account or resource ARN that this statement applies to.", "oneOf": [ { "type": "string" @@ -108,43 +108,11 @@ "items": { "type": "string" } - }, - { - "type": "object", - "patternProperties": { - ".*": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - } } ] }, "action": { - "description": "The SNS permission(s) being allowed or denied e.g. sns:Publish", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "resource": { - "description": "The resource(s) that this policy applies to.", + "description": "The SNS permission being allowed or denied e.g. sns:Publish", "oneOf": [ { "type": "string" @@ -156,33 +124,6 @@ } } ] - }, - "condition": { - "description": "Specific circumstances under which the policy grants permission", - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "patternProperties": { - ".*": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - } - } - } } }, "required": [ diff --git a/bindings/sns/0.2.0/channel.json b/bindings/sns/0.2.0/channel.json new file mode 100644 index 00000000..fa3e4c40 --- /dev/null +++ b/bindings/sns/0.2.0/channel.json @@ -0,0 +1,200 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/bindings/sns/0.1.0/channel.json", + "title": "Channel Schema", + "description": "This object contains information about the channel representation in SNS.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "name": { + "type": "string", + "description": "The name of the topic. Can be different from the channel name to allow flexibility around AWS resource naming limitations." + }, + "ordering": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/channel.json#/definitions/ordering" + }, + "policy": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/channel.json#/definitions/policy" + }, + "tags": { + "type": "object", + "description": "Key-value pairs that represent AWS tags on the topic." + }, + "bindingVersion": { + "type": "string", + "description": "The version of this binding.", + "default": "latest" + } + }, + "required": [ + "name" + ], + "definitions": { + "ordering": { + "type": "object", + "description": "By default, we assume an unordered SNS topic. This field allows configuration of a FIFO SNS Topic.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "type": { + "type": "string", + "description": "Defines the type of SNS Topic.", + "enum": [ + "standard", + "FIFO" + ] + }, + "contentBasedDeduplication": { + "type": "boolean", + "description": "True to turn on de-duplication of messages for a channel." + } + }, + "required": [ + "type" + ] + }, + "policy": { + "type": "object", + "description": "The security policy for the SNS Topic.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "statements": { + "type": "array", + "description": "An array of statement objects, each of which controls a permission for this topic", + "items": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/channel.json#/definitions/statement" + } + } + }, + "required": [ + "statements" + ] + }, + "statement": { + "type": "object", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "effect": { + "type": "string", + "enum": [ + "Allow", + "Deny" + ] + }, + "principal": { + "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + ] + }, + "action": { + "description": "The SNS permission(s) being allowed or denied e.g. sns:Publish", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "resource": { + "description": "The resource(s) that this policy applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "condition": { + "description": "Specific circumstances under which the policy grants permission", + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + } + } + }, + "required": [ + "effect", + "principal", + "action" + ] + } + }, + "examples": [ + { + "name": "my-sns-topic", + "policy": { + "statements": [ + { + "effect": "Allow", + "principal": "*", + "action": "SNS:Publish" + } + ] + } + } + ] +} diff --git a/bindings/sns/0.2.0/operation.json b/bindings/sns/0.2.0/operation.json new file mode 100644 index 00000000..4c890902 --- /dev/null +++ b/bindings/sns/0.2.0/operation.json @@ -0,0 +1,273 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/bindings/sns/0.1.0/operation.json", + "title": "Operation Schema", + "description": "This object contains information about the operation representation in SNS.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "topic": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/identifier", + "description": "Often we can assume that the SNS Topic is the channel name-we provide this field in case the you need to supply the ARN, or the Topic name is not the channel name in the AsyncAPI document." + }, + "consumers": { + "type": "array", + "description": "The protocols that listen to this topic and their endpoints.", + "items": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/consumer" + }, + "minItems": 1 + }, + "deliveryPolicy": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/deliveryPolicy", + "description": "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." + }, + "bindingVersion": { + "type": "string", + "description": "The version of this binding.", + "default": "latest" + } + }, + "required": [ + "consumers" + ], + "definitions": { + "identifier": { + "type": "object", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "url": { + "type": "string", + "description": "The endpoint is a URL." + }, + "email": { + "type": "string", + "description": "The endpoint is an email address." + }, + "phone": { + "type": "string", + "description": "The endpoint is a phone number." + }, + "arn": { + "type": "string", + "description": "The target is an ARN. For example, for SQS, the identifier may be an ARN, which will be of the form: arn:aws:sqs:{region}:{account-id}:{queueName}" + }, + "name": { + "type": "string", + "description": "The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this publish Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field sqs binding. We don't use $ref because we are referring, not including." + } + } + }, + "consumer": { + "type": "object", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "protocol": { + "description": "The protocol that this endpoint receives messages by.", + "type": "string", + "enum": [ + "http", + "https", + "email", + "email-json", + "sms", + "sqs", + "application", + "lambda", + "firehose" + ] + }, + "endpoint": { + "description": "The endpoint messages are delivered to.", + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/identifier" + }, + "filterPolicy": { + "type": "object", + "description": "Only receive a subset of messages from the channel, determined by this policy. Depending on the FilterPolicyScope, a map of either a message attribute or message body 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.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "additionalProperties": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + }, + { + "type": "object" + } + ] + } + }, + "filterPolicyScope": { + "type": "string", + "description": "Determines whether the FilterPolicy applies to MessageAttributes or MessageBody.", + "enum": [ + "MessageAttributes", + "MessageBody" + ], + "default": "MessageAttributes" + }, + "rawMessageDelivery": { + "type": "boolean", + "description": "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." + }, + "redrivePolicy": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/redrivePolicy" + }, + "deliveryPolicy": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/deliveryPolicy", + "description": "Policy for retries to HTTP. The parameter is for that SNS Subscription and overrides any policy on the SNS Topic." + }, + "displayName": { + "type": "string", + "description": "The display name to use with an SNS subscription" + } + }, + "required": [ + "protocol", + "endpoint", + "rawMessageDelivery" + ] + }, + "deliveryPolicy": { + "type": "object", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "minDelayTarget": { + "type": "integer", + "description": "The minimum delay for a retry in seconds." + }, + "maxDelayTarget": { + "type": "integer", + "description": "The maximum delay for a retry in seconds." + }, + "numRetries": { + "type": "integer", + "description": "The total number of retries, including immediate, pre-backoff, backoff, and post-backoff retries." + }, + "numNoDelayRetries": { + "type": "integer", + "description": "The number of immediate retries (with no delay)." + }, + "numMinDelayRetries": { + "type": "integer", + "description": "The number of immediate retries (with delay)." + }, + "numMaxDelayRetries": { + "type": "integer", + "description": "The number of post-backoff phase retries, with the maximum delay between retries." + }, + "backoffFunction": { + "type": "string", + "description": "The algorithm for backoff between retries.", + "enum": [ + "arithmetic", + "exponential", + "geometric", + "linear" + ] + }, + "maxReceivesPerSecond": { + "type": "integer", + "description": "The maximum number of deliveries per second, per subscription." + } + } + }, + "redrivePolicy": { + "type": "object", + "description": "Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "deadLetterQueue": { + "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/identifier", + "description": "The SQS queue to use as a dead letter queue (DLQ)." + }, + "maxReceiveCount": { + "type": "integer", + "description": "The number of times a message is delivered to the source queue before being moved to the dead-letter queue.", + "default": 10 + } + }, + "required": [ + "deadLetterQueue" + ] + } + }, + "examples": [ + { + "topic": { + "name": "someTopic" + }, + "consumers": [ + { + "protocol": "sqs", + "endpoint": { + "name": "someQueue" + }, + "filterPolicy": { + "store": [ + "asyncapi_corp" + ], + "event": [ + { + "anything-but": "order_cancelled" + } + ], + "customer_interests": [ + "rugby", + "football", + "baseball" + ] + }, + "filterPolicyScope": "MessageAttributes", + "rawMessageDelivery": false, + "redrivePolicy": { + "deadLetterQueue": { + "arn": "arn:aws:SQS:eu-west-1:0000000:123456789" + }, + "maxReceiveCount": 25 + }, + "deliveryPolicy": { + "minDelayTarget": 10, + "maxDelayTarget": 100, + "numRetries": 5, + "numNoDelayRetries": 2, + "numMinDelayRetries": 3, + "numMaxDelayRetries": 5, + "backoffFunction": "linear", + "maxReceivesPerSecond": 2 + } + } + ] + } + ] +} diff --git a/bindings/sqs/0.2.0/channel.json b/bindings/sqs/0.2.0/channel.json index 8e0679a4..91431157 100644 --- a/bindings/sqs/0.2.0/channel.json +++ b/bindings/sqs/0.2.0/channel.json @@ -183,7 +183,7 @@ ] }, "principal": { - "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", + "description": "The AWS account or resource ARN that this statement applies to.", "oneOf": [ { "type": "string" @@ -193,29 +193,11 @@ "items": { "type": "string" } - }, - { - "type": "object", - "patternProperties": { - ".*": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - } } ] }, "action": { - "description": "The SQS permission(s) being allowed or denied e.g. sqs:ReceiveMessage", + "description": "The SQS permission being allowed or denied e.g. sqs:ReceiveMessage", "oneOf": [ { "type": "string" @@ -227,47 +209,6 @@ } } ] - }, - "resource": { - "description": "The resource(s) that this policy applies to.", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "condition": { - "description": "Specific circumstances under which the policy grants permission", - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "patternProperties": { - ".*": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - } - } - } } }, "required": [ diff --git a/bindings/sqs/0.2.0/operation.json b/bindings/sqs/0.2.0/operation.json index b6a4aed4..f25d4423 100644 --- a/bindings/sqs/0.2.0/operation.json +++ b/bindings/sqs/0.2.0/operation.json @@ -185,7 +185,7 @@ ] }, "principal": { - "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", + "description": "The AWS account or resource ARN that this statement applies to.", "oneOf": [ { "type": "string" @@ -195,29 +195,11 @@ "items": { "type": "string" } - }, - { - "type": "object", - "patternProperties": { - ".*": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - } } ] }, "action": { - "description": "The SQS permission(s) being allowed or denied e.g. sqs:ReceiveMessage", + "description": "The SQS permission being allowed or denied e.g. sqs:ReceiveMessage", "oneOf": [ { "type": "string" @@ -229,47 +211,6 @@ } } ] - }, - "resource": { - "description": "The resource(s) that this policy applies to.", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "condition": { - "description": "Specific circumstances under which the policy grants permission", - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "patternProperties": { - ".*": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "boolean" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - } - } - } } }, "required": [ diff --git a/bindings/sqs/0.3.0/channel.json b/bindings/sqs/0.3.0/channel.json new file mode 100644 index 00000000..745e057c --- /dev/null +++ b/bindings/sqs/0.3.0/channel.json @@ -0,0 +1,314 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json", + "title": "Channel Schema", + "description": "This object contains information about the channel representation in SQS.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "queue": { + "description": "A definition of the queue that will be used as the channel.", + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/queue" + }, + "deadLetterQueue": { + "description": "A definition of the queue that will be used for un-processable messages.", + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/queue" + }, + "bindingVersion": { + "type": "string", + "enum": [ + "0.1.0", + "0.2.0" + ], + "description": "The version of this binding. If omitted, 'latest' MUST be assumed.", + "default": "latest" + } + }, + "required": [ + "queue" + ], + "definitions": { + "queue": { + "type": "object", + "description": "A definition of a queue.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "name": { + "type": "string", + "description": "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." + }, + "fifoQueue": { + "type": "boolean", + "description": "Is this a FIFO queue?", + "default": false + }, + "deduplicationScope": { + "type": "string", + "enum": ["queue", "messageGroup"], + "description": "Specifies whether message deduplication occurs at the message group or queue level. Valid values are messageGroup and queue (default).", + "default": "queue" + }, + "fifoThroughputLimit": { + "type": "string", + "enum": ["perQueue", "perMessageGroupId"], + "description": "Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are perQueue (default) and perMessageGroupId.", + "default": "perQueue" + }, + "deliveryDelay": { + "type": "integer", + "description": "The number of seconds to delay before a message sent to the queue can be received. used to create a delay queue.", + "minimum": 0, + "maximum": 15, + "default": 0 + }, + "visibilityTimeout": { + "type": "integer", + "description": "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.", + "minimum": 0, + "maximum": 43200, + "default": 30 + }, + "receiveMessageWaitTime": { + "type": "integer", + "description": "Determines if the queue uses short polling or long polling. Set to zero 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.", + "default": 0 + }, + "messageRetentionPeriod": { + "type": "integer", + "description": "How long to retain a message on the queue in seconds, unless deleted.", + "minimum": 60, + "maximum": 1209600, + "default": 345600 + }, + "redrivePolicy": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/redrivePolicy" + }, + "policy": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/policy" + }, + "tags": { + "type": "object", + "description": "Key-value pairs that represent AWS tags on the queue." + } + }, + "required": [ + "name", + "fifoQueue" + ] + }, + "redrivePolicy": { + "type": "object", + "description": "Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "deadLetterQueue": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/identifier" + }, + "maxReceiveCount": { + "type": "integer", + "description": "The number of times a message is delivered to the source queue before being moved to the dead-letter queue.", + "default": 10 + } + }, + "required": [ + "deadLetterQueue" + ] + }, + "identifier": { + "type": "object", + "description": "The SQS queue to use as a dead letter queue (DLQ).", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "arn": { + "type": "string", + "description": "The target is an ARN. For example, for SQS, the identifier may be an ARN, which will be of the form: arn:aws:sqs:{region}:{account-id}:{queueName}" + }, + "name": { + "type": "string", + "description": "The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this publish Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field sqs binding." + } + } + }, + "policy": { + "type": "object", + "description": "The security policy for the SQS Queue", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "statements": { + "type": "array", + "description": "An array of statement objects, each of which controls a permission for this queue.", + "items": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/statement" + } + } + }, + "required": [ + "statements" + ] + }, + "statement": { + "type": "object", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "effect": { + "type": "string", + "enum": [ + "Allow", + "Deny" + ] + }, + "principal": { + "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + ] + }, + "action": { + "description": "The SQS permission(s) being allowed or denied e.g. sqs:ReceiveMessage", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "resource": { + "description": "The resource(s) that this policy applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "condition": { + "description": "Specific circumstances under which the policy grants permission", + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + } + } + }, + "required": [ + "effect", + "principal", + "action" + ] + } + }, + "examples": [ + { + "queue": { + "name": "myQueue", + "fifoQueue": true, + "deduplicationScope": "messageGroup", + "fifoThroughputLimit": "perMessageGroupId", + "deliveryDelay": 15, + "visibilityTimeout": 60, + "receiveMessageWaitTime": 0, + "messageRetentionPeriod": 86400, + "redrivePolicy": { + "deadLetterQueue": { + "arn": "arn:aws:SQS:eu-west-1:0000000:123456789" + }, + "maxReceiveCount": 15 + }, + "policy": { + "statements": [ + { + "effect": "Deny", + "principal": "arn:aws:iam::123456789012:user/dec.kolakowski", + "action": [ + "sqs:SendMessage", + "sqs:ReceiveMessage" + ] + } + ] + }, + "tags": { + "owner": "AsyncAPI.NET", + "platform": "AsyncAPIOrg" + } + }, + "deadLetterQueue": { + "name": "myQueue_error", + "deliveryDelay": 0, + "visibilityTimeout": 0, + "receiveMessageWaitTime": 0, + "messageRetentionPeriod": 604800 + } + } + ] +} \ No newline at end of file diff --git a/bindings/sqs/0.3.0/operation.json b/bindings/sqs/0.3.0/operation.json new file mode 100644 index 00000000..40a29d21 --- /dev/null +++ b/bindings/sqs/0.3.0/operation.json @@ -0,0 +1,308 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json", + "title": "Operation Schema", + "description": "This object contains information about the operation representation in SQS.", + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "queues": { + "type": "array", + "description": "Queue objects that are either the endpoint for an SNS Operation Binding Object, or the deadLetterQueue of the SQS Operation Binding Object.", + "items": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/queue" + } + }, + "bindingVersion": { + "type": "string", + "enum": [ + "0.1.0", + "0.2.0" + ], + "description": "The version of this binding. If omitted, 'latest' MUST be assumed.", + "default": "latest" + } + }, + "required": [ + "queues" + ], + "definitions": { + "queue": { + "type": "object", + "description": "A definition of a queue.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "$ref": { + "type": "string", + "description": "Allows for an external definition of a queue. The referenced structure MUST be in the format of a Queue. If there are conflicts between the referenced definition and this Queue's definition, the behavior is undefined." + }, + "name": { + "type": "string", + "description": "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." + }, + "fifoQueue": { + "type": "boolean", + "description": "Is this a FIFO queue?", + "default": false + }, + "deduplicationScope": { + "type": "string", + "enum": ["queue", "messageGroup"], + "description": "Specifies whether message deduplication occurs at the message group or queue level. Valid values are messageGroup and queue (default).", + "default": "queue" + }, + "fifoThroughputLimit": { + "type": "string", + "enum": ["perQueue", "perMessageGroupId"], + "description": "Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are perQueue (default) and perMessageGroupId.", + "default": "perQueue" + }, + "deliveryDelay": { + "type": "integer", + "description": "The number of seconds to delay before a message sent to the queue can be received. Used to create a delay queue.", + "minimum": 0, + "maximum": 15, + "default": 0 + }, + "visibilityTimeout": { + "type": "integer", + "description": "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.", + "minimum": 0, + "maximum": 43200, + "default": 30 + }, + "receiveMessageWaitTime": { + "type": "integer", + "description": "Determines if the queue uses short polling or long polling. Set to zero 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.", + "default": 0 + }, + "messageRetentionPeriod": { + "type": "integer", + "description": "How long to retain a message on the queue in seconds, unless deleted.", + "minimum": 60, + "maximum": 1209600, + "default": 345600 + }, + "redrivePolicy": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/redrivePolicy" + }, + "policy": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/policy" + }, + "tags": { + "type": "object", + "description": "Key-value pairs that represent AWS tags on the queue." + } + }, + "required": [ + "name" + ] + }, + "redrivePolicy": { + "type": "object", + "description": "Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "deadLetterQueue": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/identifier" + }, + "maxReceiveCount": { + "type": "integer", + "description": "The number of times a message is delivered to the source queue before being moved to the dead-letter queue.", + "default": 10 + } + }, + "required": [ + "deadLetterQueue" + ] + }, + "identifier": { + "type": "object", + "description": "The SQS queue to use as a dead letter queue (DLQ).", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "arn": { + "type": "string", + "description": "The target is an ARN. For example, for SQS, the identifier may be an ARN, which will be of the form: arn:aws:sqs:{region}:{account-id}:{queueName}" + }, + "name": { + "type": "string", + "description": "The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this publish Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field sqs binding." + } + } + }, + "policy": { + "type": "object", + "description": "The security policy for the SQS Queue", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "statements": { + "type": "array", + "description": "An array of statement objects, each of which controls a permission for this queue.", + "items": { + "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/statement" + } + } + }, + "required": [ + "statements" + ] + }, + "statement": { + "type": "object", + "patternProperties": { + "^x-[\\w\\d\\.\\x2d_]+$": { + "$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json" + } + }, + "properties": { + "effect": { + "type": "string", + "enum": [ + "Allow", + "Deny" + ] + }, + "principal": { + "description": "The AWS account(s) or resource ARN(s) that this statement applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + ] + }, + "action": { + "description": "The SQS permission(s) being allowed or denied e.g. sqs:ReceiveMessage", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "resource": { + "description": "The resource(s) that this policy applies to.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "condition": { + "description": "Specific circumstances under which the policy grants permission", + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "patternProperties": { + ".*": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + } + } + }, + "required": [ + "effect", + "principal", + "action" + ] + } + }, + "examples": [ + { + "queues": [ + { + "name": "myQueue", + "fifoQueue": true, + "deduplicationScope": "messageGroup", + "fifoThroughputLimit": "perMessageGroupId", + "deliveryDelay": 10, + "redrivePolicy": { + "deadLetterQueue": { + "name": "myQueue_error" + }, + "maxReceiveCount": 15 + }, + "policy": { + "statements": [ + { + "effect": "Deny", + "principal": "arn:aws:iam::123456789012:user/dec.kolakowski", + "action": [ + "sqs:SendMessage", + "sqs:ReceiveMessage" + ] + } + ] + } + }, + { + "name": "myQueue_error", + "deliveryDelay": 10 + } + ] + } + ] +} From 924a41a0bc6c1209a87ae5f00fdf53ba7c13f0e8 Mon Sep 17 00:00:00 2001 From: "adam.gloyne" Date: Thu, 27 Jun 2024 15:14:32 +0100 Subject: [PATCH 4/5] fix ref versions --- bindings/sns/0.2.0/channel.json | 8 ++++---- bindings/sns/0.2.0/operation.json | 16 ++++++++-------- bindings/sqs/0.3.0/channel.json | 17 +++++++++-------- bindings/sqs/0.3.0/operation.json | 15 ++++++++------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/bindings/sns/0.2.0/channel.json b/bindings/sns/0.2.0/channel.json index fa3e4c40..e21e63cf 100644 --- a/bindings/sns/0.2.0/channel.json +++ b/bindings/sns/0.2.0/channel.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/sns/0.1.0/channel.json", + "$id": "http://asyncapi.com/bindings/sns/0.2.0/channel.json", "title": "Channel Schema", "description": "This object contains information about the channel representation in SNS.", "type": "object", @@ -16,10 +16,10 @@ "description": "The name of the topic. Can be different from the channel name to allow flexibility around AWS resource naming limitations." }, "ordering": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/channel.json#/definitions/ordering" + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/channel.json#/definitions/ordering" }, "policy": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/channel.json#/definitions/policy" + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/channel.json#/definitions/policy" }, "tags": { "type": "object", @@ -74,7 +74,7 @@ "type": "array", "description": "An array of statement objects, each of which controls a permission for this topic", "items": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/channel.json#/definitions/statement" + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/channel.json#/definitions/statement" } } }, diff --git a/bindings/sns/0.2.0/operation.json b/bindings/sns/0.2.0/operation.json index 4c890902..6e569206 100644 --- a/bindings/sns/0.2.0/operation.json +++ b/bindings/sns/0.2.0/operation.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/sns/0.1.0/operation.json", + "$id": "http://asyncapi.com/bindings/sns/0.2.0/operation.json", "title": "Operation Schema", "description": "This object contains information about the operation representation in SNS.", "type": "object", @@ -12,19 +12,19 @@ }, "properties": { "topic": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/identifier", + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/operation.json#/definitions/identifier", "description": "Often we can assume that the SNS Topic is the channel name-we provide this field in case the you need to supply the ARN, or the Topic name is not the channel name in the AsyncAPI document." }, "consumers": { "type": "array", "description": "The protocols that listen to this topic and their endpoints.", "items": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/consumer" + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/operation.json#/definitions/consumer" }, "minItems": 1 }, "deliveryPolicy": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/deliveryPolicy", + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/operation.json#/definitions/deliveryPolicy", "description": "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." }, "bindingVersion": { @@ -92,7 +92,7 @@ }, "endpoint": { "description": "The endpoint messages are delivered to.", - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/identifier" + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/operation.json#/definitions/identifier" }, "filterPolicy": { "type": "object", @@ -133,10 +133,10 @@ "description": "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." }, "redrivePolicy": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/redrivePolicy" + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/operation.json#/definitions/redrivePolicy" }, "deliveryPolicy": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/deliveryPolicy", + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/operation.json#/definitions/deliveryPolicy", "description": "Policy for retries to HTTP. The parameter is for that SNS Subscription and overrides any policy on the SNS Topic." }, "displayName": { @@ -208,7 +208,7 @@ }, "properties": { "deadLetterQueue": { - "$ref": "http://asyncapi.com/bindings/sns/0.1.0/operation.json#/definitions/identifier", + "$ref": "http://asyncapi.com/bindings/sns/0.2.0/operation.json#/definitions/identifier", "description": "The SQS queue to use as a dead letter queue (DLQ)." }, "maxReceiveCount": { diff --git a/bindings/sqs/0.3.0/channel.json b/bindings/sqs/0.3.0/channel.json index 745e057c..7c2e567e 100644 --- a/bindings/sqs/0.3.0/channel.json +++ b/bindings/sqs/0.3.0/channel.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json", + "$id": "http://asyncapi.com/bindings/sqs/0.3.0/channel.json", "title": "Channel Schema", "description": "This object contains information about the channel representation in SQS.", "type": "object", @@ -13,17 +13,18 @@ "properties": { "queue": { "description": "A definition of the queue that will be used as the channel.", - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/queue" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/channel.json#/definitions/queue" }, "deadLetterQueue": { "description": "A definition of the queue that will be used for un-processable messages.", - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/queue" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/channel.json#/definitions/queue" }, "bindingVersion": { "type": "string", "enum": [ "0.1.0", - "0.2.0" + "0.2.0", + "0.3.0" ], "description": "The version of this binding. If omitted, 'latest' MUST be assumed.", "default": "latest" @@ -90,10 +91,10 @@ "default": 345600 }, "redrivePolicy": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/redrivePolicy" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/channel.json#/definitions/redrivePolicy" }, "policy": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/policy" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/channel.json#/definitions/policy" }, "tags": { "type": "object", @@ -115,7 +116,7 @@ }, "properties": { "deadLetterQueue": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/identifier" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/channel.json#/definitions/identifier" }, "maxReceiveCount": { "type": "integer", @@ -159,7 +160,7 @@ "type": "array", "description": "An array of statement objects, each of which controls a permission for this queue.", "items": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/channel.json#/definitions/statement" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/channel.json#/definitions/statement" } } }, diff --git a/bindings/sqs/0.3.0/operation.json b/bindings/sqs/0.3.0/operation.json index 40a29d21..4fa21cfc 100644 --- a/bindings/sqs/0.3.0/operation.json +++ b/bindings/sqs/0.3.0/operation.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json", + "$id": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json", "title": "Operation Schema", "description": "This object contains information about the operation representation in SQS.", "type": "object", @@ -15,14 +15,15 @@ "type": "array", "description": "Queue objects that are either the endpoint for an SNS Operation Binding Object, or the deadLetterQueue of the SQS Operation Binding Object.", "items": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/queue" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json#/definitions/queue" } }, "bindingVersion": { "type": "string", "enum": [ "0.1.0", - "0.2.0" + "0.2.0", + "0.3.0" ], "description": "The version of this binding. If omitted, 'latest' MUST be assumed.", "default": "latest" @@ -93,10 +94,10 @@ "default": 345600 }, "redrivePolicy": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/redrivePolicy" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json#/definitions/redrivePolicy" }, "policy": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/policy" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json#/definitions/policy" }, "tags": { "type": "object", @@ -117,7 +118,7 @@ }, "properties": { "deadLetterQueue": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/identifier" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json#/definitions/identifier" }, "maxReceiveCount": { "type": "integer", @@ -161,7 +162,7 @@ "type": "array", "description": "An array of statement objects, each of which controls a permission for this queue.", "items": { - "$ref": "http://asyncapi.com/bindings/sqs/0.2.0/operation.json#/definitions/statement" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json#/definitions/statement" } } }, From d56d9f9ab800f187c8b41326d4113b3c23316d3a Mon Sep 17 00:00:00 2001 From: "adam.gloyne" Date: Mon, 15 Jul 2024 10:01:40 +0100 Subject: [PATCH 5/5] Refactor principal --- bindings/sns/0.2.0/channel.json | 32 ++++++++++++-- bindings/sqs/0.3.0/channel.json | 32 ++++++++++++-- bindings/sqs/0.3.0/operation.json | 72 ++++++++++++++++++++++--------- 3 files changed, 110 insertions(+), 26 deletions(-) diff --git a/bindings/sns/0.2.0/channel.json b/bindings/sns/0.2.0/channel.json index e21e63cf..515dd57b 100644 --- a/bindings/sns/0.2.0/channel.json +++ b/bindings/sns/0.2.0/channel.json @@ -105,8 +105,8 @@ }, { "type": "object", - "patternProperties": { - ".*": { + "properties": { + "AWS": { "oneOf": [ { "type": "string" @@ -119,7 +119,33 @@ } ] } - } + }, + "required": [ + "AWS" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "Service": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + }, + "required": [ + "Service" + ], + "additionalProperties": false } ] }, diff --git a/bindings/sqs/0.3.0/channel.json b/bindings/sqs/0.3.0/channel.json index 7c2e567e..50069750 100644 --- a/bindings/sqs/0.3.0/channel.json +++ b/bindings/sqs/0.3.0/channel.json @@ -191,8 +191,8 @@ }, { "type": "object", - "patternProperties": { - ".*": { + "properties": { + "AWS": { "oneOf": [ { "type": "string" @@ -205,7 +205,33 @@ } ] } - } + }, + "required": [ + "AWS" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "Service": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + }, + "required": [ + "Service" + ], + "additionalProperties": false } ] }, diff --git a/bindings/sqs/0.3.0/operation.json b/bindings/sqs/0.3.0/operation.json index 4fa21cfc..d38e110a 100644 --- a/bindings/sqs/0.3.0/operation.json +++ b/bindings/sqs/0.3.0/operation.json @@ -57,13 +57,19 @@ }, "deduplicationScope": { "type": "string", - "enum": ["queue", "messageGroup"], + "enum": [ + "queue", + "messageGroup" + ], "description": "Specifies whether message deduplication occurs at the message group or queue level. Valid values are messageGroup and queue (default).", "default": "queue" }, "fifoThroughputLimit": { "type": "string", - "enum": ["perQueue", "perMessageGroupId"], + "enum": [ + "perQueue", + "perMessageGroupId" + ], "description": "Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are perQueue (default) and perMessageGroupId.", "default": "perQueue" }, @@ -118,7 +124,7 @@ }, "properties": { "deadLetterQueue": { - "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json#/definitions/identifier" + "$ref": "http://asyncapi.com/bindings/sqs/0.3.0/operation.json#/definitions/identifier" }, "maxReceiveCount": { "type": "integer", @@ -193,8 +199,8 @@ }, { "type": "object", - "patternProperties": { - ".*": { + "properties": { + "AWS": { "oneOf": [ { "type": "string" @@ -207,7 +213,33 @@ } ] } - } + }, + "required": [ + "AWS" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "Service": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + }, + "required": [ + "Service" + ], + "additionalProperties": false } ] }, @@ -243,7 +275,7 @@ "description": "Specific circumstances under which the policy grants permission", "type": "object", "patternProperties": { - ".*": { + ".*": { "type": "object", "patternProperties": { ".*": { @@ -261,7 +293,7 @@ } } } - } + } } }, "required": [ @@ -275,29 +307,29 @@ { "queues": [ { - "name": "myQueue", - "fifoQueue": true, - "deduplicationScope": "messageGroup", - "fifoThroughputLimit": "perMessageGroupId", - "deliveryDelay": 10, - "redrivePolicy": { + "name": "myQueue", + "fifoQueue": true, + "deduplicationScope": "messageGroup", + "fifoThroughputLimit": "perMessageGroupId", + "deliveryDelay": 10, + "redrivePolicy": { "deadLetterQueue": { "name": "myQueue_error" }, "maxReceiveCount": 15 - }, - "policy": { + }, + "policy": { "statements": [ { "effect": "Deny", "principal": "arn:aws:iam::123456789012:user/dec.kolakowski", "action": [ - "sqs:SendMessage", - "sqs:ReceiveMessage" + "sqs:SendMessage", + "sqs:ReceiveMessage" ] } ] - } + } }, { "name": "myQueue_error", @@ -306,4 +338,4 @@ ] } ] -} +} \ No newline at end of file