From 69df184f51e666e21bf37d98026bb7c4e993f3a5 Mon Sep 17 00:00:00 2001 From: Roberto Rojas Date: Tue, 1 Aug 2023 02:31:01 -0400 Subject: [PATCH] [AWS PubSub SNSSQS] Adds Component Metadata Schema (#2905) Signed-off-by: Roberto J Rojas Signed-off-by: Roberto Rojas Co-authored-by: Artur Souza Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com> --- .../builtin-authentication-profiles.yaml | 8 + pubsub/aws/snssqs/metadata.go | 14 +- pubsub/aws/snssqs/metadata.yaml | 146 ++++++++++++++++++ 3 files changed, 162 insertions(+), 6 deletions(-) create mode 100644 pubsub/aws/snssqs/metadata.yaml diff --git a/.build-tools/builtin-authentication-profiles.yaml b/.build-tools/builtin-authentication-profiles.yaml index 81e07c3635..548fbf5352 100644 --- a/.build-tools/builtin-authentication-profiles.yaml +++ b/.build-tools/builtin-authentication-profiles.yaml @@ -13,6 +13,14 @@ aws: required: true sensitive: true example: '"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"' + - name: sessionToken + required: false + sensitive: true + description: | + AWS session token to use. A session token is only required if you are using + temporary security credentials. + example: '"TOKEN"' + type: string - title: "AWS: Credentials from Environment Variables" description: Use AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from the environment diff --git a/pubsub/aws/snssqs/metadata.go b/pubsub/aws/snssqs/metadata.go index 3b6796b783..2f3016ccec 100644 --- a/pubsub/aws/snssqs/metadata.go +++ b/pubsub/aws/snssqs/metadata.go @@ -11,20 +11,22 @@ import ( ) type snsSqsMetadata struct { - // aws endpoint for the component to use. - Endpoint string `mapstructure:"endpoint"` + // Ignored by metadata parser because included in built-in authentication profile // access key to use for accessing sqs/sns. - AccessKey string `mapstructure:"accessKey"` + AccessKey string `json:"accessKey" mapstructure:"accessKey" mdignore:"true"` // secret key to use for accessing sqs/sns. - SecretKey string `mapstructure:"secretKey"` + SecretKey string `json:"secretKey" mapstructure:"secretKey" mdignore:"true"` // aws session token to use. - SessionToken string `mapstructure:"sessionToken"` + SessionToken string `mapstructure:"sessionToken" mdignore:"true"` + + // aws endpoint for the component to use. + Endpoint string `mapstructure:"endpoint"` // aws region in which SNS/SQS should create resources. Region string `mapstructure:"region"` // aws partition in which SNS/SQS should create resources. internalPartition string `mapstructure:"-"` // name of the queue for this application. The is provided by the runtime as "consumerID". - SqsQueueName string `mapstructure:"consumerID"` + SqsQueueName string `mapstructure:"consumerID" mdignore:"true"` // name of the dead letter queue for this application. SqsDeadLettersQueueName string `mapstructure:"sqsDeadLettersQueueName"` // flag to SNS and SQS FIFO. diff --git a/pubsub/aws/snssqs/metadata.yaml b/pubsub/aws/snssqs/metadata.yaml new file mode 100644 index 0000000000..ffdf2397a1 --- /dev/null +++ b/pubsub/aws/snssqs/metadata.yaml @@ -0,0 +1,146 @@ +# yaml-language-server: $schema=../../../component-metadata-schema.json +schemaVersion: v1 +type: pubsub +name: aws.snssqs +version: v1 +status: stable +title: "AWS SNS/SQS" +urls: + - title: Reference + url: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-aws-snssqs/ +capabilities: + - ttl +builtinAuthenticationProfiles: + - name: "aws" +metadata: + - name: region + required: true + description: | + The AWS region where the SNS/SQS assets are located or be created in. See the `Supported AWS services per region` page. + Ensure that SNS and SQS are available in that region. + url: + title: "Supported AWS services per region" + url: "https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/?p=ugi&l=na" + example: '"us-east-1"' + type: string + - name: endpoint + required: false + description: | + AWS endpoint for the component to use, to connect to emulators. + Do not use this when running against production AWS. + example: '"http://localhost:4566"' + type: string + - name: messageVisibilityTimeout + required: false + description: | + Amount of time in seconds that a message is hidden from receive requests after + it is sent to a subscriber. + type: number + default: '10' + example: '10' + - name: messageReceiveLimit + required: false + description: | + Maximun number of attempts the message will be re-delivered after processing failures. + The sqsDeadLettersQueueName is a SQS dead-letters queue to move the message to + once the maximun number of attempts have been reached. + type: number + default: '10' + example: '10' + - name: messageRetryLimit + required: false + description: | + Number of times to resend a message after processing of that message fails + before removing that message from the queue. + type: number + default: '10' + example: '10' + - name: sqsDeadLettersQueueName + required: false + description: | + Name of the dead letters queue for this application. + example: '"myapp-dlq"' + type: string + - name: messageWaitTimeSeconds + required: false + description: | + The duration (in seconds) for which the call waits for a message to arrive + in the queue before returning. If a message is available, the call returns + sooner than messageWaitTimeSeconds. If no messages are available and the + wait time expires, the call returns successfully with an empty list of messages. + type: number + default: '1' + example: '1' + - name: messageMaxNumber + required: false + description: | + Maximum number of messages to receive from the queue at a time. + type: number + default: '10' + example: '10' + - name: fifo + description: | + Use SQS FIFO queue to provide message ordering and deduplication. + See `Amazon SQS FIFO (First-In-First-Out) queues` further details. + url: + title: "Amazon SQS FIFO (First-In-First-Out) queues" + url: "https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html" + type: bool + default: 'false' + example: '"true", "false"' + - name: fifoMessageGroupID + required: false + description: | + If fifo is enabled, instructs Dapr to use a custom Message Group ID + for the pubsub deployment. This is not mandatory as Dapr creates a + custom Message Group ID for each producer, thus ensuring ordering + of messages per a Dapr producer. + See Message Group ID Property documentation. + url: + title: "Message Group ID Property documentation" + url: "https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html" + example: '"app1-mgi"' + type: string + - name: disableEntityManagement + description: | + When set to true, SNS topics, SQS queues and the SQS subscriptions to + SNS do not get created automatically. + type: bool + default: 'false' + example: '"true", "false"' + - name: disableDeleteOnRetryLimit + description: | + When set to true, after retrying and failing of messageRetryLimit + times processing a message, reset the message visibility timeout + so that other consumers can try processing, instead of deleting + the message from SQS (the default behvior). + type: bool + default: 'false' + example: '"true", "false"' + - name: assetsManagementTimeoutSeconds + required: false + description: | + Amount of time in seconds, for an AWS asset management operation, + before it times out and cancelled. Asset management operations + are any operations performed on STS, SNS and SQS, except message + publish and consume operations that implement the default Dapr + component retry behavior. The value can be set to any non-negative + float/integer. + type: number + default: '1' + example: '0.5, 10' + - name: concurrencyMode + required: false + description: | + When messages are received in bulk from SQS, call the subscriber + sequentially (“single” message at a time), or + concurrently (in “parallel”). + default: '"parallel"' + example: '"single", "parallel"' + type: string + - name: accountId + required: false + description: | + The AWS account ID. Resolved automatically if not provided. + example: '""' + type: string \ No newline at end of file