8000 Validate SQS dev endpoints by giograno · Pull Request #11620 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Validate SQS dev endpoints #11620

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 5 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 96 additions & 1 deletion localstack-core/localstack/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ info:
checks, plugins, initialisation hooks, service introspection, and more.
termsOfService: https://www.localstack.cloud/legal/tos
title: LocalStack REST API for Community
version: 3.6.1.dev
version: latest
externalDocs:
description: LocalStack Documentation
url: https://docs.localstack.cloud
Expand Down Expand Up @@ -211,6 +211,58 @@ components:
- error
- subscription_arn
type: object
ReceiveMessageRequest:
type: object
description: https://github.com/boto/botocore/blob/develop/botocore/data/sqs/2012-11-05/service-2.json
required:
- QueueUrl
properties:
QueueUrl:
type: string
format: uri
AttributeNames:
type: array
items:
type: string
MessageSystemAttributeNames:
type: array
items:
type: string
MessageAttributeNames:
type: array
items:
type: string
MaxNumberOfMessages:
type: integer
VisibilityTimeout:
type: integer
WaitTimeSeconds:
type: integer
ReceiveRequestAttemptId:
type: string
ReceiveMessageResult:
type: object
description: https://github.com/boto/botocore/blob/develop/botocore/data/sqs/2012-11-05/service-2.json
properties:
Messages:
type: array
items:
$ref: '#/components/schemas/Message'
Message:
type: object
properties:
MessageId:
type: [string, 'null']
ReceiptHandle:
type: [string, 'null']
MD5OfBody:
type: [string, 'null']
Body:
type: [string, 'null']
Attributes:
type: object
MessageAttributes:
type: object
CloudWatchMetrics:
additionalProperties: false
properties:
Expand Down Expand Up @@ -529,14 +581,52 @@ paths:
'200':
content:
text/xml: {}
application/json:
schema:
$ref: '#/components/schemas/ReceiveMessageResult'
description: SQS queue messages
'400':
content:
text/xml: {}
application/json: {}
description: Bad request
'404':
content:
text/xml: {}
application/json: {}
description: Not found
post:
summary: Retrieves one or more messages from the specified queue.
description: |
This API receives messages from an SQS queue.
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html#API_ReceiveMessage_ResponseSyntax
operationId: receive_message
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/ReceiveMessageRequest'
application/json:
schema:
$ref: '#/components/schemas/ReceiveMessageRequest'
responses:
'200':
content:
text/xml: {}
application/json:
schema:
$ref: '#/components/schemas/ReceiveMessageResult'
description: SQS queue messages
'400':
content:
text/xml: {}
application/json: {}
description: Bad request
'404':
content:
text/xml: {}
application/json: {}
description: Not found
/_aws/sqs/messages/{region}/{account_id}/{queue_name}:
get:
Expand Down Expand Up @@ -566,14 +656,19 @@ paths:
'200':
content:
text/xml: {}
application/json:
schema:
$ref: '#/components/schemas/ReceiveMessageResult'
description: SQS queue messages
'400':
content:
text/xml: {}
application/json: {}
description: Bad request
'404':
content:
text/xml: {}
application/json: {}
description: Not found
/_localstack/config:
get:
Expand Down
2 changes: 1 addition & 1 deletion localstack-core/localstack/services/sqs/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def __init__(self, stores=None):
self.service = load_service("sqs-query")
self.serializer = create_serializer(self.service)

@route("/_aws/sqs/ 8000 messages")
@route("/_aws/sqs/messages", methods=["GET", "POST"])
@aws_response_serializer("sqs-query", "ReceiveMessage")
def list_messages(self, request: Request) -> ReceiveMessageResult:
"""
Expand Down
1 change: 1 addition & 0 deletions tests/aws/services/sqs/test_sqs_backdoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def _parse_attribute_map(json_message: dict) -> dict[str, str]:
return {attr["Name"]: attr["Value"] for attr in json_message["Attribute"]}


@pytest.mark.usefixtures("openapi_validate")
class TestSqsDeveloperEndpoints:
@markers.aws.only_localstack
@pytest.mark.parametrize("strategy", ["standard", "domain", "path"])
Expand Down
Loading
0