> For the complete documentation index, see [llms.txt](https://spaceone-dev.gitbook.io/spaceone-apis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spaceone-dev.gitbook.io/spaceone-apis/identity/v1/policy.md).

# Policy

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

## Policy

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

| Method                | Request                                     | Response                                                                                                           |
| --------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create) | [CreatePolicyRequest](#createpolicyrequest) | [PolicyInfo](#policyinfo)                                                                                          |
| [**update**](#update) | [UpdatePolicyRequest](#updatepolicyrequest) | [PolicyInfo](#policyinfo)                                                                                          |
| [**delete**](#delete) | [PolicyRequest](#policyrequest)             | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)       | [GetPolicyRequest](#getpolicyrequest)       | [PolicyInfo](#policyinfo)                                                                                          |
| [**list**](#list)     | [PolicyQuery](#policyquery)                 | [PoliciesInfo](#policiesinfo)                                                                                      |
| [**stat**](#stat)     | [PolicyStatQuery](#policystatquery)         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /identity/v1/policies

| Type     | Message                                     |
| -------- | ------------------------------------------- |
| Request  | [CreatePolicyRequest](#createpolicyrequest) |
| Response | [PolicyInfo](#policyinfo)                   |

### update

> **PUT** /identity/v1/policy/{policy\_id}

| Type     | Message                                     |
| -------- | ------------------------------------------- |
| Request  | [UpdatePolicyRequest](#updatepolicyrequest) |
| Response | [PolicyInfo](#policyinfo)                   |

### delete

> **DELETE** /identity/v1/policy/{policy\_id}

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

### get

> **GET** /identity/v1/policy/{policy\_id}

| Type     | Message                               |
| -------- | ------------------------------------- |
| Request  | [GetPolicyRequest](#getpolicyrequest) |
| Response | [PolicyInfo](#policyinfo)             |

### list

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

| Type     | Message                       |
| -------- | ----------------------------- |
| Request  | [PolicyQuery](#policyquery)   |
| Response | [PoliciesInfo](#policiesinfo) |

### stat

> **POST** /identity/v1/policies/stat

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

##

## Message

### CreatePolicyRequest

| Field       | Type                                                                                                               | Required | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| name        | string                                                                                                             |     ✔    |             |
| permissions | list of string                                                                                                     |     ✔    |             |
| tags        | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id  | string                                                                                                             |     ✔    |             |

### GetPolicyRequest

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

### PoliciesInfo

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

### PolicyInfo

| Field       | Type                                                                                                               | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| policy\_id  | string                                                                                                             |             |
| name        | string                                                                                                             |             |
| permissions | list of string                                                                                                     |             |
| domain\_id  | string                                                                                                             |             |
| tags        | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| created\_at | string                                                                                                             |             |

### PolicyQuery

| Field      | Type                                                                                               | Required | Description |
| ---------- | -------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) |     ✘    |             |
| policy\_id | string                                                                                             |     ✘    |             |
| name       | string                                                                                             |     ✘    |             |
| domain\_id | string                                                                                             |     ✘    |             |

### PolicyRequest

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

### PolicyStatQuery

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

### UpdatePolicyRequest

| Field       | Type                                                                                                               | Required | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| policy\_id  | string                                                                                                             |     ✔    |             |
| name        | string                                                                                                             |     ✘    |             |
| permissions | list of string                                                                                                     |     ✘    |             |
| tags        | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id  | string                                                                                                             |     ✔    |             |
