Skip to content

Commit

Permalink
Merge pull request #422 from ARGOeu/devel
Browse files Browse the repository at this point in the history
Version 1.3.0
  • Loading branch information
themiszamani authored Aug 1, 2022
2 parents 06bf367 + 400587b commit 609fe99
Show file tree
Hide file tree
Showing 23 changed files with 1,349 additions and 419 deletions.
4 changes: 3 additions & 1 deletion argo-messaging.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Name: argo-messaging
Summary: ARGO Messaging API for broker network
Version: 1.2.0
Version: 1.3.0
Release: 1%{?dist}
License: ASL 2.0
Buildroot: %{_tmppath}/%{name}-buildroot
Expand Down Expand Up @@ -63,6 +63,8 @@ go clean
%attr(0644,root,root) /usr/lib/systemd/system/argo-messaging.service

%changelog
* Fri Jul 29 2022 Agelos Tsalapatis <[email protected]> 1.3.0-1%{?dist}
- AMS release 1.3.0
* Thu May 19 2022 Agelos Tsalapatis <[email protected]> 1.2.0-1%{?dist}
- AMS release 1.2.0
* Mon Nov 8 2021 Agelos Tsalapatis <[email protected]> 1.1.0-1%{?dist}
Expand Down
24 changes: 16 additions & 8 deletions doc/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ swagger: '2.0'
info:
title: argo-messaging-api
description: "ARGO is a lightweight service for Service Level Monitoring designed for medium and large sized e-Infrastructures. This swagger UI interface provides access to the specification of the ARGO messaging api, which can be used to produce or consume messages."
version: "0.9.2"
version: "1.2.0"
contact:
name: ARGO Developers
url: http://argoeu.github.io/
Expand Down Expand Up @@ -891,17 +891,17 @@ paths:
description: Name of the user
required: true
type: string
- name: User information
- name: User roles in the project
in: body
description: Extra user information such as roles and email
description: User roles in the project
required: false
schema:
type: object
properties:
projects:
roles:
type: array
items:
$ref: "#/definitions/ProjectRoles"
type: string
tags:
- Projects
responses:
Expand Down Expand Up @@ -2658,7 +2658,7 @@ definitions:
ackDeadlineSeconds:
type: integer
description: maximum wait time in seconds for Acknowledgement
created_on:
createdOn:
type: string
description: creation date
PushConfigRef:
Expand All @@ -2675,14 +2675,22 @@ definitions:
maxMessages:
type: integer
description: batch size of messages per push action
authorization_header:
authorizationHeader:
$ref: '#/definitions/AuthorizationHeader'
retryPolicy:
$ref: '#/definitions/RetryPolicy'
verification_hash:
verificationHash:
type: string
verified:
type: boolean
mattermostUrl:
type: string
mattermostUsername:
type: string
mattermostChannel:
type: string
base64Decode:
type: boolean

PushStatus:
type: object
Expand Down
12 changes: 3 additions & 9 deletions doc/v1/docs/api_projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,7 @@ curl -X POST -H "Content-Type: application/json"

```json
{
"roles": ["consumer"],
"topics": ["topic1"],
"subscriptions": ["sub1"]
"roles": ["consumer"]
}
```

