Skip to content

Commit

Permalink
all: fix incorrect API paths
Browse files Browse the repository at this point in the history
Based on `openapi.yaml`, singular is correct.

Signed-off-by: Sandro Jäckel <[email protected]>
Signed-off-by: Hank Donnay <[email protected]>
  • Loading branch information
SuperSandro2000 authored and hdonnay committed Nov 27, 2023
1 parent 244183e commit 55294aa
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions Documentation/concepts/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ The interested client can subscribe to notifications via several mechanisms:
* AMQP delivery
* STOMP delivery

Configuring the notifier is done via the yaml configuration.
Configuring the notifier is done via the yaml configuration.

See the "Notifier" object in our [config reference](../reference/config.md)

## A Notification

When the notifier becomes aware of new vulnerabilities affecting a previously indexed manifest, it will use the configured method(s) to issue notifications about the new changes. Any given notification expresses the **most severe** vulnerability discovered because of the change. This avoids creating a flurry of notifications for the same security database update.
When the notifier becomes aware of new vulnerabilities affecting a previously indexed manifest, it will use the configured method(s) to issue notifications about the new changes. Any given notification expresses the **most severe** vulnerability discovered because of the change. This avoids creating a flurry of notifications for the same security database update.

Once a client receives a notification, it should issue a new request against the [matcher](../reference/matcher.md) to receive an up-to-date vulnerability report.

Expand Down Expand Up @@ -53,7 +53,7 @@ type VulnSummary struct {
When you configure notifier for webhook delivery you provide the service with the following pieces of information:
* A target URL where the webhook will fire
* The callback URL where the notifier may be reached including its API path
* e.g. "http://clair-notifier/notifier/api/v1/notifications"
* e.g. "http://clair-notifier/notifier/api/v1/notification"

When the notifier has determined an updated security database has changed the affected status of an indexed manifest, it will deliver the following JSON body to the configured target:
```json
Expand All @@ -75,15 +75,15 @@ The callback endpoint specification follows:
GET /notifier/api/v1/notification/{id}?[page_size=N][next=N]
{
page: {
size: int, // maximum number of notifications in the response
size: int, // maximum number of notifications in the response
next: string, // if present, the next id to fetch.
}
notifications: [ Notification… ] // array of notifications; max len == page.size
}
```
The GET callback request implements a simple bare-minimum paging mechanism.

The "page_size" url param controls how many notifications are returned in a single page.
The "page_size" url param controls how many notifications are returned in a single page.
If not provided a default of 500 is used.

The "next" url param informs Clair the next set of paged notifications to return. If not provided the 0th page is assumed.
Expand All @@ -99,10 +99,10 @@ When the final page is served to the client the returned "page" data structure w
Therefore the following loop is valid for obtaining all notifications for a notification id in pages of a specified size.

```
{ page, notifications } = http.Get("http://clairv4/notifier/api/v1/notifications/{id}?page_size=1000")
{ page, notifications } = http.Get("http://clairv4/notifier/api/v1/notification/{id}?page_size=1000")
while (page.Next != None) {
{ page, notifications } = http.Get("http://clairv4/notifier/api/v1/notifications/{id}?next={page.Next},page_size=1000")
{ page, notifications } = http.Get("http://clairv4/notifier/api/v1/notification/{id}?next={page.Next},page_size=1000")
}
```

Expand Down
2 changes: 1 addition & 1 deletion Documentation/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ PagedNotifications
```json
{
"notification_id": "269886f3-0146-4f08-9bf7-cb1138d48643",
"callback": "http://clair-notifier/notifier/api/v1/notifications/269886f3-0146-4f08-9bf7-cb1138d48643"
"callback": "http://clair-notifier/notifier/api/v1/notification/269886f3-0146-4f08-9bf7-cb1138d48643"
}

```
Expand Down
6 changes: 3 additions & 3 deletions config.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ notifier:
# webhook, amqp, stomp
webhook:
target: "http://webhook/"
callback: "http://clair-notifier/notifier/api/v1/notifications"
callback: "http://clair-notifier/notifier/api/v1/notification"
amqp:
exchange:
name: ""
Expand All @@ -75,15 +75,15 @@ notifier:
uris: ["amqp://user:pass@host:10000/vhost"]
direct: false
routing_key: "notifications"
callback: "http://clair-notifier/notifier/api/v1/notifications"
callback: "http://clair-notifier/notifier/api/v1/notification"
tls:
root_ca: "optional/path/to/rootca"
cert: "madatory/path/to/cert"
key: "madatory/path/to/key"
stomp:
desitnation: "notifications"
direct: false
callback: "http://clair-notifier/notifier/api/v1/notifications"
callback: "http://clair-notifier/notifier/api/v1/notification"
login:
login: "username"
passcode: "passcode"
Expand Down
2 changes: 1 addition & 1 deletion httptransport/openapi.etag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"eee376f6eb502c8b9e413b131b81d700d185927f607474fdf80a237a1cc5294d"
"acbb3fe61fedf4781e276a401f5a87b505e23a2bebdb878fc61f045cfe2d9817"
2 changes: 1 addition & 1 deletion httptransport/openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion local-dev/clair/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ notifier:
# auto_delete: false
# uris: ["amqp://guest:guest@clair-rabbitmq:5672/"]
# routing_key: "notifications"
# callback: "http://clair-notifier/notifier/api/v1/notifications"
# callback: "http://clair-notifier/notifier/api/v1/notification"
# tracing and metrics config
trace:
name: "jaeger"
Expand Down
2 changes: 1 addition & 1 deletion notifier/amqp/deliverer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestDeliverer(t *testing.T) {
integration.Skip(t)
ctx := zlog.Test(context.Background(), t)
const (
callback = "http://clair-notifier/notifier/api/v1/notifications"
callback = "http://clair-notifier/notifier/api/v1/notification"
)
var (
uri = os.Getenv("RABBITMQ_CONNECTION_STRING")
Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ components:
description: "the url where notifications can be retrieved"
type: string
example: >-
http://clair-notifier/notifier/api/v1/notifications/269886f3-0146-4f08-9bf7-cb1138d48643
http://clair-notifier/notifier/api/v1/notification/269886f3-0146-4f08-9bf7-cb1138d48643
VulnSummary:
title: VulnSummary
Expand Down

0 comments on commit 55294aa

Please sign in to comment.