-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PBENCH-819 This is primarily a minor "cleanup pass" to make some specific example paths more generic and retire a long-standing story. Along the way I also found a few places I'd missed during the REST API changes so I fixed them as well. Finally, I added a `relay.md` API file for the new Relay API. Any other bugs, omissions, or other comments in API documentation could also be considered "in scope" here.
- Loading branch information
Showing
6 changed files
with
190 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# `POST /api/v1/relay/<uri>` | ||
|
||
This API creates a dataset resource by reading data from a Relay server in two | ||
steps. The provided URI represents a "manifest file" stored on the Relay server, | ||
a JSON file (`application/json` MIME format) defining the original tarball name, | ||
the MD5 hash value, optional metadata key/value pairs for the dataset, and a | ||
URI from which the Pbench Server expects to `GET` an `application/octet-stream` | ||
of a file created by `tar` and compressed with the `xz` program. | ||
|
||
Primarily this is expected to be a native Pbench Agent tarball with a specific | ||
structure; however with the `server.archiveonly` metadata key the Pbench Server | ||
can be used to archive and manage metadata for any tarball passed through a | ||
Relay server. | ||
|
||
## URI parameters | ||
|
||
`<uri>` string \ | ||
The Relay server URI of the tarball's manifest `application/json` file. This | ||
must provide the following JSON keys: | ||
|
||
For example, | ||
|
||
```json | ||
{ | ||
"uri": "https://relay.example.com/52adfdd3dbf2a87ed6c1c41a1ce278290064b0455f585149b3dadbe5a0b62f44", | ||
"md5": "22a4bc5748b920c6ce271eb68f08d91c". | ||
"name": "fio_rw_2018.02.01T22.40.57.tar.xz". | ||
"access": "private", | ||
"metadata": ["server.origin:myrelay", "global.agent:cloud1"] | ||
} | ||
``` | ||
|
||
## Manifest file keys | ||
|
||
`access`: [ `private` | `public` ] \ | ||
The desired initial access scope of the dataset. Select `public` to make the | ||
dataset accessible to all clients, or `private` to make the dataset accessible | ||
only to the owner. The default access scope if the key is omitted from the | ||
manifest is `private`. | ||
|
||
For example, `"access": "public"` | ||
|
||
`md5`: tarball MD5 hash \ | ||
The MD5 hash of the compressed tarball file. This must match the actual tarball | ||
octet stream specified by the manifest `uri` key. | ||
|
||
`metadata`: [metadata key/value strings] \ | ||
A set of desired Pbench Server metadata key values to be assigned to the new | ||
dataset. You can set the initial resource name (`dataset.name`), for example, as | ||
well as assigning any keys in the `global` and `user` namespaces. See | ||
[metadata](../metadata.md) for more information. | ||
|
||
In particular the client can set any of: | ||
* `dataset.name`: [default dataset name](../metadata.md#datasetname) | ||
* `server.origin`: [dataset origin](../metadata.md#serverorigin) | ||
* `server.archiveonly`: [suppress indexing](../metadata.md#serverarchiveonly) | ||
* `server.deletion`: [default dataset expiration time](../metadata.md#serverdeletion). | ||
|
||
For example, `?metadata=server.archiveonly:true,global.project:oidc` | ||
|
||
`name`: The original tarball file name \ | ||
The string value must represent a legal filename with the compound type of | ||
`.tar.xz` representing a `tar` archive compressed with the `xz` program. | ||
|
||
`uri`: Relay URI resolving to the tarball file \ | ||
An HTTP `GET` on this URI, exactly as recorded, must return the original tarball | ||
file as an `application/octet-stream`. | ||
|
||
## Request headers | ||
|
||
`authorization: bearer` token \ | ||
*Bearer* schema authorization assigns the ownership of the new dataset to the | ||
authenticated user. E.g., `authorization: bearer <token>` | ||
|
||
`content-length` tarball size \ | ||
The size of the request octet stream in bytes. Generally supplied automatically by | ||
an upload agent such as Python `requests` or `curl`. | ||
|
||
## Response headers | ||
|
||
`content-type: application/json` \ | ||
The return is a serialized JSON object with status information. | ||
|
||
## Response status | ||
|
||
`200` **OK** \ | ||
Successful request. The dataset MD5 hash is identical to that of a dataset | ||
previously uploaded to the Pbench Server. This is assumed to be an identical | ||
tarball. | ||
|
||
`201` **CREATED** \ | ||
The tarball was successfully uploaded and the dataset has been created. | ||
|
||
`400` **BAD_REQUEST** \ | ||
One of the required headers is missing or incorrect, invalid query parameters | ||
were specified, or a bad value was specified for a query parameter. The return | ||
payload will be a JSON document with a `message` field containing details. | ||
|
||
`401` **UNAUTHORIZED** \ | ||
The client is not authenticated. | ||
|
||
`502` **BAD GATEWAY** \ | ||
This means that a problem occurred reading either the manifest file or the | ||
tarball from the Relay server. The return payload will be a JSON document with | ||
a `message` field containing more information. | ||
|
||
`503` **SERVICE UNAVAILABLE** \ | ||
The server has been disabled using the `server-state` server configuration | ||
setting in the [server configuration](./server_config.md) API. The response | ||
body is an `application/json` document describing the current server state, | ||
a message, and optional JSON data provided by the system administrator. | ||
|
||
## Response body | ||
|
||
The `application/json` response body consists of a JSON object giving a detailed | ||
message on success or failure: | ||
|
||
```json | ||
{ | ||
"message": "File successfully uploaded" | ||
} | ||
``` | ||
|
||
or | ||
|
||
```json | ||
{ | ||
"message": "Dataset already exists", | ||
} | ||
``` | ||
|
||
or | ||
|
||
```json | ||
{ | ||
"message": "at least one specified metadata key is invalid", | ||
"errors": [ | ||
"Metadata key 'server.archiveonly' value 'abc' for dataset must be a boolean", | ||
"improper metadata syntax dataset.name=test must be 'k:v'", | ||
"Key test.foo is invalid or isn't settable", | ||
], | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters