ves-io-schema-namespace_role-API-Create

Examples of creating namespace_role

Usecase:

Create namespace-role-1

Request using vesctl:

vesctl configuration create namespace_role -i namespace_role.yaml

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

metadata:
  name: namespace-role-1
  namespace: documentation
spec:
  role:
  - kind: role
    name: admin
  user:
  - kind: user
    name: alice

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: namespace-role-1
  namespace: documentation
spec:
  role:
  - kind: role
    name: admin
    namespace: documentation
    tenant: acmecorp
    uid: ffffffff-ffff-ffff-ffff-ffffffffffff
  user:
  - kind: user
    name: alice
    namespace: documentation
    tenant: acmecorp
    uid: ffffffff-ffff-ffff-ffff-ffffffffffff
systemMetadata:
  creationTimestamp: "2021-05-12T11:18:16.635125172Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: b0d14922-37b5-4d66-b8d0-1c025f315e3f

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"namespace-role-1","namespace":"documentation"},"spec":{"user":[{"kind":"user","name":"alice"}],"role":[{"kind":"role","name":"admin"}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build672621555_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/web/namespaces/documentation/namespace_roles'

curl response:

HTTP/1.1 200 OK
Content-Length: 1036
Content-Type: application/json
Date: Wed, 12 May 2021 11:18:16 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "namespace-role-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "b0d14922-37b5-4d66-b8d0-1c025f315e3f",
    "creation_timestamp": "2021-05-12T11:18:16.635125172Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "user": [
      {
        "kind": "user",
        "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "tenant": "acmecorp",
        "namespace": "documentation",
        "name": "alice"
      }
    ],
    "role": [
      {
        "kind": "role",
        "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "tenant": "acmecorp",
        "namespace": "documentation",
        "name": "admin"
      }
    ],
    "namespace": ""
  }
}