-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.go
More file actions
39 lines (32 loc) · 1.09 KB
/
token.go
File metadata and controls
39 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package types
import (
"time"
)
type Permissions struct {
Actions []string `json:"actions,omitempty"`
}
type APIToken struct {
ID string `json:"id"`
Name string `json:"name"`
Token string `json:"token"`
Description string `json:"description"`
Permissions Permissions `json:"permissions"`
CreatedAt time.Time `json:"created-at"`
ExpiresAt time.Time `json:"expires-at"`
TTL string `json:"ttl"`
}
type CreateAPITokenInput struct {
Name string `json:"name" description:"Token name" validate:"required,max=255"`
Description string `json:"description" description:"Token description" validate:"max=255"`
TTL string `json:"ttl" description:"Token TTL in seconds" validate:"required"`
Permissions Permissions `json:"permissions"`
}
type GetAPITokenInput struct {
ID string `param:"id" description:"Token ID" validate:"required"`
}
type DeleteAPITokenInput struct {
ID string `param:"id" description:"Token ID" validate:"required"`
}
type ListAPITokensOutput struct {
Result []APIToken `json:"result"`
}