dto

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveHealthcheckDto

type ActiveHealthcheckDto struct {
	// 默认是1
	Timeout int `json:"timeout,omitempty"`
	// 默认是10
	Concurrency int          `json:"concurrency,omitempty"`
	HttpPath    string       `json:"http_path,omitempty"`
	Healthy     HealthyDto   `json:"healthy,omitempty"`
	Unhealthy   UnhealthyDto `json:"unhealthy,omitempty"`
}

type HealthchecksDto

type HealthchecksDto struct {
	Active  ActiveHealthcheckDto  `json:"active,omitempty"`
	Passive PassiveHealthcheckDto `json:"passive,omitempty"`
}

func NewHealthchecks

func NewHealthchecks(checkPath string) HealthchecksDto

type HealthyDto

type HealthyDto struct {
	// 默认是0 active下关闭探测
	Interval int `json:"interval,omitempty"`
	// active默认是[200, 302] passive默认是2xx,3xx
	HttpStatuses []int `json:"http_statuses,omitempty"`
	// 默认是0
	Successes int `json:"successes,omitempty"`
}

type KongConfigsDto

type KongConfigsDto struct {
	Configuration KongConfiguration `json:"configuration"`
	Version       string            `json:"version"`
}

type KongConfiguration

type KongConfiguration struct {
	Plugins []string `json:"plugins"`
}

type KongConsumerReqDto

type KongConsumerReqDto struct {
	// 用户名,必填
	Username string `json:"username"`
	// 第三方唯一id,选填
	CustomId string `json:"custom_id,omitempty"`
}

func NewKongConsumerReqDto

func NewKongConsumerReqDto(name string, customId string) *KongConsumerReqDto

func (KongConsumerReqDto) IsEmpty

func (dto KongConsumerReqDto) IsEmpty() bool

type KongConsumerRespDto

type KongConsumerRespDto struct {
	CustomId  string `json:"custom_id"`
	CreatedAt int64  `json:"created_at"`
	// consumerId
	Id string `json:"id"`
}

type KongCredentialDto

type KongCredentialDto struct {
	ConsumerId string `json:"consumer_id,omitempty"`
	CreatedAt  int64  `json:"created_at,omitempty"`
	Id         string `json:"id,omitempty"`
	// key-auth, sign-auth
	Key string `json:"key,omitempty"`
	// oauth2
	RedirectUrl interface{} `json:"redirect_uri,omitempty"`
	// v2
	RedirectUrls []string `json:"redirect_uris,omitempty"`
	Name         string   `json:"name,omitempty"`
	ClientId     string   `json:"client_id,omitempty"`
	ClientSecret string   `json:"client_secret,omitempty"`
	// sign-auth, hmac-auth
	Secret string `json:"secret,omitempty"`
	// hmac-auth
	Username string `json:"username,omitempty"`
}

func FromCredential added in v1.3.0

func FromCredential(cred *pb.Credential) KongCredentialDto

func (*KongCredentialDto) Compatiable

func (dto *KongCredentialDto) Compatiable()

func (KongCredentialDto) ToCredential added in v1.3.0

func (dto KongCredentialDto) ToCredential() *pb.Credential

func (*KongCredentialDto) ToHmacReq

func (dto *KongCredentialDto) ToHmacReq()

func (*KongCredentialDto) ToHmacResp

func (dto *KongCredentialDto) ToHmacResp()

func (*KongCredentialDto) ToV2

func (dto *KongCredentialDto) ToV2()

type KongCredentialListDto

type KongCredentialListDto struct {
	Total int64               `json:"total"`
	Data  []KongCredentialDto `json:"data"`
}

type KongCredentialReqDto

type KongCredentialReqDto struct {
	// 消费者id,必填
	ConsumerId string `json:"consumer_id"`
	// 插件名称
	PluginName string `json:"plugin_name,omitempty"`
	// 其余选填配置
	Config *KongCredentialDto `json:"config,omitempty"`
}

func (KongCredentialReqDto) IsEmpty

func (dto KongCredentialReqDto) IsEmpty() bool

IsEmpty

type KongObj

type KongObj struct {
	Id string `json:"id"`
}

type KongPluginReqDto

type KongPluginReqDto struct {
	// 插件名称,必填
	Name string `json:"name"`
	// 1、服务id
	ServiceId string `json:"service_id,omitempty"`
	// 2、路由id
	RouteId string `json:"route_id,omitempty"`
	// 3、消费者id
	ConsumerId string   `json:"consumer_id,omitempty"`
	Route      *KongObj `json:"route,omitempty"`
	Service    *KongObj `json:"service,omitempty"`
	Consumer   *KongObj `json:"consumer,omitempty"`
	// 是否开启,默认true
	Enabled *bool `json:"enabled,omitempty"`
	// 其余配置
	Config    map[string]interface{} `json:"config,omitempty"`
	Id        string                 `json:"id,omitempty"`
	CreatedAt int64                  `json:"created_at,omitempty"`
	// 插件id,删除或更新时使用
	PluginId string `json:"-"`
}

func (KongPluginReqDto) IsEmpty

func (dto KongPluginReqDto) IsEmpty() bool

IsEmpty

func (*KongPluginReqDto) ToV2

func (dto *KongPluginReqDto) ToV2()

ToV2

type KongPluginRespDto

