micro

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMicroRequest

type CreateMicroRequest struct {
	*token.Session  `bson:"-" json:"-"`
	Name            string            `bson:"name" json:"name" validate:"required,lte=200"`         // 名称
	Label           map[string]string `bson:"label" json:"label" validate:"lte=80"`                 // 服务标签
	Description     string            `bson:"description" json:"description,omitempty"`             // 描述信息
	Enabled         bool              `bson:"enabled" json:"enabled"`                               // 是否启用该服务
	TokenExpireTime int64             `bson:"token_expire_time" json:"token_expire_time,omitempty"` // 凭证申请的token的过期时间                               // 创建者ID
}

CreateMicroRequest 服务创建请求

func NewCreateMicroRequest

func NewCreateMicroRequest() *CreateMicroRequest

NewCreateMicroRequest todo

func (*CreateMicroRequest) Validate

func (req *CreateMicroRequest) Validate() error

Validate 校验请求是否合法

type DescribeMicroRequest

type DescribeMicroRequest struct {
	Name string
	ID   string
}

DescribeMicroRequest 查询应用详情

func NewDescriptServiceRequest

func NewDescriptServiceRequest() *DescribeMicroRequest

NewDescriptServiceRequest new实例

func (*DescribeMicroRequest) Validate

func (req *DescribeMicroRequest) Validate() error

Validate 校验详情查询请求

type Micro

type Micro struct {
	ID                  string `bson:"_id" json:"id"` // 微服务ID
	*CreateMicroRequest `bson:",inline"`
	CreaterID           string     `bson:"creater_id" json:"creater_id"`
	CreateAt            ftime.Time `bson:"create_at" json:"create_at,omitempty"` // 创建的时间
	UpdateAt            ftime.Time `bson:"update_at" json:"update_at,omitempty"` // 更新时间
	AccountID           string     `bson:"account_id" json:"account_id"`         // 服务账号
	AccessToken         string     `bson:"access_token" json:"access_token"`     // 服务访问凭证
	RefreshToken        string     `bson:"refresh_token" json:"-"`               // 服务刷新凭证
}

Micro is service provider

func New

func New(req *CreateMicroRequest) (*Micro, error)

New 创建服务

type QueryMicroRequest

type QueryMicroRequest struct {
	*request.PageRequest
}

QueryMicroRequest 查询应用列表

func NewQueryMicroRequest

func NewQueryMicroRequest(pageReq *request.PageRequest) *QueryMicroRequest

NewQueryMicroRequest 列表查询请求

type Service

type Service interface {
	CreateService(req *CreateMicroRequest) (*Micro, error)
	QueryService(req *QueryMicroRequest) (*Set, error)
	DescribeService(req *DescribeMicroRequest) (*Micro, error)
	DeleteService(name string) error
}

Service token管理服务

type Set

type Set struct {
	*request.PageRequest

	Total int64    `json:"total"`
	Items []*Micro `json:"items"`
}

Set 列表

func NewMicroSet

func NewMicroSet(req *request.PageRequest) *Set

NewMicroSet 实例化

func (*Set) Add

func (s *Set) Add(e *Micro)

Add 添加

type Type

type Type string

Type 服务类型

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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