v1

package
v0.0.0-...-6dfea25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package v1 defines schemes used by apimachinery-apiserver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthzPolicy

type AuthzPolicy struct {
	ladon.DefaultPolicy
}

AuthzPolicy defines iam policy type.

func (AuthzPolicy) String

func (ap AuthzPolicy) String() string

String returns the string format of Policy.

type Policy

type Policy struct {
	// Standard object's metadata.
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// The user of the policy.
	Username string `json:"username" gorm:"column:username" validate:"omitempty"`

	// AuthzPolicy policy, will not be stored in db.
	Policy AuthzPolicy `json:"policy,omitempty" gorm:"-" validate:"omitempty"`

	// The ladon policy content, just a string format of ladon.DefaultPolicy. DO NOT modify directly.
	PolicyShadow string `json:"-" gorm:"column:policyShadow" validate:"omitempty"`
}

Policy represents a policy restful resource, include a ladon policy. It is also used as gorm model.

func (*Policy) AfterCreate

func (p *Policy) AfterCreate(tx *gorm.DB) (err error)

AfterCreate run after create database record.

func (*Policy) AfterFind

func (p *Policy) AfterFind(tx *gorm.DB) (err error)

AfterFind run after find to unmarshal a policy string into ladon.DefaultPolicy struct.

func (*Policy) BeforeCreate

func (p *Policy) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate run before create database record.

func (*Policy) BeforeUpdate

func (p *Policy) BeforeUpdate(tx *gorm.DB) (err error)

BeforeUpdate run before update database record.

func (*Policy) TableName

func (p *Policy) TableName() string

TableName maps to mysql table name.

func (*Policy) Validate

func (p *Policy) Validate() field.ErrorList

Validate validates that a policy object is valid.

type PolicyList

type PolicyList struct {
	// Standard list metadata.
	metav1.ListMeta `json:",inline"`

	// List of policys.
	Items []*Policy `json:"items"`
}

PolicyList is the whole list of all policies which have been stored in stroage.

type Secret

type Secret struct {

	// Standard object's metadata.
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Username  string `json:"username" gorm:"column:username" validate:"omitempty"`
	SecretID  string `json:"secretID" gorm:"column:secretID" validate:"omitempty"`
	SecretKey string `json:"secretKey" gorm:"column:secretKey" validate:"omitempty"`

	// Requires: true
	Expires     int64  `json:"expires" gorm:"column:expires" validate:"omitempty"`
	Description string `json:"description" gorm:"column:description" validate:"description"`
}

Secret represents a secret restful resource. It is also used as gorm model.

func (*Secret) AfterCreate

func (s *Secret) AfterCreate(tx *gorm.DB) (err error)

AfterCreate run after create database record.

func (*Secret) AfterFind

func (s *Secret) AfterFind(tx *gorm.DB) (err error)

AfterFind run after find to unmarshal a extend shadown string into metav1.Extend struct.

func (*Secret) BeforeCreate

func (s *Secret) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate run before create database record.

func (*Secret) BeforeUpdate

func (s *Secret) BeforeUpdate(tx *gorm.DB) (err error)

BeforeUpdate run before update database record.

func (*Secret) TableName

func (s *Secret) TableName() string

TableName maps to mysql table name.

func (*Secret) Validate

func (s *Secret) Validate() field.ErrorList

type SecretList

type SecretList struct {

	// Standard list metadata.
	metav1.ListMeta `json:",inline"`

	// List of secrets
	Items []*Secret `json:"items"`
}

SecretList is the whole list of all secrets which have been stored in stroage.

type User

type User struct {
	// Standard object's metadata.
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Required: true
	Nickname string `json:"nickname" gorm:"column:nickname" validate:"required,min=1,max=30"`

	// Required: true
	Password string `json:"password,omitempty" gorm:"column:password" validate:"required"`

	// Required: true
	Email string `json:"email" gorm:"column:email" validate:"required,email,min=1,max=100"`

	Phone string `json:"phone" gorm:"column:phone" validate:"omitempty"`

	IsAdmin int `json:"isAdmin,omitempty" gorm:"column:isAdmin" validate:"omitempty"`

	TotalPolicy int64 `json:"totalPolicy" gorm:"-" validate:"omitempty"`
}

User represents a user restful resource. It is also used as gorm model.

func (*User) AfterCreate

func (u *User) AfterCreate(tx *gorm.DB) (err error)

AfterCreate run after create database record.

func (*User) AfterFind

func (u *User) AfterFind(tx *gorm.DB) (err error)

AfterFind run after find to unmarshal a extend shadown string into metav1.Extend struct.

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate run before create database record.

func (*User) BeforeUpdate

func (u *User) BeforeUpdate(tx *gorm.DB) (err error)

BeforeUpdate run before update database record.

func (*User) Compare

func (u *User) Compare(pwd string) (err error)

Compare with the plain text password. Returns true if it's the same as the encrypted one (in the `User` struct).

func (*User) TableName

func (u *User) TableName() string

TableName maps to mysql table name.

func (*User) Validate

func (u *User) Validate() field.ErrorList

func (*User) ValidateUpdate

func (u *User) ValidateUpdate() field.ErrorList

ValidateUpdate validates that a user object is valid when update. Like User.Validate but not validate password.

type UserList

type UserList struct {
	// Standard list metadata.
	// +optional
	metav1.ListMeta `json:",inline"`

	Items []*User `json:"iterms"`
}

UserList is the whole list of all users which have been stored in stroage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL