Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN make install-code-generation-tools
# copy api related source files and generate api docs
COPY pkg/web pkg/web
COPY pkg/models pkg/models
COPY pkg/entities pkg/entities
Comment thread
mgoetzegb marked this conversation as resolved.
Outdated
RUN make api-docs

# copy rest of the source files
Expand Down
153 changes: 151 additions & 2 deletions api/notificationservice/notificationservice_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,40 @@ const docTemplatenotificationservice = `{
}
}
},
"/rules/ruleoptions": {
"get": {
"security": [
{
"KeycloakAuth": []
}
],
"description": "Returns all required options to create a new notification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"rule"
],
"summary": "Options to create a new notification",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.RuleOptions"
},
"headers": {
"api-version": {
"type": "string",
"description": "API version"
}
}
}
}
}
},
"/rules/{id}": {
"put": {
"security": [
Expand Down Expand Up @@ -1301,6 +1335,21 @@ const docTemplatenotificationservice = `{
}
},
"definitions": {
"entities.Origin": {
"type": "object",
"properties": {
"class": {
"type": "string"
},
"name": {
"type": "string"
},
"serviceID": {
"description": "read-only",
"type": "string"
}
}
},
"errorResponses.ErrorResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1672,12 +1721,16 @@ const docTemplatenotificationservice = `{
"readOnly": true
},
"level": {
"type": "string",
"enum": [
"info",
"warning",
"error",
"urgent"
],
"allOf": [
{
"$ref": "#/definitions/notifications.Level"
}
]
},
"origin": {
Expand All @@ -1701,6 +1754,64 @@ const docTemplatenotificationservice = `{
}
}
},
"models.NotificationChannel": {
"type": "object",
"required": [
"channelType"
],
"properties": {
"channelName": {
"type": "string"
},
"channelType": {
"$ref": "#/definitions/models.ChannelType"
},
"createdAt": {
"type": "string",
"readOnly": true
},
"description": {
"type": "string"
},
"domain": {
"type": "string"
},
"id": {
"type": "string",
"readOnly": true
},
"isAuthenticationRequired": {
"type": "boolean"
},
"isTlsEnforced": {
"type": "boolean"
},
"maxEmailAttachmentSizeMb": {
"type": "integer"
},
"maxEmailIncludeSizeMb": {
"type": "integer"
},
"password": {
"type": "string"
},
"port": {
"type": "integer"
},
"senderEmailAddress": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"username": {
"type": "string"
},
"webhookUrl": {
"type": "string"
}
}
},
"models.Origin": {
"type": "object",
"required": [
Expand Down Expand Up @@ -1777,6 +1888,29 @@ const docTemplatenotificationservice = `{
}
}
},
"models.RuleOptions": {
"type": "object",
"properties": {
"channels": {
"type": "array",
"items": {
"$ref": "#/definitions/models.NotificationChannel"
}
},
"levels": {
"type": "array",
"items": {
"$ref": "#/definitions/notifications.Level"
}
},
"origins": {
"type": "array",
"items": {
"$ref": "#/definitions/entities.Origin"
}
}
}
},
"models.Trigger": {
"type": "object",
"required": [
Expand All @@ -1787,7 +1921,7 @@ const docTemplatenotificationservice = `{
"levels": {
"type": "array",
"items": {
"type": "string"
"$ref": "#/definitions/notifications.Level"
}
},
"origins": {
Expand All @@ -1804,6 +1938,21 @@ const docTemplatenotificationservice = `{
"type": "string"
}
},
"notifications.Level": {
"type": "string",
"enum": [
"info",
"warning",
"error",
"urgent"
],
"x-enum-varnames": [
"LevelInfo",
"LevelWarning",
"LevelError",
"LevelUrgent"
]
},
"paging.Request": {
"type": "object",
"properties": {
Expand Down
102 changes: 100 additions & 2 deletions api/notificationservice/notificationservice_swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
basePath: /api/notification-service
definitions:
entities.Origin:
properties:
class:
type: string
name:
type: string
serviceID:
description: read-only
type: string
type: object
errorResponses.ErrorResponse:
properties:
details:
Expand Down Expand Up @@ -269,12 +279,13 @@ definitions:
readOnly: true
type: string
level:
allOf:
- $ref: '#/definitions/notifications.Level'
enum:
- info
- warning
- error
- urgent
type: string
origin:
description: name of the origin, e.g. `SBOM - React`
type: string
Expand All @@ -298,6 +309,45 @@ definitions:
- timestamp
- title
type: object
models.NotificationChannel:
properties:
channelName:
type: string
channelType:
$ref: '#/definitions/models.ChannelType'
createdAt:
readOnly: true
type: string
description:
type: string
domain:
type: string
id:
readOnly: true
type: string
isAuthenticationRequired:
type: boolean
isTlsEnforced:
type: boolean
maxEmailAttachmentSizeMb:
type: integer
maxEmailIncludeSizeMb:
type: integer
password:
type: string
port:
type: integer
senderEmailAddress:
type: string
updatedAt:
type: string
username:
type: string
webhookUrl:
type: string
required:
- channelType
type: object
models.Origin:
properties:
class:
Expand Down Expand Up @@ -351,11 +401,26 @@ definitions:
- name
- trigger
type: object
models.RuleOptions:
properties:
channels:
items:
$ref: '#/definitions/models.NotificationChannel'
type: array
levels:
items:
$ref: '#/definitions/notifications.Level'
type: array
origins:
items:
$ref: '#/definitions/entities.Origin'
type: array
type: object
models.Trigger:
properties:
levels:
items:
type: string
$ref: '#/definitions/notifications.Level'
type: array
origins:
items:
Expand All @@ -369,6 +434,18 @@ definitions:
additionalProperties:
type: string
type: object
notifications.Level:
enum:
- info
- warning
- error
- urgent
type: string
x-enum-varnames:
- LevelInfo
- LevelWarning
- LevelError
- LevelUrgent
paging.Request:
properties:
index:
Expand Down Expand Up @@ -1287,6 +1364,27 @@ paths:
summary: Update Rule
tags:
- rule
/rules/ruleoptions:
get:
consumes:
- application/json
description: Returns all required options to create a new notification
produces:
- application/json
responses:
"200":
description: OK
headers:
api-version:
description: API version
type: string
schema:
$ref: '#/definitions/models.RuleOptions'
security:
- KeycloakAuth: []
summary: Options to create a new notification
tags:
- rule
/rulse/{id}:
get:
description: Returns the rule
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/golang-migrate/migrate/v4 v4.19.1
github.com/google/uuid v1.6.0
github.com/greenbone/keycloak-client-golang v0.2.3
github.com/greenbone/opensight-golang-libraries v1.31.1
github.com/greenbone/opensight-golang-libraries v1.31.2-alpha1
github.com/jmoiron/sqlx v1.4.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/lib/pq v1.11.2
Expand Down Expand Up @@ -51,6 +51,8 @@ require (
github.com/go-resty/resty/v2 v2.17.2 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jonboulle/clockwork v0.5.0 // indirect
Expand Down
Loading
Loading