# Role

> **Package : spaceone.api.identity.v1**

## Role

{% hint style="info" %}
**Role Methods:**
{% endhint %}

| Method                | Request                                 | Response                                                                                                           |
| --------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create) | [CreateRoleRequest](#createrolerequest) | [RoleInfo](#roleinfo)                                                                                              |
| [**update**](#update) | [UpdateRoleRequest](#updaterolerequest) | [RoleInfo](#roleinfo)                                                                                              |
| [**delete**](#delete) | [RoleRequest](#rolerequest)             | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)       | [GetRoleRequest](#getrolerequest)       | [RoleInfo](#roleinfo)                                                                                              |
| [**list**](#list)     | [RoleQuery](#rolequery)                 | [RolesInfo](#rolesinfo)                                                                                            |
| [**stat**](#stat)     | [RoleStatQuery](#rolestatquery)         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /identity/v1/roles

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [CreateRoleRequest](#createrolerequest) |
| Response | [RoleInfo](#roleinfo)                   |

### update

> **PUT** /identity/v1/roles/{role\_id}

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [UpdateRoleRequest](#updaterolerequest) |
| Response | [RoleInfo](#roleinfo)                   |

### delete

> **DELETE** /identity/v1/roles/{role\_id}

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [RoleRequest](#rolerequest)                                                                                      |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

### get

> **GET** /identity/v1/roles/{role\_id}

| Type     | Message                           |
| -------- | --------------------------------- |
| Request  | [GetRoleRequest](#getrolerequest) |
| Response | [RoleInfo](#roleinfo)             |

### list

> **GET** /identity/v1/roles
>
> **POST** /identity/v1/roles/search

| Type     | Message                 |
| -------- | ----------------------- |
| Request  | [RoleQuery](#rolequery) |
| Response | [RolesInfo](#rolesinfo) |

### stat

> **POST** /identity/v1/roles/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [RoleStatQuery](#rolestatquery)                                                                                    |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

##

## Message

### CreateRoleRequest

| Field             | Type                                                                                                               | Required | Description |
| ----------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| name              | string                                                                                                             | ✔        |             |
| role\_type        | <ul><li>NONE</li><li>SYSTEM</li><li>DOMAIN</li><li>PROJECT</li></ul>                                               | ✔        |             |
| policies          | [list of RolePolicy](#rolepolicy)                                                                                  | ✔        |             |
| page\_permissions | [list of PagePermission](#pagepermission)                                                                          | ✘        |             |
| tags              | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| domain\_id        | string                                                                                                             | ✔        |             |

### GetRoleRequest

| Field      | Type           | Required | Description |
| ---------- | -------------- | :------: | ----------- |
| role\_id   | string         |     ✔    |             |
| domain\_id | string         |     ✔    |             |
| only       | list of string |     ✘    |             |

### PagePermission

| Field      | Type                                               | Description |
| ---------- | -------------------------------------------------- | ----------- |
| page       | string                                             |             |
| permission | <ul><li>NONE</li><li>VIEW</li><li>MANAGE</li></ul> |             |

### RoleInfo

| Field             | Type                                                                                                               | Description |
| ----------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| role\_id          | string                                                                                                             |             |
| name              | string                                                                                                             |             |
| role\_type        | <ul><li>NONE</li><li>SYSTEM</li><li>DOMAIN</li><li>PROJECT</li></ul>                                               |             |
| policies          | [list of RolePolicy](#rolepolicy)                                                                                  |             |
| page\_permissions | [list of PagePermission](#pagepermission)                                                                          |             |
| tags              | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| domain\_id        | string                                                                                                             |             |
| created\_at       | string                                                                                                             |             |
| deleted\_at       | string                                                                                                             |             |

### RolePolicy

| Field        | Type                                                  | Description |
| ------------ | ----------------------------------------------------- | ----------- |
| policy\_type | <ul><li>NONE</li><li>MANAGED</li><li>CUSTOM</li></ul> |             |
| policy\_id   | string                                                |             |

### RoleQuery

| Field      | Type                                                                                               | Required | Description |
| ---------- | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| query      | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ✘        |             |
| role\_id   | string                                                                                             | ✘        |             |
| name       | string                                                                                             | ✘        |             |
| role\_type | <ul><li>NONE</li><li>SYSTEM</li><li>DOMAIN</li><li>PROJECT</li></ul>                               | ✘        |             |
| policy\_id | string                                                                                             | ✘        |             |
| domain\_id | string                                                                                             | ✔        |             |

### RoleRequest

| Field      | Type   | Required | Description |
| ---------- | ------ | :------: | ----------- |
| role\_id   | string |     ✔    |             |
| domain\_id | string |     ✔    |             |

### RoleStatQuery

| Field      | Type                                                                                                             | Required | Description |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    |             |
| domain\_id | string                                                                                                           |     ✔    |             |

### RolesInfo

| Field        | Type                                                                                            | Description |
| ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| results      | [list of RoleInfo](#roleinfo)                                                                   |             |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### UpdateRoleRequest

| Field                      | Type                                                                                                               | Required | Description |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| role\_id                   | string                                                                                                             |     ✔    |             |
| name                       | string                                                                                                             |     ✘    |             |
| policies                   | [list of RolePolicy](#rolepolicy)                                                                                  |     ✘    |             |
| page\_permissions          | [list of PagePermission](#pagepermission)                                                                          |     ✘    |             |
| tags                       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| release\_page\_permissions | bool                                                                                                               |     ✘    |             |
| domain\_id                 | string                                                                                                             |     ✔    |             |
