8000 Validate SNS developer endpoints (#11621) · localstack/localstack@79e2a7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 79e2a7e

Browse files
authored
Validate SNS developer endpoints (#11621)
1 parent 7a02a30 commit 79e2a7e

File tree

2 files changed

+92
-28
lines changed

2 files changed

+92
-28
lines changed

localstack-core/localstack/openapi.yaml

Lines changed: 91 additions & 28 deletions
< 10000 tr class="diff-line-row">
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,89 @@ components:
232232
- error
233233
- subscription_arn
234234
type: object
235+
SNSPlatformEndpointMessage:
236+
type: object
237+
description: Message sent to a platform endpoint via SNS
238+
additionalProperties: false
239+
properties:
240+
TargetArn:
241+
type: string
242+
TopicArn:
243+
type: string
244+
Message:
245+
type: string
246+
MessageAttributes:
247+
type: object
248+
MessageStructure:
249+
type: string
250+
Subject:
251+
type: [string, 'null']
252+
MessageId:
253+
type: string
254+
SNSMessage:
255+
type: object
256+
description: Message sent via SNS
257+
properties:
258+
PhoneNumber:
259+
type: string
260+
TopicArn:
261+
type: [string, 'null']
262+
SubscriptionArn:
263+
type: [string, 'null']
264+
MessageId:
265+
type: string
266+
Message:
267+
type: string
268+
MessageAttributes:
269+
type: object
270+
MessageStructure:
271+
type: [string, 'null']
272+
Subject:
273+
type: [string, 'null']
274+
SNSPlatformEndpointMessages:
275+
type: object
276+
description: |
277+
Messages sent to the platform endpoint retrieved via the retrospective endpoint.
278+
The endpoint ARN is the key with a list of messages as value.
279+
additionalProperties:
280+
type: array
281+
items:
282+
$ref: '#/components/schemas/SNSPlatformEndpointMessage'
283+
SMSMessages:
284+
type: object
285+
description: |
286+
SMS messages retrieved via the retrospective endpoint.
287+
The phone number is the key with a list of messages as value.
288+
additionalProperties:
289+
type: array
290+
items:
291+
$ref: '#/components/schemas/SNSMessage'
292+
SNSPlatformEndpointResponse:
293+
type: object
294+
additionalProperties: false
295+
description: Response payload for the /_aws/sns/platform-endpoint-messages endpoint
296+
properties:
297+
region:
298+
type: string
299+
description: "The AWS region, e.g., us-east-1"
300+
platform_endpoint_messages:
301+
$ref: '#/components/schemas/SNSPlatformEndpointMessages'
302+
required:
303+
- region
304+
- platform_endpoint_messages
305+
SNSSMSMessagesResponse:
306+
type: object
307+
additionalProperties: false
308+
description: Response payload for the /_aws/sns/sms-messages endpoint
309+
properties:
310+
region:
311+
type: string
312+
description: "The AWS region, e.g., us-east-1"
313+
sms_messages:
314+
$ref: '#/components/schemas/SMSMessages'
315+
required:
316+
- region
317+
- sms_messages
235318
ReceiveMessageRequest:
236319
type: object
237320
description: https://github.com/boto/botocore/blob/develop/botocore/data/sqs/2012-11-05/service-2.json
@@ -469,8 +552,8 @@ paths:
469552
description: List of sent messages
470553
/_aws/sns/platform-endpoint-messages:
471554
delete:
472-
description: Discard SNS platform endpoint messages
473-
operationId: discard_sns_messages
555+
description: Discard the messages published to a platform endpoint via SNS
556+
operationId: discard_sns_endpoint_messages
474557
tags: [aws]
475558
parameters:
476559
- $ref: '#/components/parameters/SnsAccountId'
@@ -480,8 +563,8 @@ paths:
480563
'204':
481564
description: Platform endpoint message was discarded
482565
get:
483-
description: Retrieve SNS platform endpoint messages
484-
operationId: get_sns_messages
566+
description: Retrieve the messages sent to a platform endpoint via SNS
567+
operationId: get_sns_endpoint_messages
485568
tags: [aws]
486569
parameters:
487570
- $ref: '#/components/parameters/SnsAccountId'
@@ -492,17 +575,8 @@ paths:
492575
content:
493576
application/json:
494577
schema:
495-
additionalProperties: false
496-
properties:
497-
platform_endpoint_messages:
498-
type: object
499-
region:
500-
type: string
501-
required:
502-
- platform_endpoint_messages
503-
- region
504-
type: object
505-
description: Platform endpoint messages
578+
$ref: "#/components/schemas/SNSPlatformEndpointResponse"
579+
description: SNS messages via retrospective access
506580
/_aws/sns/sms-messages:
507581
delete:
508582
description: Discard SNS SMS messages
@@ -514,8 +588,6 @@ paths:
514588
- $ref: '#/components/parameters/SnsPhoneNumber'
515589
responses:
516590
'204':
517-
content:
518-
text/plain: {}
519591
description: SMS message was discarded
520592
get:
521593
description: Retrieve SNS SMS messages
@@ -530,17 +602,8 @@ paths:
530602
content:
531603
application/json:
532604
schema:
533-
additionalProperties: false
534-
properties:
535-
region:
536-
type: string
537-
sms_messages:
538-
type: object
539-
required:
540-
- sms_messages
541-
- region
542-
type: object
543-
description: SNS SMS messages
605+
$ref: "#/components/schemas/SNSSMSMessagesResponse"
606+
description: SNS messages via retrospective access
544607
/_aws/sns/subscription-tokens/{subscription_arn}:
545608
get:
546609
description: Retrieve SNS subscription token for confirmation

tests/aws/services/sns/test_sns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4301,6 +4301,7 @@ def get_log_events():
43014301
snapshot.match("delivery-events", events)
43024302

43034303

4304+
@pytest.mark.usefixtures("openapi_validate")
43044305
class TestSNSRetrospectionEndpoints:
43054306
@markers.aws.only_localstack
43064307
def test_publish_to_platform_endpoint_can_retrospect(

0 commit comments

Comments
 (0)
0