apisvr

package
v0.0.0-...-fe53453 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAppService

func RegisterAppService(e *echo.Echo, srv AppService)

RegisterAppService is used to bind routers

func RegisterAppServiceWithPrefix

func RegisterAppServiceWithPrefix(e *echo.Echo, srv AppService, prefix string)

RegisterAppServiceWithPrefix is used to bind routers with custom prefix

Types

type AppService

type AppService interface {
	AppServiceAuth(c echo.Context) (err error)

	GetEnv(c echo.Context, req *EnvListRequest) (resp *EnvListResponse, bizError *Error, err error)

	RegisterService(c echo.Context, req *RegisterServiceRequest) (resp *RegisterServiceResponse, bizError *Error, err error)

	UpdateService(c echo.Context, req *UpdateServiceRequest) (resp *UpdateServiceResponse, bizError *Error, err error)

	UploadProtoFile(c echo.Context, req *UploadProtoFileRequest) (resp *UploadProtoFileResponse, bizError *Error, err error)

	GetTags(c echo.Context, req *TagListRequest) (resp *TagListResponse, bizError *Error, err error)

	GetProducts(c echo.Context, req *ProductListRequest) (resp *ProductListResponse, bizError *Error, err error)

	GetServices(c echo.Context, req *ServiceListRequest) (resp *ServiceListResponse, bizError *Error, err error)

	SearchServices(c echo.Context, req *ServiceSearchRequest) (resp *ServiceListResponse, bizError *Error, err error)

	GetKeyList(c echo.Context, req *KeyListRequest) (resp *KeyListResponse, bizError *Error, err error)

	GetKeyValueList(c echo.Context, req *KeyValueListRequest) (resp *KeyValueListResponse, bizError *Error, err error)

	SearchKeyValueList(c echo.Context, req *SearchKeyValueListRequest) (resp *KeyValueListResponse, bizError *Error, err error)

	UpdateKeyValue(c echo.Context, req *KeyValueRequest) (resp *KeyValueResponse, bizError *Error, err error)

	FetchKeyHistory(c echo.Context, req *KVHistoryRequest) (resp *KVHistoryResponse, bizError *Error, err error)
}

AppService is the interface contains all the controllers

type AuthError

type AuthError struct {
	Message string `json:"message"`
}

AuthError

func (*AuthError) GetMessage

func (r *AuthError) GetMessage() string

type BindError

type BindError struct {
	Message string `json:"message"`
}

BindError

func (*BindError) GetMessage

func (r *BindError) GetMessage() string

type CommonError

type CommonError struct {
	GenericError  *GenericError  `json:"genericError"`
	AuthError     *AuthError     `json:"authError"`
	ValidateError *ValidateError `json:"validateError"`
	BindError     *BindError     `json:"bindError"`
}

CommonError

func (*CommonError) Error

func (r *CommonError) Error() string

func (*CommonError) GetAuthError

func (r *CommonError) GetAuthError() *AuthError

func (*CommonError) GetBindError

func (r *CommonError) GetBindError() *BindError

func (*CommonError) GetGenericError

func (r *CommonError) GetGenericError() *GenericError

func (*CommonError) GetValidateError

func (r *CommonError) GetValidateError() *ValidateError

type Empty

type Empty struct {
}

Empty

type Env

type Env struct {
	Env_id   int    `json:"env_id"`
	Env_name string `json:"env_name"`
}

Env

func (*Env) GetEnv_id

func (r *Env) GetEnv_id() int

func (*Env) GetEnv_name

func (r *Env) GetEnv_name() string

type EnvListRequest

type EnvListRequest struct {
}

EnvListRequest

type EnvListResponse

type EnvListResponse struct {
	Envs []*Env `json:"envs"`
}

EnvListResponse

func (*EnvListResponse) GetEnvs

func (r *EnvListResponse) GetEnvs() []*Env

type Error

type Error struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

Error

func (*Error) GetCode

func (r *Error) GetCode() ErrorCode

func (*Error) GetMessage

