ves-io-schema-api_credential-CustomAPI-Create

Examples of performing api_credential CustomAPI Create

Usecase:

Create kubeconfig for vk8s-documentation for user-1

Request:

Request using vesctl:

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

where file request.yaml has following contents:

name: user-1-kubeconfig
namespace: documentation
spec:
  type: KUBE_CONFIG
  users:
  - name: user-1@acmecorp.com
    uid: d1abcbba-4fc8-4a34-bf76-6e8e1c6f2e81
  virtualK8sName: vk8s-documentation
  virtualK8sNamespace: documentation

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"namespace":"documentation","name":"user-1-kubeconfig","spec":{"type":"KUBE_CONFIG","users":[{"uid":"d1abcbba-4fc8-4a34-bf76-6e8e1c6f2e81","name":"user-1@acmecorp.com"}],"virtualK8sNamespace":"documentation","virtualK8sName":"vk8s-documentation"}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build144460626_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: 16
Content-Type: application/json
Date: Fri, 15 May 2020 10:52:27 GMT
Vary: Accept-Encoding

{
  "data": ""
}

Usecase:

Create client certificate for user-1 of acmecorp

Request:

Request using vesctl:

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

where file request.yaml has following contents:

name: user-1-cert
namespace: documentation
spec:
  users:
  - name: user-1@acmecorp.com
    uid: d1abcbba-4fc8-4a34-bf76-6e8e1c6f2e81

vesctl yaml response:

{}

Request using curl:

curl -X 'POST' -d '{"namespace":"documentation","name":"user-1-cert","spec":{"users":[{"uid":"d1abcbba-4fc8-4a34-bf76-6e8e1c6f2e81","name":"user-1@acmecorp.com"}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build144460626_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: 16
Content-Type: application/json
Date: Fri, 15 May 2020 10:52:27 GMT
Vary: Accept-Encoding

{
  "data": ""
}