docs : documentation for new endpoints
This commit is contained in:
parent
79edb50f65
commit
c72ade8dab
2 changed files with 65 additions and 2 deletions
65
README.md
65
README.md
|
@ -179,13 +179,76 @@ Errors:
|
||||||
```json
|
```json
|
||||||
{"result": "error", "error": "no valid key"}
|
{"result": "error", "error": "no valid key"}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Success
|
#### Success
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{"result": "success", "success": "key valid"}
|
{"result": "success", "success": "key valid"}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### POST /ldap/ssh
|
||||||
|
Returns array of SSH keys associated with the Skynet account
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"auth" : {
|
||||||
|
"user": "username",
|
||||||
|
"pass": "password"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
#### Errors
|
||||||
|
```json
|
||||||
|
{"result": "error", "error": "Failed to authenticate"}
|
||||||
|
```
|
||||||
|
#### Success
|
||||||
|
```json
|
||||||
|
{"result": "success", "success": ["key1","key2","key3"]}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DELETE /ldap/ssh
|
||||||
|
Deletes SSH key from Skynet account
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"auth" : {
|
||||||
|
"user": "username",
|
||||||
|
"pass": "password"
|
||||||
|
},
|
||||||
|
"key": "ssh key"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
#### Errors
|
||||||
|
```json
|
||||||
|
{"result": "error", "error": "Failed to authenticate"}
|
||||||
|
```
|
||||||
|
```json
|
||||||
|
{"result": "error", "error": "Failed to remove key"}
|
||||||
|
```
|
||||||
|
#### Success
|
||||||
|
```json
|
||||||
|
{"result": "success"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### POST /ldap/ssh/add
|
||||||
|
Adds SSH key to Skynet account
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"auth" : {
|
||||||
|
"user": "username",
|
||||||
|
"pass": "password"
|
||||||
|
},
|
||||||
|
"key": "ssh key"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
#### Errors
|
||||||
|
```json
|
||||||
|
{"result": "error", "error": "Failed to authenticate"}
|
||||||
|
```
|
||||||
|
```json
|
||||||
|
{"result": "error", "error": "Failed to add key"}
|
||||||
|
```
|
||||||
|
#### Success
|
||||||
|
```json
|
||||||
|
{"result": "success"}
|
||||||
|
```
|
||||||
## Responses
|
## Responses
|
||||||
|
|
||||||
Generic responses which is used unless otherwise specified above.
|
Generic responses which is used unless otherwise specified above.
|
||||||
|
|
|
@ -64,7 +64,7 @@ pub async fn remove_ssh_key(mut req: Request<State>) -> tide::Result {
|
||||||
Ok(_) => Ok(json!({"result": "success"}).into()),
|
Ok(_) => Ok(json!({"result": "success"}).into()),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
dbg!(e);
|
dbg!(e);
|
||||||
Ok(json!({"result": "error", "error": "Failed to add key"}).into())
|
Ok(json!({"result": "error", "error": "Failed to remove key"}).into())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue