client

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryGlobal = "global"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*LBClient
	Cfg Config
}

func NewSCClient

func NewSCClient(cfg Config) (*Client, error)

func (*Client) CommonHeaders

func (c *Client) CommonHeaders(ctx context.Context) http.Header

func (*Client) CreateSchemas

func (c *Client) CreateSchemas(ctx context.Context, domain, project, serviceID string, schemas []*pb.Schema) *scerr.Error

func (*Client) CreateService

func (c *Client) CreateService(ctx context.Context, domain, project string, service *pb.MicroService) (string, *scerr.Error)

func (*Client) DeleteSchema

func (c *Client) DeleteSchema(ctx context.Context, domain, project, serviceID string, schemaID string) *scerr.Error

func (*Client) DeleteService

func (c *Client) DeleteService(ctx context.Context, domain, project, serviceID string) *scerr.Error

func (*Client) DiscoveryInstances

func (c *Client) DiscoveryInstances(ctx context.Context, domain, project, consumerID, providerAppID, providerServiceName, providerVersionRule string) ([]*registry.MicroServiceInstance, *scerr.Error)

func (*Client) GetClusters

func (c *Client) GetClusters(ctx context.Context) (types.Clusters, *scerr.Error)

func (*Client) GetInstanceByInstanceID

func (c *Client) GetInstanceByInstanceID(ctx context.Context, domain, project, providerID, instanceID, consumerID string) (*registry.MicroServiceInstance, *scerr.Error)

func (*Client) GetInstancesByServiceID

func (c *Client) GetInstancesByServiceID(ctx context.Context, domain, project, providerID, consumerID string) ([]*registry.MicroServiceInstance, *scerr.Error)

func (*Client) GetScCache

func (c *Client) GetScCache(ctx context.Context) (*model.Cache, *scerr.Error)

func (*Client) GetScVersion

func (c *Client) GetScVersion(ctx context.Context) (*version.Set, *scerr.Error)

func (*Client) GetSchemaBySchemaID

func (c *Client) GetSchemaBySchemaID(ctx context.Context, domain, project, serviceID, schemaID string) (*pb.Schema, *scerr.Error)

func (*Client) GetSchemasByServiceID

func (c *Client) GetSchemasByServiceID(ctx context.Context, domain, project, serviceID string) ([]*pb.Schema, *scerr.Error)

func (*Client) HealthCheck

func (c *Client) HealthCheck(ctx context.Context) *scerr.Error

func (*Client) Heartbeat

func (c *Client) Heartbeat(ctx context.Context, domain, project, serviceID, instanceID string) *scerr.Error

func (*Client) HeartbeatSet

func (c *Client) HeartbeatSet(ctx context.Context, domain, project string, instances ...*registry.HeartbeatSetElement) ([]*registry.InstanceHbRst, *scerr.Error)

func (*Client) RegisterInstance

func (c *Client) RegisterInstance(ctx context.Context, domain, project, serviceID string, instance *registry.MicroServiceInstance) (string, *scerr.Error)

func (*Client) ServiceExistence

func (c *Client) ServiceExistence(ctx context.Context, domain, project string, appID, serviceName, versionRule, env string) (string, *scerr.Error)

func (*Client) UnregisterInstance

func (c *Client) UnregisterInstance(ctx context.Context, domain, project, serviceID, instanceID string) *scerr.Error

func (*Client) UpdateSchema

func (c *Client) UpdateSchema(ctx context.Context, domain, project, serviceID string, schemaID string, schema string) *scerr.Error

func (*Client) Watch

func (c *Client) Watch(ctx context.Context, domain, project, selfServiceID string, callback func(*pb.WatchInstanceResponse)) *scerr.Error

type Config

type Config struct {
	rest.URLClientOption
	Name      string
	Endpoints []string
	// TODO Expandable header not only token header
	Token          string
	CertKeyPWDPath string
}

func (*Config) Merge

func (cfg *Config) Merge() rest.URLClientOption

type LBClient

type LBClient struct {
	*rest.URLClient
	Retries int
	LB      lb.LoadBalancer
}

func NewLBClient

func NewLBClient(endpoints []string, options rest.URLClientOption) (*LBClient, error)

func (*LBClient) Next

func (c *LBClient) Next() string

func (*LBClient) RestDoWithContext

func (c *LBClient) RestDoWithContext(ctx context.Context, method string, api string, headers http.Header, body []byte) (resp *http.Response, err error)

func (*LBClient) WebsocketDial

func (c *LBClient) WebsocketDial(ctx context.Context, api string, headers http.Header) (conn *websocket.Conn, err error)

Jump to

Keyboard shortcuts

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