Skip to content

Commit 23600f6

Browse files
committed
Add Pubrio component: validate_webhook.py
1 parent 6126c0f commit 23600f6

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import json
2+
3+
from lfx.custom.custom_component.component import Component
4+
from lfx.inputs.inputs import MessageTextInput, SecretStrInput
5+
from lfx.schema.data import Data
6+
from lfx.schema.dataframe import DataFrame
7+
from lfx.template.field.base import Output
8+
9+
from ._base import pubrio_post
10+
11+
12+
class PubrioValidateWebhookComponent(Component):
13+
display_name = "Pubrio Validate Webhook"
14+
description = "Validate a webhook destination URL."
15+
icon = "activity"
16+
name = "PubrioValidateWebhook"
17+
18+
inputs = [
19+
SecretStrInput(name="api_key", display_name="Pubrio API Key", required=True),
20+
MessageTextInput(name="webhook_url", display_name="Webhook URL", info="Webhook URL to validate.", tool_mode=True),
21+
]
22+
23+
outputs = [
24+
Output(display_name="Result", name="result", method="run"),
25+
]
26+
27+
def run(self) -> DataFrame:
28+
result = pubrio_post(self.api_key, "/monitors/webhook/validate", {"webhook_url": self.webhook_url})
29+
data = [Data(text=json.dumps(result), data=result if isinstance(result, dict) else {"result": result})]
30+
self.status = data
31+
return DataFrame(data)

0 commit comments

Comments
 (0)