List policies in a zone
List policies in a zone
client.Zones.Policies.List(ctx, zoneID, params) (*ZonePolicyListResponse, error)
GET/zones/{zone_id}/policies
Returns a paginated list of policies in the zone. Supports cursor-based pagination, sorting, full-text search, and composable filters.
The filter[id] parameter restricts results to a known set
of policy IDs (up to 100). It composes with other filters
(filter[owner_type], query[], etc.) but cannot be
combined with cursor pagination (after / before) — the
server returns 400 if both are present. When filter[id] is
used without an explicit limit, the limit defaults to the
number of requested IDs so all results fit in a single page.
IDs that don't exist or fall outside the zone are silently
omitted.
Parameters
zoneID string
Returns
List policies in a zone
package main
import (
"context"
"fmt"
"github.com/keycardai/keycard-go"
)
func main() {
client := keycard.NewClient(
)
policies, err := client.Zones.Policies.List(
context.TODO(),
"zone_id",
keycard.ZonePolicyListParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", policies.Items)
}
{
"items": [
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": "created_by",
"name": "name",
"owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"archived_at": "2019-12-27T18:11:19.117Z",
"description": "description",
"latest_schema_version": "latest_schema_version",
"latest_version": 0,
"latest_version_id": "latest_version_id",
"updated_by": "updated_by"
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}Returns Examples
{
"items": [
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": "created_by",
"name": "name",
"owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"archived_at": "2019-12-27T18:11:19.117Z",
"description": "description",
"latest_schema_version": "latest_schema_version",
"latest_version": 0,
"latest_version_id": "latest_version_id",
"updated_by": "updated_by"
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}