TASK: Add codeblocks to code examples

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Simon 2021-01-19 16:39:26 +01:00 committed by Sebastiaan van Stijn
parent 96357c9616
commit b2ac3a2884

View file

@ -29,7 +29,8 @@ order is not guaranteed.
To setup a registry instance to send notifications to endpoints, one must add To setup a registry instance to send notifications to endpoints, one must add
them to the configuration. A simple example follows: them to the configuration. A simple example follows:
notifications: ```yaml
notifications:
endpoints: endpoints:
- name: alistener - name: alistener
url: https://mylistener.example.com/event url: https://mylistener.example.com/event
@ -38,6 +39,7 @@ them to the configuration. A simple example follows:
timeout: 500ms timeout: 500ms
threshold: 5 threshold: 5
backoff: 1s backoff: 1s
```
The above would configure the registry with an endpoint to send events to The above would configure the registry with an endpoint to send events to
`https://mylistener.example.com/event`, with the header "Authorization: Bearer `https://mylistener.example.com/event`, with the header "Authorization: Bearer
@ -123,10 +125,12 @@ contains a subset of the data contained in Get and Put events. Specifically,
only the digest and repository are sent. only the digest and repository are sent.
```json ```json
"target": { {
"target": {
"digest": "sha256:d89e1bee20d9cb344674e213b581f14fbd8e70274ecf9d10c514bab78a307845", "digest": "sha256:d89e1bee20d9cb344674e213b581f14fbd8e70274ecf9d10c514bab78a307845",
"repository": "library/test" "repository": "library/test"
}, }
}
``` ```
> **Note**: As of version 2.1, the `length` field for event targets > **Note**: As of version 2.1, the `length` field for event targets
@ -140,7 +144,7 @@ The envelope contains one or more events, with the following json structure:
```json ```json
{ {
"events": [ ... ], "events": [ "..." ]
} }
``` ```
@ -155,8 +159,8 @@ request coming to an endpoint.
An example of a full event may look as follows: An example of a full event may look as follows:
```json ```
GET /callback GET /callback HTTP/1.1
Host: application/vnd.docker.distribution.events.v1+json Host: application/vnd.docker.distribution.events.v1+json
Authorization: Bearer <your token, if needed> Authorization: Bearer <your token, if needed>
Content-Type: application/vnd.docker.distribution.events.v1+json Content-Type: application/vnd.docker.distribution.events.v1+json
@ -263,49 +267,50 @@ The following provides an example of a few endpoints that have experienced
several failures and have since recovered: several failures and have since recovered:
```json ```json
"notifications":{ {
"endpoints":[ "notifications": {
"endpoints": [
{ {
"name":"local-5003", "name": "local-5003",
"url":"http://localhost:5003/callback", "url": "http://localhost:5003/callback",
"Headers":{ "Headers": {
"Authorization":[ "Authorization": [
"Bearer \u003can example token\u003e" "Bearer \u003can example token\u003e"
] ]
}, },
"Timeout":1000000000, "Timeout": 1000000000,
"Threshold":10, "Threshold": 10,
"Backoff":1000000000, "Backoff": 1000000000,
"Metrics":{ "Metrics": {
"Pending":76, "Pending": 76,
"Events":76, "Events": 76,
"Successes":0, "Successes": 0,
"Failures":0, "Failures": 0,
"Errors":46, "Errors": 46,
"Statuses":{ "Statuses": {
} }
} }
}, },
{ {
"name":"local-8083", "name": "local-8083",
"url":"http://localhost:8083/callback", "url": "http://localhost:8083/callback",
"Headers":null, "Headers": null,
"Timeout":1000000000, "Timeout": 1000000000,
"Threshold":10, "Threshold": 10,
"Backoff":1000000000, "Backoff": 1000000000,
"Metrics":{ "Metrics": {
"Pending":0, "Pending": 0,
"Events":76, "Events": 76,
"Successes":76, "Successes": 76,
"Failures":0, "Failures": 0,
"Errors":28, "Errors": 28,
"Statuses":{ "Statuses": {
"202 Accepted":76 "202 Accepted": 76
} }
} }
} }
] ]
}
} }
``` ```