Skip to content

Commit

Permalink
Changed AWS SNS Listener - Test to be dynamic (#37910)
Browse files Browse the repository at this point in the history
Fixed testplaybook to be dynamic when using the TopicArn and SubscriptionID by using commands from AWS - SNS integration.
  • Loading branch information
noydavidi authored Jan 5, 2025
1 parent 00b739f commit 44bbe93
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 26 deletions.
135 changes: 111 additions & 24 deletions Packs/AWS-SNS-Listener/TestPlaybooks/AWS_SNS_Listener_-_Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tasks:
name: ""
iscommand: false
brand: ""
description: ''
nexttasks:
'#none#':
- "6"
Expand All @@ -34,10 +35,10 @@ tasks:
isautoswitchedtoquietmode: false
"1":
id: "1"
taskid: 16f53ca7-8bab-48f2-8485-9892fc5f1809
taskid: bd8049e4-8452-4cf7-8d81-2784a7d8a291
type: regular
task:
id: 16f53ca7-8bab-48f2-8485-9892fc5f1809
id: bd8049e4-8452-4cf7-8d81-2784a7d8a291
version: -1
name: Post a msg to SNS-Listener
description: Sends http request. Returns the response as json.
Expand All @@ -50,12 +51,19 @@ tasks:
- "7"
scriptarguments:
body:
simple: '{"Type": "Notification", "MessageId": "8b2d1fb3-991d-5620-94db-4122378cde65",
"TopicArn": "arn:aws:sns:eu-central-1:123456789012:demisto", "Subject":
"SNS-test-subject", "Message": "SNS-test-subject", "Timestamp": "2024-04-11T09:24:33.550Z",
"SignatureVersion": "1", "Signature": "URJNiNbbC3YJAiAL8UGzyTfbwTEh1yKgx1uPdLQ7lPRt5UmQhlgjCsuh76Tjl6IB9bTHrqsWznC6yKYXEABNMnJxpMx8EssnofmmTH+5sEB5nd/yz9U8qMCPP22mSmkGtkAAFwxi0fBo9Pg3mzhitO2l7yo3v//V4KVQu03ggbSqTXnLZNXpN3sAjgrKFfye8x9OJ0NGMdDWrnFOEYMbJEGgetkxjJV/H7L+BCz01W1V+xjPFzbfmWFIyKArjEv7cI2dytQBdIf9QhB7zOYIpKPNz/NMp0a+3e/hxt2rarBLx/sqii5yWDCT/jAVAWBNyv6ZiGQwScWgjuu8ICnzDQ==",
"SigningCertURL": "https://sns.eu-central-1.amazonaws.com/SimpleNotificationService-60eadc530605d63b8e62a523676ef735.pem",
"UnsubscribeURL": "https://sns.eu-central-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-central-1:123456789012:demisto:81273f59-b8ce-423b-842c-31cc19b81cb9"}'
simple: |-
{
"Type": "Notification",
"MessageId": "8b2d1fb3-991d-5620-94db-4122378cde65",
"TopicArn": "{{AWS.SNS.Topics[0].TopicArn}}",
"Subject": "SNS-test-subject",
"Message": "SNS-test-subject",
"Timestamp": "2024-04-11T09:24:33.550Z",
"SignatureVersion": "1",
"Signature": "URJNiNbbC3YJAiAL8UGzyTfbwTEh1yKgx1uPdLQ7lPRt5UmQhlgjCsuh76Tjl6IB9bTHrqsWznC6yKYXEABNMnJxpMx8EssnofmmTH+5sEB5nd/yz9U8qMCPP22mSmkGtkAAFwxi0fBo9Pg3mzhitO2l7yo3v//V4KVQu03ggbSqTXnLZNXpN3sAjgrKFfye8x9OJ0NGMdDWrnFOEYMbJEGgetkxjJV/H7L+BCz01W1V+xjPFzbfmWFIyKArjEv7cI2dytQBdIf9QhB7zOYIpKPNz/NMp0a+3e/hxt2rarBLx/sqii5yWDCT/jAVAWBNyv6ZiGQwScWgjuu8ICnzDQ==",
"SigningCertURL": "https://sns.eu-central-1.amazonaws.com/SimpleNotificationService-60eadc530605d63b8e62a523676ef735.pem",
"UnsubscribeURL": "https://sns.eu-central-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn={{AWS.SNS.Subscriptions[0].SubscriptionArn}}"
}
headers:
simple: x-amz-sns-message-type:Notification
method:
Expand All @@ -68,14 +76,14 @@ tasks:
{
"position": {
"x": 265,
"y": 1245
"y": 1595
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
quietmode: 2
isoversize: false
isautoswitchedtoquietmode: false
"2":
Expand Down Expand Up @@ -103,7 +111,7 @@ tasks:
{
"position": {
"x": 265,
"y": 1770
"y": 2120
}
}
note: false
Expand Down Expand Up @@ -141,7 +149,7 @@ tasks:
{
"position": {
"x": 265,
"y": 1945
"y": 2295
}
}
note: false
Expand Down Expand Up @@ -176,7 +184,7 @@ tasks:
{
"position": {
"x": 265,
"y": 2120
"y": 2470
}
}
note: false
Expand Down Expand Up @@ -252,7 +260,7 @@ tasks:
{
"position": {
"x": 265,
"y": 1420
"y": 1770
}
}
note: false
Expand Down Expand Up @@ -322,7 +330,7 @@ tasks:
{
"position": {
"x": 265,
"y": 1595
"y": 1945
}
}
note: false
Expand All @@ -343,13 +351,14 @@ tasks:
type: title
iscommand: false
brand: ""
description: ''
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 265,
"y": 2295
"y": 2645
}
}
note: false
Expand Down Expand Up @@ -448,7 +457,7 @@ tasks:
brand: ""
nexttasks:
'#none#':
- "1"
- "16"
scriptarguments:
key:
simple: apiurl
Expand All @@ -459,7 +468,7 @@ tasks:
view: |-
{
"position": {
"x": 50,
"x": 480,
"y": 1070
}
}
Expand Down Expand Up @@ -494,7 +503,7 @@ tasks:
view: |-
{
"position": {
"x": 480,
"x": 50,
"y": 895
}
}
Expand All @@ -520,7 +529,7 @@ tasks:
brand: ""
nexttasks:
'#none#':
- "1"
- "16"
scriptarguments:
key:
simple: apiurl
Expand Down Expand Up @@ -556,7 +565,7 @@ tasks:
view: |-
{
"position": {
"x": 480,
"x": 50,
"y": 1070
}
}
Expand All @@ -567,12 +576,88 @@ tasks:
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"16":
id: "16"
taskid: 6a8b002f-2fbd-496d-8e33-ad5cf84e9401
type: regular
task:
id: 6a8b002f-2fbd-496d-8e33-ad5cf84e9401
version: -1
name: Get list of topics
description: Returns a list of the requester's topics.
script: AWS - SNS|||aws-sns-list-topics
type: regular
iscommand: true
brand: AWS - SNS
nexttasks:
'#none#':
- "17"
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 265,
"y": 1245
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"17":
id: "17"
taskid: d7f488a8-c98b-4b82-86d8-a79965f294e0
type: regular
task:
id: d7f488a8-c98b-4b82-86d8-a79965f294e0
version: -1
name: Get subscription by first topic
description: Returns a list of the subscriptions to a specific topic. Each call returns a limited list of subscriptions, up to 100.
script: '|||aws-sns-list-subscriptions-by-topic'
type: regular
iscommand: true
brand: ""
nexttasks:
'#none#':
- "1"
scriptarguments:
topicArn:
complex:
root: AWS.SNS.Topics
accessor: TopicArn
transformers:
- operator: FirstArrayElement
- operator: getField
args:
field:
value:
simple: TopicArn
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 265,
"y": 1420
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
view: |-
{
"linkLabelsPosition": {},
"paper": {
"dimensions": {
"height": 2310,
"height": 2660,
"width": 810,
"x": 50,
"y": 50
Expand All @@ -581,6 +666,8 @@ view: |-
}
inputs: []
outputs: []
marketplaces: ["xsoar_on_prem"]
fromversion: 6.10.0
description: ''
contentitemexportablefields:
contentitemfields: {}
system: true
description: ''
10 changes: 8 additions & 2 deletions Tests/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -5825,9 +5825,15 @@
"playbookID": "Zimperiumv2-TestPlaybook"
},
{
"integrations": "AWS-SNS-Listener",
"integrations": [
"AWS-SNS-Listener",
"AWS - SNS"
],
"playbookID": "AWS SNS Listener - Test",
"instance_names": "AWS-SNS-Listener",
"instance_names": [
"AWS-SNS-Listener",
"AWSSNS"
],
"is_mockable": false
},
{
Expand Down

0 comments on commit 44bbe93

Please sign in to comment.