mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-30 08:05:43 +00:00
71 lines
3.1 KiB
Go
71 lines
3.1 KiB
Go
package dto
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type APIKeyItem struct {
|
|
ID string `json:"id" example:"8a8f0f77-1ec8-4d46-8f5a-0ea8807e2d8a"`
|
|
Kind string `json:"kind" enums:"apiKey,legacy" example:"apiKey"`
|
|
Name string `json:"name" example:"Deployment automation"`
|
|
Description string `json:"description" example:"Used by the deployment service"`
|
|
KeyHint string `json:"keyHint" example:"abcd••••1234"`
|
|
Status string `json:"status" enums:"Enable,Disable,Revoked,Expired" example:"Enable"`
|
|
IPWhiteList string `json:"ipWhiteList" example:"192.0.2.10"`
|
|
APITrustedProxies string `json:"apiTrustedProxies" example:"192.0.2.1"`
|
|
APIKeyValidityTime int `json:"apiKeyValidityTime" example:"120"`
|
|
ExpiresAt *time.Time `json:"expiresAt" format:"date-time" extensions:"x-nullable"`
|
|
AllowAppBinding bool `json:"allowAppBinding" example:"false"`
|
|
Revision uint64 `json:"revision" minimum:"1" example:"1"`
|
|
CreatedAt *time.Time `json:"createdAt" format:"date-time" extensions:"x-nullable"`
|
|
}
|
|
|
|
type APIKeySearch struct {
|
|
Page int `json:"page" minimum:"1" example:"1"`
|
|
PageSize int `json:"pageSize" minimum:"1" maximum:"100" example:"20"`
|
|
ExcludeRevoked bool `json:"excludeRevoked" default:"false"`
|
|
}
|
|
type APIKeyPage struct {
|
|
Items []APIKeyItem `json:"items"`
|
|
Total int `json:"total"`
|
|
}
|
|
type APIKeyFields struct {
|
|
Name string `json:"name" minLength:"1" maxLength:"64" example:"Deployment automation"`
|
|
Description string `json:"description" maxLength:"256" example:"Used by the deployment service"`
|
|
IPWhiteList string `json:"ipWhiteList" maxLength:"4096" example:"192.0.2.10"`
|
|
APITrustedProxies string `json:"apiTrustedProxies" maxLength:"4096" example:"192.0.2.1"`
|
|
APIKeyValidityTime int `json:"apiKeyValidityTime" minimum:"0" maximum:"1440" example:"120"`
|
|
ExpiresAt json.RawMessage `json:"expiresAt" swaggertype:"string" format:"date-time" extensions:"x-nullable" example:"2030-01-01T00:00:00Z"`
|
|
AllowAppBinding bool `json:"allowAppBinding" default:"false"`
|
|
}
|
|
type APIKeyCreate struct {
|
|
// Optional client-generated UUID for idempotent retries. Omitted or empty values are generated by the server.
|
|
RequestID string `json:"requestID" format:"uuid" example:"df1a75a3-5f56-4fa3-9e7a-a573a853d894"`
|
|
APIKeyFields
|
|
}
|
|
type APIKeyCreated struct {
|
|
Item APIKeyItem `json:"item"`
|
|
APIKey string `json:"apiKey"`
|
|
AlreadyCreated bool `json:"alreadyCreated,omitempty"`
|
|
}
|
|
type APIKeyMutation struct {
|
|
ID string `json:"id" example:"8a8f0f77-1ec8-4d46-8f5a-0ea8807e2d8a"`
|
|
Revision uint64 `json:"revision" minimum:"1" example:"1"`
|
|
}
|
|
type APIKeyMutationResult struct {
|
|
TerminalClosePending bool `json:"terminalClosePending"`
|
|
}
|
|
type APIKeyRevealed struct {
|
|
APIKeyMutation
|
|
APIKey string `json:"apiKey"`
|
|
}
|
|
type APIKeyUpdate struct {
|
|
APIKeyMutation
|
|
APIKeyFields
|
|
}
|
|
type APIKeyStatus struct {
|
|
APIKeyMutation
|
|
Status string `json:"status" enums:"Enable,Disable" example:"Disable"`
|
|
}
|