func (r *Error) GetMessage() string

type ErrorCode

type ErrorCode int
const (
	DefaultError  ErrorCode = 0
	GeneralError  ErrorCode = 1000
	DatabaseError ErrorCode = 1001
	EtcdError     ErrorCode = 1002
	SystemError   ErrorCode = 1003
)

func (ErrorCode) Code

func (code ErrorCode) Code() int

func (ErrorCode) IsDatabaseError

func (code ErrorCode) IsDatabaseError() bool

func (ErrorCode) IsDefaultError

func (code ErrorCode) IsDefaultError() bool

func (ErrorCode) IsEtcdError

func (code ErrorCode) IsEtcdError() bool

func (ErrorCode) IsGeneralError

func (code ErrorCode) IsGeneralError() bool

func (ErrorCode) IsSystemError

func (code ErrorCode) IsSystemError() bool

func (ErrorCode) String

func (code ErrorCode) String() string

type FieldError

type FieldError struct {
	FieldName string            `json:"fieldName"`
	ErrorType ValidateErrorType `json:"errorType"`
}

FieldError

func (*FieldError) GetErrorType

func (r *FieldError) GetErrorType() ValidateErrorType

func (*FieldError) GetFieldName

func (r *FieldError) GetFieldName() string

type GenericError

type GenericError struct {
	Message string `json:"message"`
}

GenericError

func (*GenericError) GetMessage

func (r *GenericError) GetMessage() string

type KVHistoryItem

type KVHistoryItem struct {
	Updated_value string `json:"updated_value"`
	Updated_date  string `json:"updated_date"`
	Updated_by    string `json:"updated_by"`
	Revision      int64  `json:"revision"`
}

KVHistoryItem

func (*KVHistoryItem) GetRevision

func (r *KVHistoryItem) GetRevision() int64

func (*KVHistoryItem) GetUpdated_by

func (r *KVHistoryItem) GetUpdated_by() string

func (*KVHistoryItem) GetUpdated_date

func (r *KVHistoryItem) GetUpdated_date() string

func (*KVHistoryItem) GetUpdated_value

func (r *KVHistoryItem) GetUpdated_value() string

type KVHistoryRequest

type KVHistoryRequest struct {
	Service_id int `json:"service_id"`
	Key_id     int `json:"key_id"`
}

KVHistoryRequest

func (*KVHistoryRequest) GetKey_id

func (r *KVHistoryRequest) GetKey_id() int

func (*KVHistoryRequest) GetService_id

func (r *KVHistoryRequest) GetService_id() int

type KVHistoryResponse

type KVHistoryResponse struct {
	KVhistorys []*KVHistoryItem `json:"KVhistorys"`
}

KVHistoryResponse

func (*KVHistoryResponse) GetKVhistorys

func (r *KVHistoryResponse) GetKVhistorys() []*KVHistoryItem

type Key

type Key struct {
	Key_id       int    `json:"key_id"`
	Key          string `json:"key"`
	DataType     string `json:"dataType"`
	DefaultValue string `json:"defaultValue"`
	IsWatched    bool   `json:"isWatched"`
}

Key

func (*Key) GetDataType

func (r *Key) GetDataType() string

func (*Key) GetDefaultValue

func (r *Key) GetDefaultValue() string

func (*Key) GetIsWatched

func (r *Key) GetIsWatched() bool

func (*Key) GetKey

func (r *Key) GetKey() string

func (*Key) GetKey_id

func (r *Key) GetKey_id() int

type KeyListRequest

type KeyListRequest struct {
	Service_id int `json:"service_id"`
	Env_id     int `json:"env_id"`
}

KeyListRequest

func (*KeyListRequest) GetEnv_id

func (r *KeyListRequest) GetEnv_id() int

func (*KeyListRequest) GetService_id

func (r *KeyListRequest) GetService_id() int

type KeyListResponse

type KeyListResponse struct {
	Keys []*Key `json:"keys"`
}

KeyListResponse

