model

package
v0.0.0-...-97dd610 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	All RegistrySource = "ALL"

	Interface = "INTERFACE"

	Instance = "INSTANCE"
)
View Source
const ArgumentAdminIdentifier string = " & arg_admin_rule!=false"
View Source
const RegionAdminIdentifier string = " & region_admin_rule!=false"

Variables

This section is empty.

Functions

This section is empty.

Types

type Accesslog

type Accesslog struct {
	Application string `json:"application" binding:"required"`
	Accesslog   string `json:"accesslog"`
}

func (Accesslog) ToRule

func (t Accesslog) ToRule() Override

type AddressMatch

type AddressMatch struct {
	Wildcard string `json:"wildcard" yaml:"wildcard,omitempty"`
	Cird     string `json:"cird" yaml:"cird,omitempty"`
	Exact    string `json:"exact" yaml:"exact,omitempty"`
}

func (*AddressMatch) IsMatch

func (m *AddressMatch) IsMatch(input string) bool

type Argument

type Argument struct {
	Service string `json:"service" binding:"required"`
	Group   string `json:"group"`
	Version string `json:"version"`
	Rule    string `json:"rule" binding:"required"`
}

func (Argument) ToRule

func (r Argument) ToRule() ConditionRoute

type Base

type Base struct {
	Application    string `json:"application" yaml:"application"`
	Service        string `json:"service" yaml:"service"`
	ID             string `json:"id" yaml:"id"`
	ServiceVersion string `json:"serviceVersion" yaml:"serviceVersion"`
	ServiceGroup   string `json:"serviceGroup" yaml:"serviceGroup"`
}

type ClusterMetricsRes

type ClusterMetricsRes struct {
	Data map[string]int `json:"data"`
}

type ConditionMatch

type ConditionMatch struct {
	Address     AddressMatch    `json:"address" yaml:"address,omitempty"`
	Service     ListStringMatch `json:"service" yaml:"service,omitempty"`
	Application ListStringMatch `json:"application" yaml:"application,omitempty"`
	Param       []ParamMatch    `json:"param" yaml:"param,omitempty"`
}

type ConditionRoute

type ConditionRoute struct {
	Priority      int      `json:"priority" yaml:"priority,omitempty"`
	Enabled       bool     `json:"enabled" yaml:"enabled"`
	Force         bool     `json:"force" yaml:"force"`
	Runtime       bool     `json:"runtime" yaml:"runtime,omitempty"`
	Key           string   `json:"key" yaml:"key"`
	Scope         string   `json:"scope" yaml:"scope"`
	Conditions    []string `json:"conditions" yaml:"conditions"`
	ConfigVersion string   `json:"configVersion" yaml:"configVersion"`
}

type ConditionRouteDto

type ConditionRouteDto struct {
	Base

	Conditions []string `json:"conditions" yaml:"conditions" binding:"required"`

	Priority      int    `json:"priority" yaml:"priority"`
	Enabled       bool   `json:"enabled" yaml:"enabled" binding:"required"`
	Force         bool   `json:"force" yaml:"force"`
	Runtime       bool   `json:"runtime" yaml:"runtime"`
	ConfigVersion string `json:"configVersion" yaml:"configVersion" binding:"required"`
}

type Consumer

type Consumer struct {
	Entity
	Service     string        `json:"service"`
	Parameters  string        `json:"parameters"`
	Result      string        `json:"result"`
	Address     string        `json:"address"`
	Registry    string        `json:"registry"`
	Application string        `json:"application"`
	Username    string        `json:"username"`
	Statistics  string        `json:"statistics"`
	Collected   time.Duration `json:"collected"`
	Expired     time.Duration `json:"expired"`
	Alived      int64         `json:"alived"`
}

type DynamicConfig

type DynamicConfig struct {
	Base
	ConfigVersion string           `json:"configVersion"`
	Enabled       bool             `json:"enabled"`
	Configs       []OverrideConfig `json:"configs"`
}

func (*DynamicConfig) ToOldOverride

func (d *DynamicConfig) ToOldOverride() []*OldOverride

func (*DynamicConfig) ToOverride

func (d *DynamicConfig) ToOverride() *Override

type Entity

type Entity struct {
	Id              int64     `json:"id"`
	Ids             []int64   `json:"ids"`
	Hash            string    `json:"hash"`
	Created         time.Time `json:"created"`
	Modified        time.Time `json:"modified"`
	Now             time.Time `json:"now"`
	Operator        string    `json:"operator"`
	OperatorAddress string    `json:"operatorAddress"`
	Miss            bool      `json:"miss"`
}

func NewEntity

func NewEntity(id int64) Entity

func (*Entity) Equals

func (e *Entity) Equals(other *Entity) bool

