ves-io-schema-token-API-Create

Examples of creating token

Usecase:

Create token-1

Request using vesctl:

vesctl configuration create token -i token.yaml

where file token.yaml has following contents (token.CreateRequest):

metadata:
  name: token-1
  namespace: system
spec: {}

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: token-1
  namespace: system
spec: {}
systemMetadata:
  creationTimestamp: "2021-07-14T08:08:28.375479547Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: c89ced52-697e-42c0-8564-7110cc60d52a

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"token-1","namespace":"system"},"spec":{}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build381173587_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/register/namespaces/system/tokens'

curl response:

HTTP/1.1 200 OK
Content-Length: 607
Content-Type: application/json
Date: Wed, 14 Jul 2021 08:08:28 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "token-1",
    "namespace": "system",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "c89ced52-697e-42c0-8564-7110cc60d52a",
    "creation_timestamp": "2021-07-14T08:08:28.375479547Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "state": "UNKNOWN"
  }
}