List Audit Logs
package main
import (
"context"
"fmt"
"github.com/nirvana-labs/nirvana-go"
"github.com/nirvana-labs/nirvana-go/audit_logs"
"github.com/nirvana-labs/nirvana-go/option"
)
func main() {
client := nirvana.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.AuditLogs.List(context.TODO(), audit_logs.AuditLogListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"action": "vm.created",
"actor": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Alice Smith",
"type": "user"
},
"client_ip": "203.0.113.1",
"created_at": "2025-01-01T00:00:00Z",
"method": "GET",
"path": "/v1/compute/vms",
"status_code": 200,
"user_agent": "Mozilla/5.0",
"target": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "vm"
}
}
],
"pagination": {
"next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
"previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
"total_count": 125
}
}Returns Examples
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"action": "vm.created",
"actor": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Alice Smith",
"type": "user"
},
"client_ip": "203.0.113.1",
"created_at": "2025-01-01T00:00:00Z",
"method": "GET",
"path": "/v1/compute/vms",
"status_code": 200,
"user_agent": "Mozilla/5.0",
"target": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "vm"
}
}
],
"pagination": {
"next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
"previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
"total_count": 125
}
}