func (*Entity) SetOperator

func (e *Entity) SetOperator(operator string)

type FlowMetricsRes

type FlowMetricsRes struct {
	Data map[string]float64 `json:"data"`
}

type Gray

type Gray struct {
	Application string `json:"application" binding:"required"`
	Tags        []Tag  `json:"tags" binding:"required"`
}

func (Gray) ToRule

func (g Gray) ToRule() TagRoute

type HTTPError

type HTTPError struct {
	// error message
	Error string `json:"error"`
}

type Host

type Host struct {
	Condition string `json:"condition" binding:"required"`
	Host      string `json:"host" binding:"required"`
}

type ListMockRulesByPage

type ListMockRulesByPage struct {
	Total   int64       `json:"total"`
	Content []*MockRule `json:"content"`
}

type ListServiceByPage

type ListServiceByPage struct {
	Content       []*ServiceDTO `json:"content"`
	TotalPages    int           `json:"totalPages"`
	TotalElements int           `json:"totalElements"`
	Size          string        `json:"size"`
	First         bool          `json:"first"`
	Last          bool          `json:"last"`
	PageNumber    string        `json:"pageNumber"`
	Offset        int           `json:"offset"`
}

type ListStringMatch

type ListStringMatch struct {
	Oneof []StringMatch `json:"oneof" yaml:"oneof,omitempty"`
}

func (*ListStringMatch) IsMatch

func (l *ListStringMatch) IsMatch(input string) bool

type Metadata

type Metadata struct {
	Versions       []interface{} `json:"versions"`
	ConfigCenter   string        `json:"configCenter"`
	Registry       string        `json:"registry"`
	MetadataCenter string        `json:"metadataCenter"`
	Protocols      []interface{} `json:"protocols"`
	Rules          []string      `json:"rules"`
}

type Mock

type Mock struct {
	Service string `json:"service" binding:"required"`
	Group   string `json:"group"`
	Version string `json:"version"`
	Mock    string `json:"mock" binding:"required"`
}

func (Mock) ToRule

func (t Mock) ToRule() Override

type MockRule

type MockRule struct {
	ID          uint   `json:"id"`
	ServiceName string `json:"serviceName"`
	MethodName  string `json:"methodName"`
	Rule        string `json:"rule"`
	Enable      bool   `json:"enable"`
}

func (*MockRule) ToMockRuleEntity

func (m *MockRule) ToMockRuleEntity() *MockRuleEntity

type MockRuleEntity

type MockRuleEntity struct {
	gorm.Model
	ServiceName string `gorm:"type:varchar(255)"`
	MethodName  string `gorm:"type:varchar(255)"`
	Rule        string `gorm:"type:text"`
	Enable      bool
}

func (*MockRuleEntity) TableName

func (m *MockRuleEntity) TableName() string

func (*MockRuleEntity) ToMockRule

func (m *MockRuleEntity) ToMockRule() *MockRule

type OldOverride

type OldOverride struct {
	Entity
	Service     string
	Address     string
	Enabled     bool
	Application string
	Params      string
}

func (*OldOverride) SetParamsByOverrideConfig

func (o *OldOverride) SetParamsByOverrideConfig(config OverrideConfig)

type Override

type Override struct {
	Key           string           `json:"key" yaml:"key"`
	Scope         string           `json:"scope" yaml:"scope"`
	ConfigVersion string           `json:"configVersion" yaml:"configVersion"`
	Enabled       bool             `json:"enabled" yaml:"enabled"`
	Configs       []OverrideConfig `json:"configs" yaml:"configs"`
}

func (*Override) ToDynamicConfig

func (o *Override) ToDynamicConfig() *DynamicConfig

type OverrideConfig

type OverrideConfig struct {
	Side              string                 `json:"side" yaml:"side"`
	Addresses         []string               `json:"addresses" yaml:"addresses,omitempty"`
	ProviderAddresses []string               `json:"providerAddresses" yaml:"providerAddresses,omitempty"`
	Parameters        map[string]interface{} `json:"parameters" yaml:"parameters"`
	Applications      []string               `json:"applications" yaml:"applications,omitempty"`
	Services          []string               `json:"services" yaml:"services,omitempty"`
	Type              string                 `json:"type" yaml:"type,omitempty"`
	Enabled           bool                   `json:"enabled" yaml:"enabled,omitempty"`
	Match             ConditionMatch         `json:"match" yaml:"match,omitempty"`
}

type ParamMatch

type ParamMatch struct {
	Key   string      `json:"key" yaml:"key"`
	Value StringMatch `json:"value" yaml:"value"`
}

func (*ParamMatch) IsMatch

func (m *ParamMatch) IsMatch(url *common.URL) bool

type Percentage

