http

package
v1.14.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBatchQueryResponse

func GetBatchQueryResponse(response *http.Response) (*api.BatchQueryResponse, error)

GetBatchQueryResponse 获取BatchQueryResponse

func GetBatchWriteResponse

func GetBatchWriteResponse(response *http.Response) (*api.BatchWriteResponse, error)

GetBatchWriteResponse 获取BatchWriteResponse

func GetConfigBatchWriteResponse

func GetConfigBatchWriteResponse(response *http.Response) (*api.ConfigBatchWriteResponse, error)

GetConfigBatchWriteResponse 获取BatchWriteResponse

func GetConfigQueryResponse

func GetConfigQueryResponse(response *http.Response) (*api.ConfigBatchQueryResponse, error)

func GetConfigResponse

func GetConfigResponse(response *http.Response) (*api.ConfigResponse, error)

func GetSimpleResponse

func GetSimpleResponse(response *http.Response) (*api.Response, error)

GetSimpleResponse 获取SimpleResponse

func JSONFromCircuitBreakers

func JSONFromCircuitBreakers(circuitBreakers []*api.CircuitBreaker) (*bytes.Buffer, error)

JSONFromCircuitBreakers marshals a slice of circuit breakers to JSON. 熔断规则数组转JSON

func JSONFromConfigFile

func JSONFromConfigFile(file *api.ConfigFile) (*bytes.Buffer, error)

func JSONFromConfigFileRelease

func JSONFromConfigFileRelease(file *api.ConfigFileRelease) (*bytes.Buffer, error)

func JSONFromConfigGroup

func JSONFromConfigGroup(group *api.ConfigFileGroup) (*bytes.Buffer, error)

*

  • @brief 实例数组转JSON

func JSONFromConfigReleases

func JSONFromConfigReleases(configReleases []*api.ConfigRelease) (*bytes.Buffer, error)

JSONFromConfigReleases marshals a slice of config releases to JSON. 配置发布规则数组转JSON

func JSONFromInstances

func JSONFromInstances(instances []*api.Instance) (*bytes.Buffer, error)

*

  • @brief 实例数组转JSON

func JSONFromNamespaces

func JSONFromNamespaces(namespaces []*api.Namespace) (*bytes.Buffer, error)

JSONFromNamespaces 将命名空间数组转换为JSON

func JSONFromRateLimits

func JSONFromRateLimits(rateLimits []*api.Rule) (*bytes.Buffer, error)

*

  • @brief 限流规则数组转JSON

func JSONFromServices

func JSONFromServices(services []*api.Service) (*bytes.Buffer, error)

*

  • @brief 服务数组转JSON

func Login

func Login(username, password string) (*api.LoginResponse, error)

Types

type Client

type Client struct {
	Address string
	Version string
	Worker  *http.Client
}

Client HTTP客户端

func NewClient

func NewClient(address, version string) *Client

NewClient 创建HTTP客户端

func (*Client) CompleteURL

func (c *Client) CompleteURL(url string, params map[string][]interface{}) string

CompleteURL 生成GET请求的完整URL

func (*Client) CreateCircuitBreakerVersions

func (c *Client) CreateCircuitBreakerVersions(circuitBreakers []*api.CircuitBreaker) (*api.BatchWriteResponse, error)

CreateCircuitBreakerVersions creates a slice of circuit breakers from JSON. 创建熔断规则版本

func (*Client) CreateCircuitBreakers

func (c *Client) CreateCircuitBreakers(circuitBreakers []*api.CircuitBreaker) (*api.BatchWriteResponse, error)

CreateCircuitBreakers creates a slice of circuit breakers from JSON. 创建熔断规则

func (*Client) CreateConfigFile

func (c *Client) CreateConfigFile(file *api.ConfigFile) (*api.ConfigResponse, error)

func (*Client) CreateConfigFileRelease

func (c *Client) CreateConfigFileRelease(file *api.ConfigFileRelease) (*api.ConfigResponse, error)

func (*Client) CreateConfigGroup

func (c *Client) CreateConfigGroup(group *api.ConfigFileGroup) (*api.ConfigResponse, error)

func (*Client) CreateInstances

func (c *Client) CreateInstances(instances []*api.Instance) (*api.BatchWriteResponse, error)

*

  • @brief 创建实例

func (*Client) CreateNamespaces

func (c *Client) CreateNamespaces(namespaces []*api.Namespace) (*api.BatchWriteResponse, error)

CreateNamespaces 创建命名空间

func (*Client) CreateRateLimits

func (c *Client) CreateRateLimits(rateLimits []*api.Rule) (*api.BatchWriteResponse, error)

*

  • @brief 创建限流规则

func (*Client) CreateServices

func (c *Client) CreateServices(services []*api.Service) (*api.BatchWriteResponse, error)

*

  • @brief 创建服务

