Cluster role bindings API

The /cluster-role-bindings API endpoint

/cluster-role-bindings (GET)

The /cluster-role-bindings API endpoint provides HTTP GET access to cluster role binding data.

EXAMPLE

The following example demonstrates a request to the /cluster-role-bindings API, resulting in a JSON Array containing cluster role binding definitions.

curl -s http://127.0.0.1:8080/api/core/v2/cluster-role-bindings -H "Authorization: Bearer TOKEN"
[
  {
    "name": "bob-binder",
    "roleRef": {
      "type": "ClusterRole",
      "name": "admin"
    },
    "subjects": [
      {
        "type": "User",
        "name": "bob"
      }
    ]
  }
]

API Specification

/cluster-role-bindings (GET)
description Returns the list of cluster role bindings.
example url http://hostname:8080/api/core/v2/cluster-role-bindings
response type Array
response codes
  • Success: 200 (OK)
  • Error: 500 (Internal Server Error)
output
[
  {
    "name": "bob-binder",
    "roleRef": {
      "type": "ClusterRole",
      "name": "admin"
    },
    "subjects": [
      {
        "type": "User",
        "name": "bob"
      }
    ]
  }
]

/cluster-role-bindings (POST)

/cluster-role-bindings (POST)
description Create a Sensu cluster role binding.
example URL http://hostname:8080/api/core/v2/cluster-role-bindings/default/cluster-role-bindings
payload
{
  "name": "bob-binder",
  "roleRef": {
    "type": "ClusterRole",
    "name": "admin"
  },
  "subjects": [
    {
      "type": "User",
      "name": "bob"
    }
  ]
}
response codes
  • Success: 200 (OK)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

The /cluster-role-bindings/:cluster-role-binding API endpoint

/cluster-role-bindings/:cluster-role-binding (GET)

The /cluster-role-bindings/:cluster-role-binding API endpoint provides HTTP GET access to cluster-role-binding data for specific :cluster-role-binding definitions, by cluster-role-binding name.

EXAMPLE

In the following example, querying the /cluster-role-bindings/:cluster-role-binding API returns a JSON Map containing the requested :cluster-role-binding definition (in this example: for the :cluster-role-binding named bob).

curl -s http://127.0.0.1:8080/api/core/v2/cluster-role-bindings/bob -H "Authorization: Bearer TOKEN"
{
  "name": "bob-binder",
  "roleRef": {
    "type": "ClusterRole",
    "name": "admin"
  },
  "subjects": [
    {
      "type": "User",
      "name": "bob"
    }
  ]
}

API Specification

/cluster-role-bindings/:cluster-role-binding (GET)
description Returns a cluster role binding.
example url http://hostname:8080/api/core/v2/cluster-role-bindings/bob
response type Map
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)
output
{
  "name": "bob-binder",
  "roleRef": {
    "type": "ClusterRole",
    "name": "admin"
  },
  "subjects": [
    {
      "type": "User",
      "name": "bob"
    }
  ]
}

/cluster-role-bindings/:cluster-role-binding (PUT)

API Specification

/cluster-role-bindings/:cluster-role-binding (PUT)
description Create or update a Sensu cluster role binding.
example URL http://hostname:8080/api/core/v2/namespaces/default/cluster-role-bindings/bob-binder
payload
{
  "name": "bob-binder",
  "roleRef": {
    "type": "ClusterRole",
    "name": "admin"
  },
  "subjects": [
    {
      "type": "User",
      "name": "bob"
    }
  ]
}
response codes
  • Success: 201 (Created)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

/cluster-role-bindings/:cluster-role-binding (DELETE)

API Specification

/cluster-role-bindings/:cluster-role-binding (DELETE)
description Removes a cluster role binding from Sensu given the cluster role binding name.
example url http://hostname:8080/api/core/v2/namespaces/default/cluster-role-bindings/bob-binder
response codes
  • Success: 202 (Accepted)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)