Expand All @@ -477,12 +475,8 @@ Success Response
"roles": [
"consumer"
],
"topics": [
"topic1"
],
"subscriptions": [
"sub1"
]
"topics": [],
"subscriptions": []
}
],
"name": "NewUSer",
Expand Down
118 changes: 96 additions & 22 deletions doc/v1/docs/api_subs.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Success Response
"name": "projects/BRAND_NEW/subscriptions/alert_engine",
"topic": "projects/BRAND_NEW/topics/monitoring",
"ackDeadlineSeconds": 10 ,
"created_on": "2020-11-19T00:00:00Z"
"createdOn": "2020-11-19T00:00:00Z"
}
```

Expand All @@ -42,10 +42,18 @@ Whenever a subscription is created with a valid push configuration, the service
should be later used to validate the ownership of the registered push endpoint, and will mark the subscription as
unverified.

The `maxMessages` field declares the number of messages that should be send per
The `type` field specifies what kind of push subscription the service will handle.
The `http_endpoint` type is about subscriptions that will forward their messages
to remote http endpoints. The `mattermost` type is about subscriptions that will
forward their messages to mattermost channels through a mattermost webhook.

The `maxMessages` field declares the number of messages that should be sent per
push action. The default value is `1`. If `maxMessages` holds a value of `1` your
push endpoint should expect a request body with the following schema:

The `base64Decode` field indicates that the push mechanism should
decode each message before sending it to the remote destination.

```json
{
"message": {
Expand Down Expand Up @@ -88,12 +96,13 @@ should expect a request body with the following schema:
}
```

## Request to create Push Enabled Subscription
## Request to create Push Enabled Subscription for http_endpoint
```json
{
"topic": "projects/BRAND_NEW/topics/monitoring",
"ackDeadlineSeconds":10,
"pushConfig": {
"type": "http_endpoint",
"pushEndpoint": "https://127.0.0.1:5000/receive_here",
"maxMessages": 3,
"retryPolicy": {
Expand All @@ -112,18 +121,63 @@ should expect a request body with the following schema:
"pushConfig": {
"pushEndpoint": "https://127.0.0.1:5000/receive_here",
"maxMessages": 3,
"authorization_header": {
"authorizationHeader": {
"type": "autogen",
"value": "4551h9j7f7dde380a5f8bc4fdb4fe980c565b67b"
} ,
"retryPolicy": {
"type": "linear",
"period": 1000
},
"verification_hash": "9d5189f7f758e380a5f8bc4fdb4fe980c565b67b",
"verified": false
"verificationHash": "9d5189f7f758e380a5f8bc4fdb4fe980c565b67b",
"verified": false,
"mattermostUrl": "",
"mattermostUsername": "",
"mattermostChannel": ""
},
"created_on": "2020-11-19T00:00:00Z"
"createdOn": "2020-11-19T00:00:00Z"
}
```


## Request to create Push Enabled Subscription for mattermost
```json
{
"topic": "projects/BRAND_NEW/topics/monitoring",
"ackDeadlineSeconds":10,
"pushConfig": {
"type": "mattermost",
"mattermostUrl": "webhook.com",
"mattermostUsername": "mattermost",
"mattermostChannel": "channel",
"retryPolicy": {
"type": "linear",
"period": 1000
}
}
}
```

### Response
```json
{
"name": "projects/BRAND_NEW/subscriptions/alert_engine",
"topic": "projects/BRAND_NEW/topics/monitoring",
"ackDeadlineSeconds": 10,
"pushConfig": {
"pushEndpoint": "",
"maxMessages": 1,
"retryPolicy": {
"type": "linear",
"period": 1000
},
"verificationHash": "",
"verified": true,
"mattermostUrl": "webhook.com",
"mattermostUsername": "mattermost",
"mattermostChannel": "channel"
},
"createdOn": "2020-11-19T00:00:00Z"
}
```

Expand Down Expand Up @@ -182,14 +236,14 @@ unverified.
The owner of the push endpoint needs to execute the following steps in order to verify the ownership of the
registered endpoint.

- Open an api call with a path of `/ams_verification_hash`. The service will try to access this path using the `host:port`
- Open an api call with a path of `/ams_verificationHash`. The service will try to access this path using the `host:port`
of the push endpoint. For example, if the push endpoint is `https://example.com:8443/receive_here`, the push endpoint should also
support the api route of `https://example.com:8443/ams_verification_hash`.
support the api route of `https://example.com:8443/ams_verificationHash`.

- The api route of `https://example.com:8443/ams_verification_hash` should support the http `GET` method.
- The api route of `https://example.com:8443/ams_verificationHash` should support the http `GET` method.

- A `GET` request to `https://example.com:8443/ams_verification_hash` should return a response body
with only the `verification_hash`
- A `GET` request to `https://example.com:8443/ams_verificationHash` should return a response body
with only the `verificationHash`
that is found inside the subscriptions push configuration,
a `status code` of `200` and the header `Content-type: plain/text`.

Expand Down Expand Up @@ -279,14 +333,14 @@ Success Response
"topic": "projects/BRAND_NEW/topics/monitoring",
"pushConfig": {},
"ackDeadlineSeconds": 10,
"created_on": "2020-11-19T00:00:00Z"
"createdOn": "2020-11-19T00:00:00Z"
},
{
"name": "projects/BRAND_NEW/subscriptions/alert_engine2",
"topic": "projects/BRAND_NEW/topics/monitoring",
"pushConfig": {},
"ackDeadlineSeconds": 10,
"created_on": "2020-11-19T00:00:00Z"
"createdOn": "2020-11-19T00:00:00Z"
}],
"nextPageToken": "",
"totalSize": 2
Expand Down Expand Up @@ -321,7 +375,7 @@ Success Response
"topic": "projects/BRAND_NEW/topics/monitoring",
"pushConfig": {},
"ackDeadlineSeconds": 10,
"created_on": "2020-11-19T00:00:00Z"
"createdOn": "2020-11-19T00:00:00Z"
}
],
"nextPageToken": "",
Expand Down Expand Up @@ -357,7 +411,7 @@ Success Response
"topic": "projects/BRAND_NEW/topics/monitoring",
"pushConfig": {},
"ackDeadlineSeconds": 10,
"created_on": "2020-11-19T00:00:00Z"
"createdOn": "2020-11-19T00:00:00Z"
}
],
"nextPageToken": "some_token",
Expand Down Expand Up @@ -521,19 +575,38 @@ This request modifies the push configuration of a subscription
### Request
`POST /v1/projects/{project_name}/subscriptions/{subscription_name}:modifyPushConfig`

### Post body:
```
### Post body for http_endpoint
```json
{
"pushConfig":{
"pushEndpoint":"",
"type": "http_endpoint",
"pushEndpoint":"example.com",
"maxMessages": 5,
"authorization_header": {
"authorizationHeader": {
"type": "autogen"
},
"retryPolicy":{
"type":"linear",
"period":300
}
},
"base64Decode": false
}
}
```

### Post body for mattermost
```json
{
"pushConfig":{
"type": "mattermost",
"retryPolicy":{
"type":"linear",
"period":300
},
"mattermostUrl": "webhook.com",
"mattermostUsername": "willy",
"mattermostChannel": "ops",
"base64Decode": true
}
}
```
Expand Down Expand Up @@ -561,9 +634,10 @@ curl -X POST -H "Content-Type: application/json"
```

### post body:
```
```json
{
"pushConfig":{
"type": "http_endpoint",
"pushEndpoint":"host:example.com:8080/path/to/hook",
"maxMessages": 3,
"retryPolicy":{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ARGOeu/argo-messaging

go 1.14
go 1.15

require (
github.com/BurntSushi/toml v0.3.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions handlers/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,6 @@ func ProjectUserAdd(w http.ResponseWriter, r *http.Request) {
userProjects = append(userProjects, auth.ProjectRoles{
Project: projName,
Roles: data.Roles,
Subs: data.Subs,
Topics: data.Topics,
})

_, err = auth.UpdateUser(userUUID, userFN, userLN, userOrg, userDesc, userName, userProjects, userEmail, userSRoles, modified, false, refStr)
Expand Down
Loading

0 comments on commit 609fe99

Please sign in to comment.