Skip to content

Commit

Permalink
Merge pull request #232 from solace-iot-team/feat-app-status-webhook-…
Browse files Browse the repository at this point in the history
…name

Feat app status webhook name
  • Loading branch information
195858 authored Apr 22, 2022
2 parents 5ef0857 + 4bd3347 commit cc04c43
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
11 changes: 6 additions & 5 deletions api-implementation/server/api/services/broker/statusservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ class StatusService {
const bindingStatus: MsgVpnRestDeliveryPointQueueBindingResponse = await apiClient.getMsgVpnRestDeliveryPointQueueBinding(service.msgVpnName, app.internalName, app.internalName);
const q: MsgVpnQueueResponse = await apiClient.getMsgVpnQueue(service.msgVpnName, encodeURIComponent(app.internalName));
const up: boolean = c.up && (consumerStatus.data && consumerStatus.data.up) && (bindingStatus.data && bindingStatus.data.up);

const wh: WebHook = this.getWebHook(app, envName);
const conn: WebHookStatus = {
up: up,
failureReason: up ? '' : `${c.lastFailureReason} (${consumerStatus.data.lastConnectionFailureReason})`,
lastFailureTime: c.lastFailureTime,
messagesQueued: q.collections.msgs.count,
messagesQueuedMB: (q.data.msgSpoolUsage / 1048576),
uri: this.getWebHookURI(app, envName),
uri: wh.uri,
name: wh.name?wh.name:wh.uri,
}
webHooks.push(conn);
}
Expand Down Expand Up @@ -157,7 +158,7 @@ class StatusService {
}
}

private getWebHookURI(app: App, envName: string): string {
private getWebHook(app: App, envName: string): WebHook {
let wh: WebHook;
// try to locate specific web hook for this environment
wh = app.webHooks.find(w => w.environments && w.environments.find(e => e == envName));
Expand All @@ -166,9 +167,9 @@ class StatusService {
wh = app.webHooks.find(w => (w.environments === undefined || w.environments.length == 0));
}
if (wh) {
return wh.uri;
return wh;
} else {
return '';
return null;
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion api-implementation/server/common/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Solace API Management Connector
description: 'Solace API Management Connector API. Note: basic authentication security mechanism is deprecated.'
version: 0.7.10
version: 0.7.11
servers:
- url: /v1

Expand Down Expand Up @@ -1210,6 +1210,11 @@ components:
pattern: "^https?:\\/\\/[A-Za-z\\.:0-9\\-]*.*$"
minLength: 0
maxLength: 200
name:
type: string
minLength: 3
maxLength: 200
pattern: ^.*$
up:
description: indicates if the webhook is up and running
type: boolean
Expand Down
1 change: 1 addition & 0 deletions api-implementation/src/model/@types/api-model/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@ declare namespace Components {
}
export interface WebHookStatus {
uri?: string; // ^https?:\/\/[A-Za-z\.:0-9\-]*.*$
name?: string; // ^.*$
/**
* indicates if the webhook is up and running
* example:
Expand Down

0 comments on commit cc04c43

Please sign in to comment.