type Percentage struct {
	Service string   `json:"service" binding:"required"`
	Group   string   `json:"group"`
	Version string   `json:"version"`
	Weights []Weight `json:"weights" binding:"required"`
}

func (Percentage) ToRule

func (p Percentage) ToRule() Override

type Provider

type Provider struct {
	Entity
	Service        string         `json:"service"`
	URL            string         `json:"url"`
	Parameters     string         `json:"parameters"`
	Address        string         `json:"address"`
	Registry       string         `json:"registry"`
	Dynamic        bool           `json:"dynamic"`
	Enabled        bool           `json:"enabled"`
	Timeout        int64          `json:"timeout"`
	Serialization  string         `json:"serialization"`
	Weight         int64          `json:"weight"`
	Application    string         `json:"application"`
	Username       string         `json:"username"`
	Expired        time.Duration  `json:"expired"`
	Alived         int64          `json:"alived"`
	RegistrySource RegistrySource `json:"registrySource"`
}

type Region

type Region struct {
	Service string `json:"service" binding:"required"`
	Group   string `json:"group"`
	Version string `json:"version"`
	Rule    string `json:"rule"`
}

func (Region) ToRule

func (r Region) ToRule() ConditionRoute

type RegistrySource

type RegistrySource string

type ResponseAny

type ResponseAny struct {
	Code int `json:"code"`
	Data any `json:"data"`
}

type Retry

type Retry struct {
	Service string `json:"service" binding:"required"`
	Group   string `json:"group"`
	Version string `json:"version"`
	Retry   int    `json:"retry" binding:"required"`
}

func (Retry) ToRule

func (t Retry) ToRule() Override

type ServiceDTO

type ServiceDTO struct {
	Service        string         `json:"service"`
	AppName        string         `json:"appName"`
	Group          string         `json:"group"`
	Version        string         `json:"version"`
	RegistrySource RegistrySource `json:"registrySource"`
}

ServiceDTO is the transforming format of service

type ServiceDetailDTO

type ServiceDetailDTO struct {
	Providers   []*Provider `json:"providers"`
	Consumers   []*Consumer `json:"consumers"`
	Service     string      `json:"service"`
	Application string      `json:"application"`
	Metadata    interface{} `json:"metadata"`
}

type StringMatch

type StringMatch struct {
	Exact    string `json:"exact" yaml:"exact,omitempty"`
	Prefix   string `json:"prefix" yaml:"prefix,omitempty"`
	Regex    string `json:"regex" yaml:"regex,omitempty"`
	Noempty  string `json:"noempty" yaml:"noempty,omitempty"`
	Empty    string `json:"empty" yaml:"empty,omitempty"`
	Wildcard string `json:"wildcard" yaml:"wildcard,omitempty"`
}

func (*StringMatch) IsMatch

func (m *StringMatch) IsMatch(input string) bool

type Tag

type Tag struct {
	Name      string       `json:"name" yaml:"name" binding:"required"`
	Match     []ParamMatch `json:"match" yaml:"match" binding:"required,omitempty"`
	Addresses []string     `json:"addresses" yaml:"addresses,omitempty"`
}

type TagRoute

type TagRoute struct {
	Priority      int    `json:"priority" yaml:"priority,omitempty"`
	Enabled       bool   `json:"enabled" yaml:"enabled"`
	Force         bool   `json:"force" yaml:"force"`
	Runtime       bool   `json:"runtime" yaml:"runtime,omitempty"`
	Key           string `json:"key" yaml:"key"`
	Tags          []Tag  `json:"tags" yaml:"tags"`
	ConfigVersion string `json:"configVersion" yaml:"configVersion"`
}

type TagRouteDto

type TagRouteDto struct {
	Base

	Tags []Tag `json:"tags" yaml:"tags" binding:"required"`

	Priority      int    `json:"priority" yaml:"priority,omitempty"`
	Enabled       bool   `json:"enabled" yaml:"enabled" binding:"required"`
	Force         bool   `json:"force" yaml:"force"`
	Runtime       bool   `json:"runtime" yaml:"runtime,omitempty"`
	ConfigVersion string `json:"configVersion" yaml:"configVersion" binding:"required"`
}

type Target

type Target struct {
	Targets []string          `json:"targets"`
	Labels  map[string]string `json:"labels"`
}

type Timeout

type Timeout struct {
	Service string `json:"service" binding:"required"`
	Group   string `json:"group"`
	Version string `json:"version"`
	Timeout int    `json:"timeout" binding:"required"`
}

func (Timeout) ToRule

func (t Timeout) ToRule() Override

type Weight

type Weight struct {
	Weight int            `json:"weight" binding:"required"`
	Match  ConditionMatch `json:"match"  binding:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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