func (*KeyListResponse) GetKeys

func (r *KeyListResponse) GetKeys() []*Key

type KeyValue

type KeyValue struct {
	Key_id       int    `json:"key_id"`
	Key          string `json:"key"`
	DataType     string `json:"dataType"`
	DefaultValue string `json:"defaultValue"`
	IsWatched    bool   `json:"isWatched"`
	Value        string `json:"value"`
}

KeyValue

func (*KeyValue) GetDataType

func (r *KeyValue) GetDataType() string

func (*KeyValue) GetDefaultValue

func (r *KeyValue) GetDefaultValue() string

func (*KeyValue) GetIsWatched

func (r *KeyValue) GetIsWatched() bool

func (*KeyValue) GetKey

func (r *KeyValue) GetKey() string

func (*KeyValue) GetKey_id

func (r *KeyValue) GetKey_id() int

func (*KeyValue) GetValue

func (r *KeyValue) GetValue() string

type KeyValueListRequest

type KeyValueListRequest struct {
	Service_id int    `json:"service_id"`
	Keys       []*Key `json:"keys"`
}

KeyValueListRequest

func (*KeyValueListRequest) GetKeys

func (r *KeyValueListRequest) GetKeys() []*Key

func (*KeyValueListRequest) GetService_id

func (r *KeyValueListRequest) GetService_id() int

type KeyValueListResponse

type KeyValueListResponse struct {
	Key_values []*KeyValue `json:"key_values"`
}

KeyValueListResponse

func (*KeyValueListResponse) GetKey_values

func (r *KeyValueListResponse) GetKey_values() []*KeyValue

type KeyValueRequest

type KeyValueRequest struct {
	Service_id int         `json:"service_id"`
	Key_values []*KeyValue `json:"key_values"`
}

KeyValueRequest

func (*KeyValueRequest) GetKey_values

func (r *KeyValueRequest) GetKey_values() []*KeyValue

func (*KeyValueRequest) GetService_id

func (r *KeyValueRequest) GetService_id() int

type KeyValueResponse

type KeyValueResponse struct {
	Key_values []*KeyValue `json:"key_values"`
}

KeyValueResponse

func (*KeyValueResponse) GetKey_values

func (r *KeyValueResponse) GetKey_values() []*KeyValue

type Product

type Product struct {
	Product_id   string `json:"product_id"`
	Product_name string `json:"product_name"`
}

Product

func (*Product) GetProduct_id

func (r *Product) GetProduct_id() string

func (*Product) GetProduct_name

func (r *Product) GetProduct_name() string

type ProductListRequest

type ProductListRequest struct {
	Env_id int `json:"env_id"`
}

ProductListRequest

func (*ProductListRequest) GetEnv_id

func (r *ProductListRequest) GetEnv_id() int

type ProductListResponse

type ProductListResponse struct {
	Products []*Product `json:"products"`
}

ProductListResponse

func (*ProductListResponse) GetProducts

func (r *ProductListResponse) GetProducts() []*Product

type RegisterServiceRequest

type RegisterServiceRequest struct {
	Env_id       int    `json:"env_id"`
	Product_id   string `json:"product_id"`
	Service_name string `json:"service_name"`
	Tags         []*Tag `json:"tags"`
	Desc         string `json:"desc"`
}

RegisterServiceRequest

func (*RegisterServiceRequest) GetDesc

func (r *RegisterServiceRequest) GetDesc() string

func (*RegisterServiceRequest) GetEnv_id

func (r *RegisterServiceRequest) GetEnv_id() int

func (*RegisterServiceRequest) GetProduct_id

func (r *RegisterServiceRequest) GetProduct_id() string

func (*RegisterServiceRequest) GetService_name

func (r *RegisterServiceRequest) GetService_name() string

func (*RegisterServiceRequest) GetTags

func (r *RegisterServiceRequest) GetTags() []*Tag

type RegisterServiceResponse

