# MgmtRolesResource Resource

### GET /cm/service/roles

List all roles of the Cloudera Management Services.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleList (JSON) | List of roles.

### POST /cm/service/roles

Create new roles in the Cloudera Management Services.

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleList (JSON) | Roles to create.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiRoleList (JSON) | List of created roles.

### DELETE /cm/service/roles/{roleName}

Delete a role from the Cloudera Management Services.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role name. | n/a

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiRole (JSON) | The details of the deleted role.

### GET /cm/service/roles/{roleName}

Retrieve detailed information about a Cloudera Management Services role.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role name. | n/a

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiRole (JSON) | The details of the role.

### GET /cm/service/roles/{roleName}/commands

List active role commands.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role name. | n/a
view | query | The view of the data to materialize, either "summary" or "full". | summary

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiCommandList (JSON) | A list of active role commands.

### GET /cm/service/roles/{roleName}/config

Retrieve the configuration of a specific Cloudera Management Services role.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role to look up. | n/a
view | query | The view of the data to materialize, either "summary" or "full". | summary

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiConfigList (JSON) | List with configured and available configuration options.

### PUT /cm/service/roles/{roleName}/config

Update the configuration of a Cloudera Management Services role.

If a value is set in the given configuration, it will be added to the role's configuration, replacing any existing entries. If a value is unset (its value is null), the existing configuration for the attribute will be erased, if any.

Attributes that are not listed in the input will maintain their current values in the configuration.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role to modify. | n/a
message | query | Optional message describing the changes. | n/a

Request Body
media type | data type | description
--- | --- | ---
application/json | ApiConfigList (JSON) | Configuration changes.

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiConfigList (JSON) | The new service configuration.

### POST /cm/service/roles/{roleName}/commands/enterMaintenanceMode

Put the Cloudera Management Service role into maintenance mode.This is a synchronous command. The result is known immediately upon return.

Available since API v18.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role name. | n/a

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiCommand (JSON) | Synchronous command result.

### POST /cm/service/roles/{roleName}/commands/exitMaintenanceMode

Take the Cloudera Management Service role out of maintenance mode. This is a synchronous command. The result is known immediately upon return.

Available since API v18.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role name. | n/a

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiCommand (JSON) | Synchronous command result.

### GET /cm/service/roles/{roleName}/logs/full

Retrieves the log file for the role's main process.

If the role is not started, this will be the log file associated with the last time the role was run.

Log files are returned as plain text (type "text/plain").

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role to fetch logs from. | n/a

Response Body
media type | data type | description
--- | --- | ---
text/plain | object | Contents of the role's log file.

### GET /cm/service/roles/{roleName}/logs/stacks

Retrieves the stacks log file, if any, for the role's main process. Note that not all roles support periodic stacks collection. The log files are returned as plain text (type "text/plain").

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role to fetch stacks logs from. | n/a

Response Body
media type | data type | description
--- | --- | ---
text/plain | object | Contents of the role's log file.

### GET /cm/service/roles/{roleName}/logs/stacksBundle

Download a zip-compressed archive of role stacks logs. Note that not all roles support periodic stacks collection.

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role to fetch the stacks logs bundle from. | n/a

Response Body
media type | data type | description
--- | --- | ---
application/octet-stream | object | The archive data.

### GET /cm/service/roles/{roleName}/logs/stderr

Retrieves the role's standard error output.

If the role is not started, this will be the output associated with the last time the role was run.

Log files are returned as plain text (type "text/plain").

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role to fetch stderr from. | n/a

Response Body
media type | data type | description
--- | --- | ---
text/plain | object | Contents of the role's standard error output.

### GET /cm/service/roles/{roleName}/logs/stdout

Retrieves the role's standard output.

If the role is not started, this will be the output associated with the last time the role was run.

Log files are returned as plain text (type "text/plain").

Request Parameters
name | type | description | default
--- | --- | --- | ---
roleName | path | The role to fetch stdout from. | n/a

Response Body
media type | data type | description
--- | --- | ---
text/plain | object | Contents of the role's standard output.