robot

package
v0.0.0-...-a548ab7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LEVELSYSTEM ...
	LEVELSYSTEM = "system"
	// LEVELPROJECT ...
	LEVELPROJECT = "project"

	// SCOPESYSTEM ...
	SCOPESYSTEM = "/system"
	// SCOPEPROJECT ...
	SCOPEPROJECT = "/project"
	// SCOPEALLPROJECT ...
	SCOPEALLPROJECT = "/project/*"

	// ROBOTTYPE ...
	ROBOTTYPE = "robotaccount"
)

Variables

View Source
var (
	// Ctl is a global variable for the default robot account controller implementation
	Ctl = NewController()
)

Functions

func CreateSec

func CreateSec(salt ...string) (string, string, string, error)

func IsValidSec

func IsValidSec(secret string) bool

func SetProject

func SetProject(ctx context.Context, r *Robot) error

set the project info if it's a project level robot

Types

type Controller

type Controller interface {
	// Get ...
	Get(ctx context.Context, id int64, option *Option) (*Robot, error)

	// Count returns the total count of robots according to the query
	Count(ctx context.Context, query *q.Query) (total int64, err error)

	// Create ...
	Create(ctx context.Context, r *Robot) (int64, string, error)

	// Delete ...
	Delete(ctx context.Context, id int64, option ...*Option) error

	// Update ...
	Update(ctx context.Context, r *Robot, option *Option) error

	// List ...
	List(ctx context.Context, query *q.Query, option *Option) ([]*Robot, error)
}

Controller to handle the requests related with robot account

func NewController

func NewController() Controller

NewController ...

type Option

type Option struct {
	WithPermission bool
	Operator       string
}

Option ...

type Permission

type Permission struct {
	Kind      string          `json:"kind"`
	Namespace string          `json:"namespace"`
	Access    []*types.Policy `json:"access"`
	Scope     string          `json:"-"`
}

Permission ...

func (*Permission) IsCoverAll

func (p *Permission) IsCoverAll() bool

IsCoverAll ...

type Robot

type Robot struct {
	model.Robot
	ProjectName     string
	ProjectNameOrID interface{}
	Level           string
	Editable        bool          `json:"editable"`
	Permissions     []*Permission `json:"permissions"`
}

Robot ...

func (*Robot) IsSysLevel

func (r *Robot) IsSysLevel() bool

IsSysLevel, true is a system level robot, others are project level.

Jump to

Keyboard shortcuts

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