- [HTTP request](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.request_body)
- [Response body](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.ListViolationsResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#body.aspect_1)
- [TimeWindow](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#TimeWindow)
  - [JSON representation](https://docs.cloud.google.com/assured-workloads/docs/reference/rest/v1/organizations.locations.workloads.violations/list.md.txt#TimeWindow.SCHEMA_REPRESENTATION)

Lists the Violations in the AssuredWorkload Environment. Callers may also choose to read across multiple Workloads as per [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash character) as a wildcard character instead of workload-id in the parent. Format `organizations/{org_id}/locations/{location}/workloads/-`

### HTTP request

`GET https://{endpoint}/v1/{parent=organizations/*/locations/*/workloads/*}/violations`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/assured-workloads/docs/reference/rest.md.txt#rest_endpoints).

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The workload to list violations for. To list violations across all workloads in an organization, use `-` as the workload ID. When `view` is `VIOLATION_VIEW_DATA_BOUNDARY`, violations are listed for the entire organization and location, and the workload ID is ignored. Format: `organizations/{organization}/locations/{location}/workloads/{workload}` Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `parent`: - `assuredworkloads.violations.list` |

### Query parameters

| Parameters ||
|---|---|
| `interval` | ``object (`TimeWindow`)`` Optional. The time window for retrieving violations. If specified, only violations that were active between `startTime` and `endTime` are returned. |
| `pageSize` | `integer` Optional. The maximum number of violations to return. The service might return fewer violations than this value. If unspecified, at most 100 violations are returned. The maximum value is 1000; values above 1000 are coerced to 1000. |
| `pageToken` | `string` Optional. A page token, received from a previous `violations.list` call. Provide this token to retrieve the subsequent page. When paginating, all other parameters that are provided to `violations.list` must match the call that provided the page token. |
| `filter` | `string` Optional. A filter expression that restricts the violations that are returned. The syntax follows [AIP-160](https://google.aip.dev/160). Only the equality operator (`=`) is supported, and expressions can be combined with `AND`, `OR`, and `NOT`. When `view` is `VIOLATION_VIEW_DATA_BOUNDARY`, the following fields are supported: `violationId`, `category`, `state` (`UNRESOLVED`, `RESOLVED`, or `EXCEPTION`), `violationType` (`ORG_POLICY` or `RESOURCE`), `resourceType`, `resourceName`, `project`, `associatedOrgPolicyViolationId`, `cloudControlName`, `workloadDisplayName`, and `complianceType` (a framework ID). Example: `state = "UNRESOLVED" AND complianceType = "builtin-fedramp-high"` |
| `view` | ``enum (`ViolationView`)`` Optional. The violation view (`VIOLATION_VIEW_ASSURED_WORKLOADS` or `VIOLATION_VIEW_DATA_BOUNDARY`) to list violations for. If not specified, `VIOLATION_VIEW_ASSURED_WORKLOADS` is used. |
| `orderBy` | `string` Optional. A comma-separated list of fields to sort the results by. The default sort order is ascending; to sort in descending order, append `desc` to the field name. For example, `updateTime desc,category`. When `view` is `VIOLATION_VIEW_DATA_BOUNDARY`, the following fields are supported: `beginTime`, `updateTime`, `resourceType`, `state`, and `category`. If not specified, results are sorted by `beginTime` in descending order. |

### Request body

The request body must be empty.

### Response body

Response message for the `violations.list` method.

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

| JSON representation |
|---|
| ``` { "violations": [ { object (`Violation`) } ], "nextPageToken": string, "totalSize": integer } ``` |

| Fields ||
|---|---|
| `violations[]` | ``object (`Violation`)`` The list of violations. |
| `nextPageToken` | `string` A token that can be sent as `pageToken` to retrieve the next page. If this field is empty, there are no subsequent pages. |
| `totalSize` | `integer` The total number of violations that match the request, across all pages. This field might not be populated for all requests; when it's not populated, its value is `0`. |

### Authorization scopes

Requires one of the following OAuth scopes:

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

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication.md.txt#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `assuredworkloads.violations.list`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## TimeWindow

A time interval.

| JSON representation |
|---|
| ``` { "startTime": string, "endTime": string } ``` |

| Fields ||
|---|---|
| `startTime` | ``string (`Timestamp` format)`` The start of the time window. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `endTime` | ``string (`Timestamp` format)`` The end of the time window. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |