List API Keys
package main
import (
"context"
"fmt"
"github.com/nirvana-labs/nirvana-go"
"github.com/nirvana-labs/nirvana-go/api_keys"
"github.com/nirvana-labs/nirvana-go/option"
)
func main() {
client := nirvana.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.APIKeys.List(context.TODO(), api_keys.APIKeyListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2025-01-01T00:00:00Z",
"expires_at": "2025-01-01T00:00:00Z",
"managed": false,
"name": "My API Key",
"permissions": [
{
"permission": "edit",
"resource_type": "vm"
}
],
"project_ids": [
"string"
],
"source_ip_rule": {
"allowed": [
"192.168.1.0/24",
"10.0.0.0/8"
],
"blocked": [
"192.168.1.100/32"
]
},
"status": "active",
"tags": [
"production",
"ethereum"
],
"updated_at": "2025-01-01T00:00:00Z",
"key": "6r17s0jy_b0_RbSofrrNvawFQcaN-VbGtUM7cKCW7_k",
"starts_at": "2025-01-01T00:00:00Z"
}
],
"pagination": {
"next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
"previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
"total_count": 125
}
}Returns Examples
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2025-01-01T00:00:00Z",
"expires_at": "2025-01-01T00:00:00Z",
"managed": false,
"name": "My API Key",
"permissions": [
{
"permission": "edit",
"resource_type": "vm"
}
],
"project_ids": [
"string"
],
"source_ip_rule": {
"allowed": [
"192.168.1.0/24",
"10.0.0.0/8"
],
"blocked": [
"192.168.1.100/32"
]
},
"status": "active",
"tags": [
"production",
"ethereum"
],
"updated_at": "2025-01-01T00:00:00Z",
"key": "6r17s0jy_b0_RbSofrrNvawFQcaN-VbGtUM7cKCW7_k",
"starts_at": "2025-01-01T00:00:00Z"
}
],
"pagination": {
"next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
"previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
"total_count": 125
}
}