type KongPluginRespDto struct {
	Id         string                 `json:"id"`
	ServiceId  string                 `json:"service_id"`
	RouteId    string                 `json:"route_id"`
	ConsumerId string                 `json:"consumer_id"`
	Route      *KongObj               `json:"route"`
	Service    *KongObj               `json:"service"`
	Consumer   *KongObj               `json:"consumer"`
	Name       string                 `json:"name"`
	Config     map[string]interface{} `json:"config"`
	Enabled    bool                   `json:"enabled"`
	CreatedAt  int64                  `json:"created_at"`
	PolicyId   string                 `json:"-"`
}

func (*KongPluginRespDto) Compatiable

func (dto *KongPluginRespDto) Compatiable()

type KongPluginsDto

type KongPluginsDto struct {
	Total int64               `json:"total"`
	Data  []KongPluginRespDto `json:"data"`
}

type KongRouteReqDto

type KongRouteReqDto struct {
	// 协议列表,默认["http", "https"]
	Protocols []string `json:"protocols,omitempty"`
	// 以下三个参数至少需要填一个
	// 1、方法列表
	Methods []string `json:"methods,omitempty"`
	// 2、主机列表
	Hosts []string `json:"hosts,omitempty"`
	// 3、路径列表
	Paths []string `json:"paths,omitempty"`
	// 选填,当通过路径之一匹配路由时,从上游请求URL中去除匹配的前缀。
	StripPath *bool `json:"strip_path,omitempty"`
	// 选填,当通过主机域名中的一个匹配路由时,在上游请求报头中使用请求主机头。
	// 默认情况下设置为false,上游主机头将设置为服务的主机。
	PreserveHost *bool `json:"preserve_host,omitempty"`
	// 绑定服务,必填
	Service *Service `json:"service,omitempty"`
	// 正则匹配优先级,当前使用路径中/的个数
	RegexPriority int `json:"regex_priority,omitempty"`
	// 真正的路由id,更新时使用
	RouteId string `json:"-"`
}

func (KongRouteReqDto) IsEmpty

func (dto KongRouteReqDto) IsEmpty() bool

IsEmpty

type KongRouteRespDto

type KongRouteRespDto struct {
	Id        string   `json:"id"`
	CreatedAt int64    `json:"created_at"`
	UpdatedAt int64    `json:"updated_at"`
	Protocols []string `json:"protocols"`
	Methods   []string `json:"methods"`
	Hosts     []string `json:"hosts"`
	Paths     []string `json:"paths"`
	Service   Service  `json:"service"`
}

type KongRoutesRespDto

type KongRoutesRespDto struct {
	Routes []KongRouteRespDto `json:"data"`
}

type KongServiceReqDto

type KongServiceReqDto struct {
	// 服务名称,选填
	Name string `json:"name,omitempty"`
	// 具体路径,如果设置了这个可以不设下面4个
	Url string `json:"url,omitempty"`
	// 1、协议,默认http
	Protocol string `json:"protocol,omitempty"`
	// 2、主机,没设url则必传
	Host string `json:"host,omitempty"`
	// 3、端口,默认80
	Port int `json:"port,omitempty"`
	// 4、路径,默认null
	Path string `json:"path,omitempty"`
	// 选填,重试次数
	Retries *int `json:"retries,omitempty"`
	// 选填,连接超时时间
	ConnectTimeout int `json:"connect_timeout,omitempty"`
	// 选填,写超时时间
	WriteTimeout int `json:"write_timeout,omitempty"`
	// 选填,读超时时间
	ReadTimeout int `json:"read_timeout,omitempty"`
	// 真正的服务id,更新时使用
	ServiceId string `json:"-"`
}

func (KongServiceReqDto) IsEmpty

func (dto KongServiceReqDto) IsEmpty() bool

IsEmpty

type KongServiceRespDto

type KongServiceRespDto struct {
	Id        string `json:"id"`
	CreatedAt int64  `json:"created_at"`
	UpdatedAt int64  `json:"updated_at"`
	Name      string `json:"name"`
	Protocol  string `json:"protocol"`
	Host      string `json:"host"`
	Port      int    `json:"port"`
	Path      string `json:"path"`
}

type KongTargetDto

type KongTargetDto struct {
	Id     string `json:"id,omitempty"`
	Target string `json:"target"`
	// 默认是100
	Weight     int64  `json:"weight,omitempty"`
	UpstreamId string `json:"upstream_id,omitempty"`
	CreatedAt  int64  `json:"created_at,omitempty"`
	Health     string `json:"health,omitempty"`
}

type KongUpstreamDto

type KongUpstreamDto struct {
	Id           string          `json:"id,omitempty"`
	Name         string          `json:"name"`
	Healthchecks HealthchecksDto `json:"healthchecks"`
}

type KongUpstreamStatusRespDto

type KongUpstreamStatusRespDto struct {
	Data []KongTargetDto `json:"data"`
}

type PassiveHealthcheckDto

type PassiveHealthcheckDto struct {
	Healthy   HealthyDto   `json:"healthy,omitempty"`
	Unhealthy UnhealthyDto `json:"unhealthy,omitempty"`
}

type Service

type Service struct {
	// 绑定服务id,必填
	Id string `json:"id"`
}

type UnhealthyDto

type UnhealthyDto struct {
	// 默认是0 active下关闭探测
	Interval int `json:"interval,omitempty"`
	// active默认是[429, 404, 500, 501, 502, 503, 504, 505] passive默认是[429, 500, 503]
	HttpStatuses []int `json:"http_statuses,omitempty"`
	// 默认是0
	HttpFailures int `json:"http_failures,omitempty"`
	// 默认是0
	TcpFailures int `json:"tcp_failures,omitempty"`
	// 默认是0
	Timeouts int `json:"timeouts,omitempty"`
}

Jump to

Keyboard shortcuts

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