- [HTTP request](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#body.request_body)
- [Response body](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#body.ListRulesResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#body.aspect)
- [Rule](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#Rule)
  - [JSON representation](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#Rule.SCHEMA_REPRESENTATION)
- [RuleType](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#RuleType)
- [Try it!](https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#try-it)

Lists rules in a given project.

### HTTP request

`GET https://workloadmanager.googleapis.com/v1/{parent=projects/*/locations/*}/rules`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The \[project\] on which to execute the request. The format is: projects/{projectId}/locations/{location} Currently, the pre-defined rules are global available to all projects and all regions. |

### Query parameters

| Parameters ||
|---|---|
| `pageSize` | `integer` Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default. |
| `pageToken` | `string` A token identifying a page of results the server should return. |
| `filter` | `string` Filter based on primaryCategory, secondaryCategory. |
| `customRulesBucket` | `string` The Cloud Storage bucket name for custom rules. |
| `evaluationType` | ``enum (`https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.evaluations#EvaluationType`)`` Optional. The evaluation type of the rules will be applied to. The Cloud Storage bucket name for custom rules. |

### Request body

The request body must be empty.

### Response body

Response message for the rules.list RPC.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "rules": [ { object (`https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#Rule`) } ] } ``` |

| Fields ||
|---|---|
| `rules[]` | ``object (`https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#Rule`)`` All rules in response. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

## Rule

A rule to be evaluated.

| JSON representation |
|---|
| ``` { "name": string, "revisionId": string, "displayName": string, "description": string, "severity": string, "primaryCategory": string, "secondaryCategory": string, "errorMessage": string, "uri": string, "remediation": string, "tags": [ string ], "ruleType": enum (`https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#RuleType`), "assetType": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Rule name. |
| `revisionId` | `string` Output only. The version of the rule. |
| `displayName` | `string` The name display in UI. |
| `description` | `string` Describe rule in plain language. |
| `severity` | `string` The severity of the rule. |
| `primaryCategory` | `string` The primary category. |
| `secondaryCategory` | `string` The secondary category. |
| `errorMessage` | `string` The message template for rule. |
| `uri` | `string` The document url for the rule. |
| `remediation` | `string` The remediation for the rule. |
| `tags[]` | `string` List of user-defined tags. |
| `ruleType` | ``enum (`https://docs.cloud.google.com/workload-manager/docs/reference/rest/v1/projects.locations.rules/list#RuleType`)`` The type of the rule. |
| `assetType` | `string` The CAI asset type of the rule is evaluating, for joined asset types, it will be the corresponding primary asset types. |

## RuleType

The type of the rule.

| Enums ||
|---|---|
| `RULE_TYPE_UNSPECIFIED` | Not specified. |
| `BASELINE` | Baseline rules. |
| `CUSTOM` | Custom rules. |