ves-io-schema-api_credential-CustomAPI-Revoke

Examples of performing api_credential CustomAPI Revoke

Usecase:

Create API Token for user-1 of acmecorp

Request:

Request using vesctl:

vesctl request rpc api_credential.CustomAPI.Revoke -i request.yaml --uri /public/namespaces/system/api_credentials --http-method POST

where file request.yaml has following contents:

expirationTimestamp: "2020-10-06T10:49:55.061637700Z"
name: user-1-token-3
namespace: documentation
spec:
  type: API_TOKEN

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"namespace":"documentation","name":"user-1-token-3","spec":{"type":"API_TOKEN"},"expirationTimestamp":"2020-10-06T10:49:55.061637700Z"}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build013258245_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/system/api_credentials'

curl response:

HTTP/1.1 200 OK
Content-Length: 30
Content-Type: application/json
Date: Wed, 16 Sep 2020 10:49:58 GMT
Vary: Accept-Encoding

{
  "data": "",
  "name": ""
}

Usecase:

Revoke above api credential object

Request:

Request using vesctl:

vesctl request rpc api_credential.CustomAPI.Revoke -i request.yaml --uri /public/namespaces/system/revoke/api_credentials --http-method POST

where file request.yaml has following contents:

name: user-1-token-3-308dfd5c-13db-46cc-9e9e-b939a7bdbde0

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"name":"user-1-token-3-308dfd5c-13db-46cc-9e9e-b939a7bdbde0"}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build013258245_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/system/revoke/api_credentials'

curl response:

HTTP/1.1 200 OK
Content-Length: 21
Content-Type: application/json
Date: Wed, 16 Sep 2020 10:49:58 GMT
Vary: Accept-Encoding

{
  "status": false
}