func (*Client) DeleteCircuitBreakers

func (c *Client) DeleteCircuitBreakers(circuitBreakers []*api.CircuitBreaker) error

*

  • @brief 删除熔断规则

func (*Client) DeleteConfigFile

func (c *Client) DeleteConfigFile(file *api.ConfigFile) (*api.ConfigResponse, error)

func (*Client) DeleteConfigGroup

func (c *Client) DeleteConfigGroup(group *api.ConfigFileGroup) (*api.ConfigResponse, error)

func (*Client) DeleteInstances

func (c *Client) DeleteInstances(instances []*api.Instance) error

*

  • @brief 删除实例

func (*Client) DeleteNamespaces

func (c *Client) DeleteNamespaces(namespaces []*api.Namespace) error

DeleteNamespaces 删除命名空间

func (*Client) DeleteNamespacesGetResp

func (c *Client) DeleteNamespacesGetResp(namespaces []*api.Namespace) (*api.BatchWriteResponse, error)

DeleteNamespaces 删除命名空间

func (*Client) DeleteRateLimits

func (c *Client) DeleteRateLimits(rateLimits []*api.Rule) error

*

  • @brief 删除限流规则

func (*Client) DeleteServices

func (c *Client) DeleteServices(services []*api.Service) error

*

  • @brief 删除服务

func (*Client) EnableRateLimits

func (c *Client) EnableRateLimits(rateLimits []*api.Rule) error

EnableRateLimits 启用限流规则

func (*Client) GetCircuitBreaker

func (c *Client) GetCircuitBreaker(masterCircuitBreaker, circuitBreaker *api.CircuitBreaker) error

*

  • @brief 根据id和version查询熔断规则

func (*Client) GetCircuitBreakerByService

func (c *Client) GetCircuitBreakerByService(service *api.Service, masterCircuitBreaker,
	circuitBreaker *api.CircuitBreaker) error

*

  • @brief 查询服务绑定的熔断规则

func (*Client) GetCircuitBreakerVersions

func (c *Client) GetCircuitBreakerVersions(circuitBreaker *api.CircuitBreaker) error

*

  • @brief 查询熔断规则所有版本

func (*Client) GetCircuitBreakersRelease

func (c *Client) GetCircuitBreakersRelease(circuitBreaker *api.CircuitBreaker, correctService *api.Service) error

*

  • @brief 查询熔断规则的已发布规则及服务

func (*Client) GetInstances

func (c *Client) GetInstances(instances []*api.Instance) error

*

  • @brief 查询实例

func (*Client) GetNamespaces

func (c *Client) GetNamespaces(namespaces []*api.Namespace) ([]*api.Namespace, error)

GetNamespaces 查询命名空间

func (*Client) GetRateLimits

func (c *Client) GetRateLimits(rateLimits []*api.Rule) error

*

  • @brief 查询限流规则

func (*Client) GetServices

func (c *Client) GetServices(services []*api.Service) error

*

  • @brief 查询服务

func (*Client) QueryConfigGroup

func (c *Client) QueryConfigGroup(group *api.ConfigFileGroup, offset, limit int64) (*api.ConfigBatchQueryResponse, error)

func (*Client) ReleaseCircuitBreakers

func (c *Client) ReleaseCircuitBreakers(configReleases []*api.ConfigRelease) error

*

  • @brief 发布熔断规则

func (*Client) SendRequest

func (c *Client) SendRequest(method string, url string, body *bytes.Buffer) (*http.Response, error)

SendRequest 发送请求 HTTP Post/Put

func (*Client) UnbindCircuitBreakers

func (c *Client) UnbindCircuitBreakers(configReleases []*api.ConfigRelease) error

*

  • @brief 解绑熔断规则

func (*Client) UpdateCircuitBreakers

func (c *Client) UpdateCircuitBreakers(circuitBreakers []*api.CircuitBreaker) error

UpdateCircuitBreakers 更新熔断规则

func (*Client) UpdateConfigFile

func (c *Client) UpdateConfigFile(file *api.ConfigFile) (*api.ConfigResponse, error)

func (*Client) UpdateConfigGroup

func (c *Client) UpdateConfigGroup(group *api.ConfigFileGroup) (*api.ConfigResponse, error)

func (*Client) UpdateInstances

func (c *Client) UpdateInstances(instances []*api.Instance) error

*

  • @brief 更新实例

func (*Client) UpdateNamesapces

func (c *Client) UpdateNamesapces(namespaces []*api.Namespace) error

UpdateNamesapces 更新命名空间

func (*Client) UpdateRateLimits

func (c *Client) UpdateRateLimits(rateLimits []*api.Rule) error

*

  • @brief 更新限流规则

func (*Client) UpdateServices

func (c *Client) UpdateServices(services []*api.Service) error

*

  • @brief 更新服务

Jump to

Keyboard shortcuts

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