ves-io-schema-api_credential-CustomAPI-CreateServiceCredentials

Examples of performing api_credential CustomAPI CreateServiceCredentials

Usecase:

Create service credentials

Request:

Request using vesctl:

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

where file request.yaml has following contents:

expirationDays: 20
name: user-1-service-creds
namespace: documentation
namespaceRoles:
- namespace: system
  role: ves-io-monitor-role
- namespace: shared
  role: ves-io-monitor-role
- namespace: app-ns1
  role: ves-io-developer-role
type: SERVICE_API_TOKEN

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"type":"SERVICE_API_TOKEN","namespace":"documentation","name":"user-1-service-creds","namespaceRoles":[{"namespace":"system","role":"ves-io-monitor-role"},{"namespace":"shared","role":"ves-io-monitor-role"},{"namespace":"app-ns1","role":"ves-io-developer-role"}],"expirationDays":20}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build970361017_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/system/service_credentials'

curl response:

HTTP/1.1 200 OK
Content-Length: 30
Content-Type: application/json
Date: Wed, 25 Aug 2021 09:02:32 GMT
Vary: Accept-Encoding

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