Documentation ¶
Index ¶
- Constants
- Variables
- func NewClient(sc *Config) qcloudif.ClbAdapter
- type Client
- func (c *Client) CreateListener(listener *cloudListenerType.CloudListener) (listenerID string, err error)
- func (c *Client) CreateLoadBalance(lb *cloudListenerType.CloudLoadBalancer) (lbID string, vips []string, err error)
- func (c *Client) CreateRules(lbID, listenerID string, rules cloudListenerType.RuleList) error
- func (c *Client) DeRegister4LayerBackends(lbID, listenerID string, backendsDeRegister cloudListenerType.BackendList) error
- func (c *Client) DeRegister7LayerBackends(lbID, listenerID, ruleID string, ...) error
- func (c *Client) DeleteListener(lbID, listenerID string) error
- func (c *Client) DeleteRule(lbID, listenerID, domain, url string) error
- func (c *Client) DescribeListener(lbID, listenerID string, port int) (listener *cloudListenerType.CloudListener, isExisted bool, err error)
- func (c *Client) DescribeLoadBalance(name string) (*cloudListenerType.CloudLoadBalancer, bool, error)
- func (c *Client) DescribeRuleByDomainAndURL(loadBalanceID, listenerID, Domain, URL string) (rule *cloudListenerType.Rule, isExisted bool, err error)
- func (c *Client) ListListener(lbID string) ([]*cloudListenerType.CloudListener, error)
- func (c *Client) ModifyListenerAttribute(listener *cloudListenerType.CloudListener) error
- func (c *Client) ModifyRuleAttribute(loadBalanceID, listenerID string, rule *cloudListenerType.Rule) error
- func (c *Client) Register4LayerBackends(lbID, listenerID string, backendsRegister cloudListenerType.BackendList) error
- func (c *Client) Register7LayerBackends(lbID, listenerID, ruleID string, ...) error
- type Config
Constants ¶
const ( LoadBalancerForwardApplication = 1 LoadBalancerForwardClassic = 0 LoadBalancerNetworkPublic = "OPEN" LoadBalancerNetworkInternal = "INTERNAL" ListenerProtocolHTTP = "HTTP" ListenerProtocolHTTPS = "HTTPS" ListenerProtocolTCP = "TCP" ListenerProtocolUDP = "UDP" ListenerSSLModeUnidirectional = "UNIDIRECTIONAL" ListenerSSLModeMutual = "MUTUAL" LBAlgorithmLeastConn = "LEAST_CONN" LBAlgorithmRoundRobin = "WRR" LBAlgorithmIPHash = "IP_HASH" // RequestLimitExceededCode code for request exceeded limit RequestLimitExceededCode = "4400" // WrongStatusCode code for incorrect status WrongStatusCode = "4000" )
const ( // DescribeFilterNamePrivateIP filter name for private IP DescribeFilterNamePrivateIP = "private-ip-address" // ClbBackendTargetTypeCVM clb backend type is cvm // clb backend type defined the way to call register backend to listener or rule // when use "CVM": register backend with instance id which is get from cvm ip // when use "ENI": register backend with eni IP ClbBackendTargetTypeCVM = "CVM" // ClbBackendTargetTypeENI clb backend type is elastic network interface ClbBackendTargetTypeENI = "ENI" // TaskStatusDealing task is dealing TaskStatusDealing = 2 // TaskStatusFailed task is failed TaskStatusFailed = 1 // TaskStatusSucceed task is successful TaskStatusSucceed = 0 // ClbStatusCreating clb instance is creating ClbStatusCreating = 0 // ClbStatusNormal clb instance is normal ClbStatusNormal = 1 )
Variables ¶
var LBAlgorithmTypeBcs2SDKMap = map[string]string{ cloudlbType.ClbLBPolicyLeastConn: LBAlgorithmLeastConn, cloudlbType.ClbLBPolicyWRR: LBAlgorithmRoundRobin, cloudlbType.ClbLBPolicyIPHash: LBAlgorithmIPHash, }
LBAlgorithmTypeBcs2SDKMap map for bcs lb policy to sdk lb policy
var LBAlgorithmTypeSDK2BcsMap = map[string]string{ LBAlgorithmLeastConn: cloudlbType.ClbLBPolicyLeastConn, LBAlgorithmRoundRobin: cloudlbType.ClbLBPolicyWRR, LBAlgorithmIPHash: cloudlbType.ClbLBPolicyIPHash, }
LBAlgorithmTypeSDK2BcsMap map for sdk lb policy to bcs lb policy
var ProtocolBcs2SDKMap = map[string]string{ cloudlbType.ClbListenerProtocolHTTP: ListenerProtocolHTTP, cloudlbType.ClbListenerProtocolHTTPS: ListenerProtocolHTTPS, cloudlbType.ClbListenerProtocolTCP: ListenerProtocolTCP, cloudlbType.ClbListenerProtocolUDP: ListenerProtocolUDP, }
ProtocolBcs2SDKMap map for bcs protocol type to sdk protocol type
var ProtocolSDK2BcsMap = map[string]string{ ListenerProtocolHTTP: cloudlbType.ClbListenerProtocolHTTP, ListenerProtocolHTTPS: cloudlbType.ClbListenerProtocolHTTPS, ListenerProtocolTCP: cloudlbType.ClbListenerProtocolTCP, ListenerProtocolUDP: cloudlbType.ClbListenerProtocolUDP, }
ProtocolSDK2BcsMap map for sdk protocol type to bcs protocol type
var SSLModeBcs2SDKMap = map[string]string{ cloudlbType.ClbListenerTLSModeUniDirectional: ListenerSSLModeUnidirectional, cloudlbType.ClbListenerTLSModeMutual: ListenerSSLModeMutual, }
SSLModeBcs2SDKMap map for bcs ssl mode to sdk ssl mode
var SSLModeSDK2BcsMap = map[string]string{ ListenerSSLModeUnidirectional: cloudlbType.ClbListenerTLSModeUniDirectional, ListenerSSLModeMutual: cloudlbType.ClbListenerTLSModeMutual, }
SSLModeSDK2BcsMap map for sdk ssl mode to bcs ssl mode
Functions ¶
func NewClient ¶
func NewClient(sc *Config) qcloudif.ClbAdapter
NewClient create client for tencent cloud sdk
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client client for call tencent cloud sdk
func (*Client) CreateListener ¶
func (c *Client) CreateListener(listener *cloudListenerType.CloudListener) (listenerID string, err error)
CreateListener create listener create7LayerListener and create4LayerListener only return request object CreateListener does request action and waits for result
func (*Client) CreateLoadBalance ¶
func (c *Client) CreateLoadBalance(lb *cloudListenerType.CloudLoadBalancer) (lbID string, vips []string, err error)
CreateLoadBalance call sdk to create clb, return clb id TODO: deal with vips
func (*Client) CreateRules ¶
func (c *Client) CreateRules(lbID, listenerID string, rules cloudListenerType.RuleList) error
CreateRules create rules for clb listener
func (*Client) DeRegister4LayerBackends ¶
func (c *Client) DeRegister4LayerBackends(lbID, listenerID string, backendsDeRegister cloudListenerType.BackendList) error
DeRegister4LayerBackends deregister 4 layer
func (*Client) DeRegister7LayerBackends ¶
func (c *Client) DeRegister7LayerBackends(lbID, listenerID, ruleID string, backendsDeRegister cloudListenerType.BackendList) error
DeRegister7LayerBackends deregister 7 layer backend
func (*Client) DeleteListener ¶
DeleteListener delete listener by loadbalance id and listener id
func (*Client) DeleteRule ¶
DeleteRule delete rule of clb listener by domain and url, loadbalance id and listener id
func (*Client) DescribeListener ¶
func (c *Client) DescribeListener(lbID, listenerID string, port int) (listener *cloudListenerType.CloudListener, isExisted bool, err error)
DescribeListener describe listener by loadbalance id, either listener id or listener port this function does different convertion for 4 layer listener and 7 layer listener.
func (*Client) DescribeLoadBalance ¶
func (c *Client) DescribeLoadBalance(name string) (*cloudListenerType.CloudLoadBalancer, bool, error)
DescribeLoadBalance describe clb by name, return clb info, and return true if it is existed
func (*Client) DescribeRuleByDomainAndURL ¶
func (c *Client) DescribeRuleByDomainAndURL(loadBalanceID, listenerID, Domain, URL string) (rule *cloudListenerType.Rule, isExisted bool, err error)
DescribeRuleByDomainAndURL describe rule by domain and url call DescribeListener api to find the certain listener traverse all the rules in listener with certain domain and url
func (*Client) ListListener ¶
func (c *Client) ListListener(lbID string) ([]*cloudListenerType.CloudListener, error)
ListListener listener listeners in tencent cloud 1. list listener infos 2. list backends 3. list listener health status info
func (*Client) ModifyListenerAttribute ¶
func (c *Client) ModifyListenerAttribute(listener *cloudListenerType.CloudListener) error
ModifyListenerAttribute modify listener attribute modify7LayerListenerAttribute can only modify https listener tls config, leave other modify actions to ModifyRuleAttribute modify4LayerListenerAttribute can modify health check, session, lb policy for 4 layer listener
func (*Client) ModifyRuleAttribute ¶
func (c *Client) ModifyRuleAttribute(loadBalanceID, listenerID string, rule *cloudListenerType.Rule) error
ModifyRuleAttribute modify rule attributes
func (*Client) Register4LayerBackends ¶
func (c *Client) Register4LayerBackends(lbID, listenerID string, backendsRegister cloudListenerType.BackendList) error
Register4LayerBackends 4 layer backend
func (*Client) Register7LayerBackends ¶
func (c *Client) Register7LayerBackends(lbID, listenerID, ruleID string, backendsRegister cloudListenerType.BackendList) error
Register7LayerBackends register 7 layer backend
type Config ¶
type Config struct { // Region tencent cloud region Region string // ProjectID project id for tencent cloud ProjectID int // SubnetID subent id for tencent cloud vpc, only for creating private clb instance // it is useless when take over a existed private clb intance SubnetID string // VpcID vpc id for tencent cloud VpcID string // SecretID secret id for tencent cloud SecretID string // SecretKey secret key for tencent cloud SecretKey string // BackendType cvm or eni BackendType string // MaxTimeout times for retrying query asynchronous task result MaxTimeout int // WaitPeriodExceedLimit wait second when exceed api limit WaitPeriodExceedLimit int // WaitPeriodLBDealing wait second when retrying query asynchronous task result WaitPeriodLBDealing int }
Config config for sdk client