Skip to content

Commit

Permalink
Merge pull request #135 from whdalsrnt/master
Browse files Browse the repository at this point in the history
Change Webhook Response
  • Loading branch information
whdalsrnt authored Jul 25, 2024
2 parents 59f1e0e + 71cdcd4 commit b986d19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 13 additions & 0 deletions src/spaceone/monitoring/info/webhook_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
__all__ = ["WebhookInfo", "WebhooksInfo"]


def WebhookRequests(vo):
if vo:
info = {
"total": vo.total,
"error": vo.error,
}
return webhook_pb2.WebhookRequests(**info)
else:
return None


def PluginInfo(vo):
if vo:
info = {
Expand Down Expand Up @@ -46,6 +57,8 @@ def WebhookInfo(webhook_vo: Webhook, minimal=False):
"access_key": webhook_vo.access_key,
"capability": change_struct_type(webhook_vo.capability),
"plugin_info": PluginInfo(webhook_vo.plugin_info),
"tags": change_struct_type(webhook_vo.tags),
"requests": WebhookRequests(webhook_vo.requests),
"domain_id": webhook_vo.domain_id,
"created_at": utils.datetime_to_iso8601(webhook_vo.created_at),
}
Expand Down
8 changes: 0 additions & 8 deletions src/spaceone/monitoring/service/job_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ def create_alert_notification(self, params):
"ERROR",
notification_level=notification_level,
has_callback=True,
has_short_description=True,
)
notification_mgr.create_notification(message, domain_id)

Expand Down Expand Up @@ -455,7 +454,6 @@ def _create_message(
notification_type: str,
notification_level="ALL",
has_callback=False,
has_short_description=False,
user_id=None,
):
domain_id = alert_vo.domain_id
Expand Down Expand Up @@ -533,12 +531,6 @@ def _create_message(
if alert_vo.image_url:
message["image_url"] = alert_vo.image_url

if has_short_description:
# TODO: Need to change multiple language
message[
"short_description"
] = f'경고! 장애 발생! {project_name.replace(" >", "의")} 프로젝트에 장애가 발생했습니다.'

return {
"resource_type": resource_type,
"resource_id": resource_id,
Expand Down

0 comments on commit b986d19

Please sign in to comment.