Documentation ¶
Index ¶
- func Paginate[R any](value interface{}, pagination *Pagination[R], db *gorm.DB) func(db *gorm.DB) *gorm.DB
- type Account
- type AccountPagination
- type Cluster
- type FromAPI
- type NKey
- type Operator
- type OperatorPagination
- type Pagination
- type SigningKeyGroup
- type System
- type Tag
- type TaggableType
- type ToAPI
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { // ID is the unique identifier for the account. ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"` // Name is the name of the account. Name string `json:"name"` // Description is the description of the account. Description *string `json:"description"` // Key is the issuer key identifier. Key NKey `json:"key"` KeyID string `json:"key_id" gorm:"foreignKey:ID"` // Token is the JWT token used to authenticate the account. Token Token `json:"token" gorm:"foreignKey:TokenID"` TokenID string `json:"token_id"` // Operator is the operator this account is associated with. Operator Operator `json:"operator" gorm:"foreignKey:OperatorID"` // OperatorID is the operator ID. OperatorID uuid.UUID `json:"operator_id" gorm:"foreignKey:ID"` // SigningKeyGroups is the list of signing key groups the account has. SigningKeyGroups []SigningKeyGroup `` /* 141-byte string literal not displayed */ // CreatedAt is the time the account was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the account was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the account was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
Account ...
type AccountPagination ¶ added in v0.1.15
type AccountPagination Pagination[Operator]
AccountPagination is the pagination for operators.
type Cluster ¶
type Cluster struct { // ID is the unique identifier for the cluster. ID uuid.UUID `json:"id" gorm:"primaryKey,type:uuid;default:gen_random_uuid()"` // Name is the name of the cluster. Name string `json:"name" gorm:"unique" validate:"required,min=3,max=128"` // Description is the description of the cluster. Description string `json:"description" validate:"max=1024"` // ServerURL is the URL of the server. ServerURL string `json:"url" validate:"required"` // SystemID is the ID of the system the cluster belongs to. SystemID uuid.UUID `json:"system_id"` // CreatedAt is the time the cluster was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the cluster was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the cluster was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
Cluster ...
type NKey ¶
type NKey struct { // ID is the public key portion of the NKey. ID string `json:"id" gorm:"primaryKey"` // Seed is the private key portion of the NKey. Seed []byte `json:"seed"` // CreatedAt is the timestamp the key was created CreatedAt time.Time `json:"created_at"` // UpdatedAt is the timestamp the key was last updated UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the timestamp the key was deleted DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
NKey holds a private key and its metadata.
func (*NKey) PrivateKey ¶ added in v0.1.15
PrivateKey returns the private key portion of the NKey.
type Operator ¶
type Operator struct { // ID is the unique identifier for the operator. ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"` // Name is the name of the operator. Name string `json:"name" validate:"required,min=3,max=128"` // Description is the description of the operator. Description string `json:"description" validate:"max=1024"` // Key is the issuer key identifier. Key NKey `json:"key"` KeyID string `json:"key_id" gorm:"foreignKey:ID"` // Token is the JWT token used to authenticate the account. Token Token `json:"token" gorm:"foreignKey:TokenID"` TokenID string `json:"token_id"` // SystemAdminAccount is the account that is used to manage the systems. SystemAdminAccount *Account `json:"system_admin_account" gorm:"foreignKey:SystemAdminAccountID"` SystemAdminAccountID *uuid.UUID `json:"system_admin_account_id"` // Systems is the systems that are associated with the operator. Systems []System `json:"systems" gorm:"foreignKey:OperatorID"` // SigningKeyGroups is the list of signing key groups the account has. SigningKeyGroups []SigningKeyGroup `` /* 143-byte string literal not displayed */ // CreatedAt is the time the operator was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the operator was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the operator was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
Operator is the operator that is used to manage the systems.
type OperatorPagination ¶ added in v0.1.15
type OperatorPagination Pagination[Operator]
OperatorPagination is the pagination for operators.
type Pagination ¶
type Pagination[R any] struct { // Limit is the number of items to return. Limit int `json:"limit" xml:"limit" form:"limit"` // Offset is the number of items to skip. Offset int `json:"offset" xml:"offset" form:"offset"` // Search is the search term to filter the results. Search string `json:"search" xml:"search" form:"search"` // Sort is the sorting order. Sort string `json:"sort,omitempty" xml:"sort" form:"sort"` // TotalRows is the total number of rows. TotalRows int `json:"total_rows"` // TotalPages is the total number of pages. TotalPages int `json:"total_pages"` // Rows is the items to return. Rows []R `json:"rows"` }
Pagination is a struct that contains the pagination information.
func NewPagination ¶
func NewPagination[R any]() Pagination[R]
NewPagination returns a new pagination.
func (*Pagination[R]) GetOffset ¶
func (p *Pagination[R]) GetOffset() int
GetOffset returns the page.
type SigningKeyGroup ¶ added in v0.1.15
type SigningKeyGroup struct { // ID is the unique identifier for the group. ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"` // Name is the name of the group. Name string `json:"name" validate:"required,min=3,max=128"` // Description is the description of the group. Description string `json:"description" validate:"max=1024"` // Key is the signing key of this group. Key NKey `json:"key"` // KeyID is the foreign key for the key. KeyID string `json:"key_id" gorm:"foreignKey:ID"` // CreatedAt is the time the group was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the group was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the group was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
SigningKeyGroup is a model for storing the signing key group.
type System ¶
type System struct { // ID is the unique identifier for the system. ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()"` // Name is the name of the system. Name string `json:"name" gorm:"unique" validate:"required,min=3,max=128"` // Description is the description of the system. Description string `json:"description" validate:"max=1024"` // Clusters is the clusters that are associated with the system. Clusters []Cluster `json:"clusters" gorm:"foreignKey:SystemID"` // Operator is the operator this is associated with this system to operate. Operator Operator `json:"operator" gorm:"foreignKey:OperatorID"` OperatorID uuid.UUID `json:"operator_id"` // Tags is the tags that are associated with the system. Tags []*Tag `json:"tags" gorm:"polymorphic:Taggable;polymorphicValue:system;"` // CreatedAt is the time the system was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the system was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the system was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
System ...
type Tag ¶
type Tag struct { // ID is the unique identifier for the tag. ID int `json:"id" gorm:"primary_key"` // Name is the name of the tag. Name string `json:"name"` // TaggableID is the unique identifier for the taggable. TaggableID uuid.UUID `json:"taggable_id"` // TaggableType is the type of the taggable. TaggableType TaggableType `json:"taggable_type"` // CreatedAt is the time the tag was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the tag was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the tag was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at"` }
Tag is the model for adding tags to resources.
type TaggableType ¶
type TaggableType string
TaggableType ...
const (
SystemTaggable TaggableType = "system"
)
TaggableType ...
type Token ¶
type Token struct { // ID is the unique identifier for the token. // This is the public key portion of the NKey. ID string `json:"token_id" gorm:"primaryKey"` // Token is the JWT token used to authenticate the account. Token string `json:"token"` // CreatedAt is the time the token was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the token was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the token was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
Token is a model for storing the the JWT token used to authenticate the user.
func (*Token) Claim ¶ added in v0.1.15
func (t *Token) Claim() (*jwt.GenericClaims, error)
Claim is returning the claim of the token.
type User ¶
type User struct { // ID is the unique identifier for the user. ID uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"` // Name is the name of the user. Name string `json:"name" validate:"required,min=3,max=128"` // Description is the description of the user. Description string `json:"description" validate:"max=1024"` // Key is the issuer key identifier. Key NKey `json:"key"` // KeyID is the foreign key for the key. KeyID string `json:"key_id" gorm:"foreignKey:ID"` // Token is the JWT token used to authenticate the account. Token Token `json:"token" gorm:"foreignKey:TokenID"` // TokenID is the foreign key for the token. TokenID string `json:"token_id"` // Account is the account that the user belongs to. Account Account `json:"account" gorm:"foreignKey:AccountID"` // AccountID is the foreign key for the account. AccountID uuid.UUID `json:"account_id"` // CreatedAt is the time the user was created. CreatedAt time.Time `json:"created_at"` // UpdatedAt is the time the user was updated. UpdatedAt time.Time `json:"updated_at"` // DeletedAt is the time the user was deleted. DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` }
User ...
func (*User) Credentials ¶ added in v0.1.15
Credentials returns the user's credentials.