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,6 +29,7 @@ order is not guaranteed.
To setup a registry instance to send notifications to endpoints, one must add
them to the configuration. A simple example follows:
```yaml
notifications:
endpoints:
- name: alistener
@ -38,6 +39,7 @@ them to the configuration. A simple example follows:
timeout: 500ms
threshold: 5
backoff: 1s
```
The above would configure the registry with an endpoint to send events to
`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.
```json
{
"target": {
"digest": "sha256:d89e1bee20d9cb344674e213b581f14fbd8e70274ecf9d10c514bab78a307845",
"repository": "library/test"
},
}
}
```
> **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
{
"events": [ ... ],
"events": [ "..." ]
}
```
@ -155,8 +159,8 @@ request coming to an endpoint.
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
Authorization: Bearer <your token, if needed>
Content-Type: application/vnd.docker.distribution.events.v1+json
@ -263,6 +267,7 @@ The following provides an example of a few endpoints that have experienced
several failures and have since recovered:
```json
{
"notifications": {
"endpoints": [
{
@ -283,7 +288,6 @@ several failures and have since recovered:
"Failures": 0,
"Errors": 46,
"Statuses": {
}
}
},
@ -307,6 +311,7 @@ several failures and have since recovered:
}
]
}
}
```
If using notification as part of a larger application, it is _critical_ to