type RegisterServiceResponse struct {
	Env_id       int    `json:"env_id"`
	Product_id   string `json:"product_id"`
	Service_id   int    `json:"service_id"`
	Service_name string `json:"service_name"`
}

RegisterServiceResponse

func (*RegisterServiceResponse) GetEnv_id

func (r *RegisterServiceResponse) GetEnv_id() int

func (*RegisterServiceResponse) GetProduct_id

func (r *RegisterServiceResponse) GetProduct_id() string

func (*RegisterServiceResponse) GetService_id

func (r *RegisterServiceResponse) GetService_id() int

func (*RegisterServiceResponse) GetService_name

func (r *RegisterServiceResponse) GetService_name() string

type SearchKeyValueListRequest

type SearchKeyValueListRequest struct {
	Key        string `json:"key"`
	Service_id int    `json:"service_id"`
	Env_id     int    `json:"env_id"`
}

SearchKeyValueListRequest

func (*SearchKeyValueListRequest) GetEnv_id

func (r *SearchKeyValueListRequest) GetEnv_id() int

func (*SearchKeyValueListRequest) GetKey

func (r *SearchKeyValueListRequest) GetKey() string

func (*SearchKeyValueListRequest) GetService_id

func (r *SearchKeyValueListRequest) GetService_id() int

type Service

type Service struct {
	Service_id   int    `json:"service_id"`
	Service_name string `json:"service_name"`
	Product_id   string `json:"product_id"`
	Product_name string `json:"product_name"`
	Desc         string `json:"desc"`
	Tags         []*Tag `json:"tags"`
}

Service

func (*Service) GetDesc

func (r *Service) GetDesc() string

func (*Service) GetProduct_id

func (r *Service) GetProduct_id() string

func (*Service) GetProduct_name

func (r *Service) GetProduct_name() string

func (*Service) GetService_id

func (r *Service) GetService_id() int

func (*Service) GetService_name

func (r *Service) GetService_name() string

func (*Service) GetTags

func (r *Service) GetTags() []*Tag

type ServiceListRequest

type ServiceListRequest struct {
	Tag_ids []int `json:"tag_ids"`
	Env_id  int   `json:"env_id"`
	Offset  int   `json:"offset"`
	Limit   int   `json:"limit"`
}

ServiceListRequest

func (*ServiceListRequest) GetEnv_id

func (r *ServiceListRequest) GetEnv_id() int

func (*ServiceListRequest) GetLimit

func (r *ServiceListRequest) GetLimit() int

func (*ServiceListRequest) GetOffset

func (r *ServiceListRequest) GetOffset() int

func (*ServiceListRequest) GetTag_ids

func (r *ServiceListRequest) GetTag_ids() []int

type ServiceListResponse

type ServiceListResponse struct {
	Services []*Service `json:"services"`
	Offset   int        `json:"offset"`
	Limit    int        `json:"limit"`
	Total    int        `json:"total"`
}

ServiceListResponse

func (*ServiceListResponse) GetLimit

func (r *ServiceListResponse) GetLimit() int

func (*ServiceListResponse) GetOffset

func (r *ServiceListResponse) GetOffset() int

func (*ServiceListResponse) GetServices

func (r *ServiceListResponse) GetServices() []*Service

func (*ServiceListResponse) GetTotal

func (r *ServiceListResponse) GetTotal() int

type ServiceSearchRequest

type ServiceSearchRequest struct {
	Tag_ids []int  `json:"tag_ids"`
	Prefix  string `json:"prefix"`
	Env_id  int    `json:"env_id"`
	Offset  int    `json:"offset"`
	Limit   int    `json:"limit"`
}

ServiceSearchRequest

func (*ServiceSearchRequest) GetEnv_id

func (r *ServiceSearchRequest) GetEnv_id() int

func (*ServiceSearchRequest) GetLimit

func (r *ServiceSearchRequest) GetLimit() int

func (*ServiceSearchRequest) GetOffset

func (r *ServiceSearchRequest) GetOffset() int

func (*ServiceSearchRequest) GetPrefix

