Skip to content

Commit

Permalink
Add validation schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdnk committed Oct 23, 2024
1 parent 4e498c5 commit 68bf4a4
Showing 1 changed file with 258 additions and 0 deletions.
258 changes: 258 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
{
"$id": "https://raw.githubusercontent.com/roadrunner-server/sqs/refs/heads/master/schema.json",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"title": "roadrunner-sqs",
"description": "The schema contains all the valid configuration parameters for the SQS plugin for the roadrunner job system.",
"definitions": {
"pipeline": {
"type": "object",
"additionalProperties": false,
"description": "Configuration options for the SQS pipeline.",
"driver": {
"type": "string",
"enum": [
"sqs"
]
},
"config": {
"type": "object",
"description": "Configuration for the SQS driver.",
"additionalProperties": false,
"properties": {
"priority": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/jobs/refs/heads/master/schema.json#/definitions/PipelineProperties/priority"
},
"prefetch": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/jobs/refs/heads/master/schema.json#/definitions/PipelineProperties/prefetch"
},
"skip_queue_declaration": {
"description": "Whether to skip creation of the SQS queue. If you set to this to `true`, the queue must already exist.",
"type": "boolean",
"default": false
},
"consume_all": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/jobs/refs/heads/master/schema.json#/definitions/PipelineProperties/consume_all"
},
"visibility_timeout": {
"type": "integer",
"description": "The duration (in seconds) that a message received from a queue (by one consumer) will not be visible to the other message consumers. The visibility timeout begins when Amazon SQS returns a message. If the consumer fails to process and delete the message before the visibility timeout expires, the message becomes visible to other consumers. If a message must be received only once, your consumer must delete it within the duration of the visibility timeout.",
"default": 0
},
"error_visibility_timeout": {
"type": "integer",
"description": "The visibility timeout to set for jobs that fail (NACK). If you set this, you must also set `retain_failed_jobs` to `true`.",
"default": 0
},
"retain_failed_jobs": {
"type": "boolean",
"description": "Whether to keep failed (NACK'ed) jobs on the queue. By default, RR will delete and requeue failed jobs immediately. If you set this to `true`, RR does nothing to NACK'ed jobs on the queue and they will be consumed again after `visibility_timeout` or (`error_visibility_timeout`, if > 0) has passed. Jobs that are consumed multiple times will increment their receive count, which can be used to configure SQS to automatically move the jobs to a dead-letter queue.",
"default": false
},
"wait_time_seconds": {
"description": "The duration (in seconds) the call waits for a message to arrive in the queue before returning. If a message is available, the call returns immediately. If no messages are available and the wait time expires, the call returns with an empty list of messages",
"type": "integer",
"default": 0,
"maximum": 20
},
"queue": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/jobs/refs/heads/master/schema.json#/definitions/PipelineProperties/queue"
},
"message_group_id": {
"description": "Message Group ID. See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html#SQS-SendMessage-request-MessageGroupId",
"type": "string",
"default": null
},
"attributes": {
"title": "AWS queue attributes. Attributes are only applied to the queue if RR creates it. Existing queues will not be modified. Must be any of the attributes listed here: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.html.",
"type": "object",
"properties": {
"DelaySeconds": {
"description": "The length of time, in seconds, for which the delivery of all messages in the queue is delayed.",
"type": "integer",
"minimum": 0,
"maximum": 900,
"default": 0
},
"MaximumMessageSize": {
"description": "The limit of how many bytes a message can contain before Amazon SQS rejects it.",
"type": "integer",
"minimum": 1024,
"maximum": 262144,
"default": 262144
},
"MessageRetentionPeriod": {
"description": "The length of time, in seconds, for which Amazon SQS retains a message. When you change a queue's attributes, the change can take up to 60 seconds for most of the attributes to propagate throughout the Amazon SQS system. Changes made to the `MessageRetentionPeriod` attribute can take up to 15 minutes and will impact existing messages in the queue potentially causing them to be expired and deleted if the `MessageRetentionPeriod` is reduced below the age of existing messages.",
"type": "integer",
"minimum": 60,
"maximum": 1209600,
"default": 345600
},
"Policy": {
"description": "A valid AWS policy. See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html for reference of this object structure."
},
"ReceiveMessageWaitTimeSeconds": {
"description": "The length of time, in seconds, for which a [`ReceiveMessage`](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html) action waits for a message to arrive.",
"type": "integer",
"minimum": 0,
"maximum": 20,
"default": 0
},
"VisibilityTimeout": {
"description": "The visibility timeout for the queue, in seconds. For more information about the visibility timeout, see [Visibility Timeout](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html) in the Amazon SQS Developer Guide.",
"type": "integer",
"minimum": 0,
"maximum": 43200,
"default": 30
},
"RedrivePolicy": {
"description": "**Dead-letter queues only.** The parameters for the dead-letter queue functionality of the source queue as a JSON object.",
"type": "object",
"properties": {
"deadLetterTargetArn": {
"type": "string",
"description": "The Amazon Resource Name (ARN) of the dead-letter queue to which Amazon SQS moves messages after the value of `maxReceiveCount` is exceeded.",
"examples": [
"arn:aws:sqs:us-east-2:123456789012:my_queue"
]
},
"maxReceiveCount": {
"type": "integer",
"description": "The number of times a message is delivered to the source queue before being moved to the dead-letter queue. When the `ReceiveCount` for a message exceeds the `maxReceiveCount` for a queue, Amazon SQS moves the message to the dead-letter-queue.",
"minimum": 1,
"default": 10
}
}
},
"RedriveAllowPolicy": {
"description": "**Dead-letter queues only.** The parameters for the permissions for the dead-letter queue redrive permission and which source queues can specify dead-letter queues.",
"type": "object",
"properties": {
"redrivePermission": {
"description": "The permission type that defines which source queues can specify the current queue as the dead-letter queue.",
"type": "string",
"enum": [
"allowAll",
"denyAll",
"byQueue"
]
},
"sourceQueueArns": {
"description": "The Amazon Resource Names (ARN)s of the source queues that can specify this queue as the dead-letter queue and redrive messages. You can specify this parameter only when the `redrivePermission` parameter is set to `byQueue`. You can specify up to 10 source queue ARNs. To allow more than 10 source queues to specify dead-letter queues, set the `redrivePermission` parameter to `allowAll`.",
"type": "array",
"items": {
"type": "string",
"examples": [
"arn:aws:sqs:us-east-2:123456789012:my_queue",
"arn:aws:sqs:us-east-2:123456789012:my_queue2"
]
}
}
}
},
"ContentBasedDeduplication": {
"description": "**FIFO queues only.** Enables content-based deduplication. For more information, see [Exactly-once processing](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html) in the Amazon SQS Developer Guide.",
"type": "boolean",
"default": false
},
"DeduplicationScope": {
"description": "**High-throughput FIFO queues only.** Specifies whether message deduplication occurs at the message group or queue level.",
"type": "string",
"enum": [
"messageGroup",
"queue"
]
},
"FifoThroughputLimit": {
"description": "**High-throughput FIFO queues only.** Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. The `perMessageGroupId` value is allowed only when the value for `DeduplicationScope` is `messageGroup`.",
"type": "string",
"enum": [
"perQueue",
"perMessageGroupId"
]
},
"KmsMasterKeyId": {
"description": "**Applies only to server-side-encryption.** The ID of an AWS managed customer master key (CMK) for Amazon SQS or a custom CMK. While the alias of the AWS-managed CMK for Amazon SQS is always `alias/aws/sqs`, the alias of a custom CMK can, for example, be `alias/MyAlias`.",
"type": "string"
},
"KmsDataKeyReusePeriodSeconds": {
"description": "**Applies only to server-side-encryption.** The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours).",
"type": "integer",
"minimum": 60,
"maximum": 86400,
"default": 300
},
"SqsManagedSseEnabled": {
"type": "boolean",
"default": false,
"description": "**Applies only to server-side-encryption.** Enables server-side queue encryption using SQS owned encryption keys. Only one server-side encryption option is supported per queue."
}
}
},
"tags": {
"title": "Tags to associate with the queue. Please see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-tags.html.",
"type": "object",
"additionalProperties": {
"type": "string",
"minLength": 1
}
}
}
}
},
"driver": {
"type": "object",
"additionalProperties": false,
"description": "Configuration options for the SQS driver.",
"properties": {
"key": {
"title": "AWS Access Key ID",
"description": "This is required unless your environment variables provide AWS credentials or you use a self-hosted queue.",
"type": "string",
"examples": [
"ASIAIOSFODNN7EXAMPLE"
]
},
"secret": {
"title": "AWS Access Key Secret",
"description": "This is required unless your environment variables provide AWS credentials or you use a self-hosted queue.",
"type": "string",
"examples": [
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
]
},
"region": {
"title": "AWS Region",
"description": "The region to connect to. Must be one of the [supported regions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions). This is required unless your environment variables provide an AWS region or you use a self-hosted queue.",
"type": "string",
"examples": [
"eu-central-1",
"us-west-1",
"ca-central-1",
"ap-northeast-1"
]
},
"session_token": {
"title": "AWS Session Token",
"description": "The short-lived session token to use. This should not be provided for production and has a maximum duration of 12 hours. In most cases, you don't need to provide this value.",
"type": "string"
},
"endpoint": {
"title": "Queue Endpoint",
"description": "The endpoint of your queue. You only need to provide this value if you use a self-hosted queue, as the endpoint will be resolved from the provided AWS Region and queue name otherwise.",
"type": "string",
"examples": [
"http://127.0.0.1:9324"
]
}
},
"dependentRequired": {
"cert": [
"secret"
],
"secret": [
"key"
]
}
}
}
}

0 comments on commit 68bf4a4

Please sign in to comment.