ves-io-schema-role-API-Create

Examples of creating role

Usecase:

Create role-1

Request using vesctl:

vesctl configuration create role -i role.yaml

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

RequestJSON:

{"metadata":{"name":"role-1","namespace":"documentation"},"spec":{}} `

vesctl yaml response:

ResponseJSON:

  "metadata": {
    "name": "role-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "06020aed-f431-43dc-a726-438d04d739e9",
    "creation_timestamp": "2022-07-28T12:11:36.663100916Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null,
    "labels": {
    }
  },
  "spec": {
    "rbac_policy": [
    ]
  }
}```
`

Request using curl:

    


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



curl response:

	


HTTP/1.1 200 OK Content-Length: 640 Content-Type: application/json Date: Thu, 28 Jul 2022 12:11:36 GMT Vary: Accept-Encoding

{ "metadata": { "name": "role-1", "namespace": "documentation", "labels": { }, "annotations": { }, "description": "", "disable": false }, "system_metadata": { "uid": "06020aed-f431-43dc-a726-438d04d739e9", "creation_timestamp": "2022-07-28T12:11:36.663100916Z", "deletion_timestamp": null, "modification_timestamp": null, "initializers": null, "finalizers": [ ], "tenant": "acmecorp", "creator_class": "examplesvc", "creator_id": "examplesvc", "object_index": 0, "owner_view": null, "labels": { } }, "spec": { "rbac_policy": [ ] } }