func (r *ServiceSearchRequest) GetPrefix() string

func (*ServiceSearchRequest) GetTag_ids

func (r *ServiceSearchRequest) GetTag_ids() []int

func (ServiceSearchRequest) Validate

func (r ServiceSearchRequest) Validate() *ValidateError

type Tag

type Tag struct {
	Tag_id   int    `json:"tag_id"`
	Tag_name string `json:"tag_name"`
}

Tag

func (*Tag) GetTag_id

func (r *Tag) GetTag_id() int

func (*Tag) GetTag_name

func (r *Tag) GetTag_name() string

type TagListRequest

type TagListRequest struct {
}

TagListRequest

type TagListResponse

type TagListResponse struct {
	Tags []*Tag `json:"tags"`
}

TagListResponse

func (*TagListResponse) GetTags

func (r *TagListResponse) GetTags() []*Tag

type UpdateServiceRequest

type UpdateServiceRequest struct {
	Service_id int    `json:"service_id"`
	Tags       []*Tag `json:"tags"`
	Desc       string `json:"desc"`
}

UpdateServiceRequest

func (*UpdateServiceRequest) GetDesc

func (r *UpdateServiceRequest) GetDesc() string

func (*UpdateServiceRequest) GetService_id

func (r *UpdateServiceRequest) GetService_id() int

func (*UpdateServiceRequest) GetTags

func (r *UpdateServiceRequest) GetTags() []*Tag

type UpdateServiceResponse

type UpdateServiceResponse struct {
	Service_id int    `json:"service_id"`
	Tags       []*Tag `json:"tags"`
	Desc       string `json:"desc"`
}

UpdateServiceResponse

func (*UpdateServiceResponse) GetDesc

func (r *UpdateServiceResponse) GetDesc() string

func (*UpdateServiceResponse) GetService_id

func (r *UpdateServiceResponse) GetService_id() int

func (*UpdateServiceResponse) GetTags

func (r *UpdateServiceResponse) GetTags() []*Tag

type UploadProtoFileRequest

type UploadProtoFileRequest struct {
	Service_id int    `json:"service_id"`
	Env_id     int    `json:"env_id"`
	File       string `json:"file"`
}

UploadProtoFileRequest

func (*UploadProtoFileRequest) GetEnv_id

func (r *UploadProtoFileRequest) GetEnv_id() int

func (*UploadProtoFileRequest) GetFile

func (r *UploadProtoFileRequest) GetFile() string

func (*UploadProtoFileRequest) GetService_id

func (r *UploadProtoFileRequest) GetService_id() int

type UploadProtoFileResponse

type UploadProtoFileResponse struct {
	Service_id int `json:"service_id"`
	Env_id     int `json:"env_id"`
	Key_count  int `json:"key_count"`
}

UploadProtoFileResponse

func (*UploadProtoFileResponse) GetEnv_id

func (r *UploadProtoFileResponse) GetEnv_id() int

func (*UploadProtoFileResponse) GetKey_count

func (r *UploadProtoFileResponse) GetKey_count() int

func (*UploadProtoFileResponse) GetService_id

func (r *UploadProtoFileResponse) GetService_id() int

type ValidateError

type ValidateError struct {
	Errors []*FieldError `json:"errors"`
}

ValidateError

func (*ValidateError) GetErrors

func (r *ValidateError) GetErrors() []*FieldError

type ValidateErrorType

type ValidateErrorType int
const (
	INVALID_EMAIL  ValidateErrorType = 0
	FIELD_REQUIRED ValidateErrorType = 1
)

func (ValidateErrorType) Code

func (code ValidateErrorType) Code() int

func (ValidateErrorType) IsFIELD_REQUIRED

func (code ValidateErrorType) IsFIELD_REQUIRED() bool

func (ValidateErrorType) IsINVALID_EMAIL

func (code ValidateErrorType) IsINVALID_EMAIL() bool

func (ValidateErrorType) String

func (code ValidateErrorType) String() string

Jump to

Keyboard shortcuts

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