ves-io-schema-k8s_cluster_role_binding-API-Replace

Examples of replacing k8s_cluster_role_binding

Usecase:

Replace role-binding-1 to modify subject list to add user2

Request using vesctl:

vesctl configuration replace k8s_cluster_role_binding -i k8s_cluster_role_binding.yaml

where file k8s_cluster_role_binding.yaml has following contents (k8s_cluster_role_binding.ReplaceRequest):

RequestJSON:

{
    "metadata": {
        "name": "role-binding-1",
        "namespace": "system"
    },
    "spec": {
        "k8s_cluster_role": {
            "namespace": "system",
            "name": "k8s-cluster-role-1"
        },
        "subjects": [
            {
                "user": "user1@example.com"
            },
            {
                "user": "user2@example.com"
            }
        ]
    }
}

vesctl yaml response: None

Request using curl:

curl -X 'PUT' -d '{"metadata":{"name":"role-binding-1","namespace":"system"},"spec":{"k8s_cluster_role":{"namespace":"system","name":"k8s-cluster-role-1"},"subjects":[{"user":"user1@example.com"},{"user":"user2@example.com"}]}}' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build243329498_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/k8s_cluster_role_bindings/role-binding-1'

curl response:

HTTP/1.1 200 OK
Content-Length: 4
Content-Type: application/json
Date: Fri, 23 Sep 2022 13:12:43 GMT
Vary: Accept-Encoding

{

}