Skip to main content

Create

pol, err := client.Policies.Create(ctx, grantex.CreatePolicyParams{
    Name:           "Block after hours",
    Effect:         "deny",
    TimeOfDayStart: "18:00",
    TimeOfDayEnd:   "08:00",
    Scopes:         []string{"write:data"},
})

List

result, err := client.Policies.List(ctx)

Get

pol, err := client.Policies.Get(ctx, "policy-id")

Update

name := "Updated Policy"
effect := "allow"
pol, err := client.Policies.Update(ctx, "policy-id", grantex.UpdatePolicyParams{
    Name:   &name,
    Effect: &effect,
})

Delete

err := client.Policies.Delete(ctx, "policy-id")

Types

Policy

FieldTypeDescription
IDstringPolicy ID
NamestringPolicy name
Effectstring"allow" or "deny"
PriorityintEvaluation priority
AgentID*stringScope to specific agent
PrincipalID*stringScope to specific user
Scopes[]stringAffected scopes
TimeOfDayStart*stringStart time (HH:MM)
TimeOfDayEnd*stringEnd time (HH:MM)
CreatedAtstringISO 8601 timestamp
UpdatedAtstringISO 8601 timestamp