Replacing a Specified ClusterRole

Function

This API is used to replace a specified ClusterRole.

URL

PUT /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the ClusterRole.

pretty

No

If 'true', then the output is pretty printed.

body

Yes

-

Request

Request parameters:

For the description about request parameters, see Table 2.

For the description about the Content-Type field, see Patch Request Method Operation Description.

Example request:

{
	"kind": "ClusterRole",
	"apiVersion": "rbac.authorization.k8s.io/v1",
	"metadata": {
		"name": "secret-reader",
		"selfLink": "/apis/rbac.authorization.k8s.io/v1/clusterroles/secret-reader",
		"uid": "6a044ac2-f213-11e8-b449-fa163ec24e06",
		"resourceVersion": "44658",
		"creationTimestamp": "2018-11-27T07:09:43Z"
	},
	"rules": [{
		"verbs": ["get","watch"],
		"apiGroups": [""],
		"resources": ["secrets"]
	}]
}

Response

Response parameters:

For the description about response parameters, see Table 2.

Example response:

{
	"kind": "ClusterRole",
	"apiVersion": "rbac.authorization.k8s.io/v1",
	"metadata": {
		"name": "secret-reader",
		"selfLink": "/apis/rbac.authorization.k8s.io/v1/clusterroles/secret-reader",
		"uid": "c5986470-f2d5-11e8-b449-fa163ec24e06",
		"resourceVersion": "225013",
		"creationTimestamp": "2018-11-28T06:20:59Z"
	},
	"rules": [{
		"verbs": ["get","watch"],
		"apiGroups": [""],
		"resources": ["nodes"]
	}]
}

Status Code

Table 2 describes the status codes of this API.

Table 2 Status codes

Status Code

Description

200

OK

201

Created