api

package
v0.9.49 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDomain

func DeleteDomain(cli bce.Client, domain string) error

DeleteDomain - delete a specified domain from BCE CDN system For details, please refer https://cloud.baidu.com/doc/CDN/s/Njwvyey7f

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • error: nil if success otherwise the specific error

func DisableDomain

func DisableDomain(cli bce.Client, domain string) error

DisableDomain - disable a specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/9jwvyew3e

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • error: nil if success otherwise the specific error

func DisableDsa

func DisableDsa(cli bce.Client) error

DisableDsa - disable DSA For details, please refer https://cloud.baidu.com/doc/CDN/s/7jwvyf1h5

PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • error: nil if success otherwise the specific error

func EnableDomain

func EnableDomain(cli bce.Client, domain string) error

EnableDomain - enable a specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/Jjwvyexv8

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • error: nil if success otherwise the specific error

func EnableDsa

func EnableDsa(cli bce.Client) error

EnableDsa - enable DSA For details, please refer https://cloud.baidu.com/doc/CDN/s/7jwvyf1h5

PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • error: nil if success otherwise the specific error

func GetContentEncoding

func GetContentEncoding(cli bce.Client, domain string) (string, error)

GetContentEncoding - get the setting about Content-Encoding For details, please refer https://cloud.baidu.com/doc/CDN/s/bjyqycw8g

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • string: the encoding algorithm for transferring, empty means disable encoding in transferring
  • error: nil if success otherwise the specific error

func GetFileTrim

func GetFileTrim(cli bce.Client, domain string) (bool, error)

GetFileTrim - get the trim setting about text file For details, please refer https://cloud.baidu.com/doc/CDN/s/Ujy6vjxnl

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • bool: true means trimming the text file, false means do nothing
  • error: nil if success otherwise the specific error

func GetIPv6 added in v0.9.34

func GetIPv6(cli bce.Client, domain string) (bool, error)

GetIPv6 - get IPv6 switch details for the specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/Ykggnobxd

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain

RETURNS:

  • bool: true for setting IPv6 switch on otherwise closed
  • error: nil if success otherwise the specific error

func GetMobileAccess

func GetMobileAccess(cli bce.Client, domain string) (bool, error)

GetMobileAccess - get the setting about distinguishing the client or not For details, please refer https://cloud.baidu.com/doc/CDN/s/Mjy6vo9z2

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • bool: true means distinguishing the client, false means not
  • error: nil if success otherwise the specific error

func GetOCSP added in v0.9.34

func GetOCSP(cli bce.Client, domain string) (bool, error)

GetOCSP - get "OCSP" switch details for the specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/Xkhyjzcvd

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain

RETURNS:

  • bool: true for "OCSP" opening otherwise closed
  • error: nil if success otherwise the specific error

func GetOfflineMode added in v0.9.34

func GetOfflineMode(cli bce.Client, domain string) (bool, error)

GetOfflineMode - get "offlineMode" switch details for the specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/tkhopvlkj

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain

RETURNS:

  • bool: true for offlineMode opening otherwise closed
  • error: nil if success otherwise the specific error

func GetOriginProtocol added in v0.9.22

func GetOriginProtocol(cli bce.Client, domain string) (string, error)

GetOriginProtocol - get the protocol used for back to the backend server. For details, please refer https://cloud.baidu.com/doc/CDN/s/dk9jdoob4

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • string: the protocol used for back to the backend server, it's value must be "http", "https" or "*"
  • error: nil if success otherwise the specific error

func GetPeak95Bandwidth added in v0.9.10

func GetPeak95Bandwidth(cli bce.Client, startTime, endTime string, domains, tags []string) (peak95Time string, peak95Band int64, err error)

GetPeak95Bandwidth - get peak 95 bandwidth for the specified tags or domains. For details, pleader refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E6%9F%A5%E8%AF%A2%E6%9C%8895%E5%B3%B0%E5%80%BC%E5%B8%A6%E5%AE%BD

PARAMS:

  • cli: the client agent which can perform sending request
  • startTime: start time which in `YYYY-mm-ddTHH:ii:ssZ` style
  • endTime: end time which in `YYYY-mm-ddTHH:ii:ssZ` style
  • domains: a list of domains, only one of `tags` and `domains` can contains item
  • tags: a list of tag names, only one of `tags` and `domains` can contains item

RETURNS:

  • string: the peak95 time which in `YYYY-mm-ddTHH:ii:ssZ` style
  • int64: peak95 bandwidth
  • error: nil if success otherwise the specific error

func GetQUIC added in v0.9.34

func GetQUIC(cli bce.Client, domain string) (bool, error)

GetQUIC - get QUIC switch details for the specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/pkggn6l1f

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain

RETURNS:

  • bool: true for QUIC opening otherwise closed
  • error: nil if success otherwise the specific error

func GetRangeSwitch

func GetRangeSwitch(cli bce.Client, domain string) (bool, error)

GetRangeSwitch - get the range setting For details, please refer https://cloud.baidu.com/doc/CDN/s/5jxzid6o9

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • bool: true means enable range cached, false means disable range cached
  • error: nil if success otherwise the specific error

func ListDomains

func ListDomains(cli bce.Client, marker string) ([]string, string, error)

ListDomains - list all domains that in CDN service For details, please refer https://cloud.baidu.com/doc/CDN/s/sjwvyewt1

PARAMS:

  • cli: the client agent which can perform sending request
  • marker: a marker is a start point of searching

RETURNS:

  • []string: domains belongs to the user
  • string: a marker for next searching, empty if is in the end
  • error: nil if success otherwise the specific error

func SendCustomRequest added in v0.9.34

func SendCustomRequest(cli bce.Client, method string, urlPath string, params, reqHeaders map[string]string, bodyObj interface{}, respObj interface{}) error

SendCustomRequest - send a HTTP request, and response data or error, it use the default times for retrying

PARAMS:

  • cli: the client agent which can perform sending request
  • method: the HTTP requested method, e.g. "GET", "POST", "PUT" ...
  • urlPath: a path component, consisting of a sequence of path segments separated by a slash ( / ).
  • params: the query params, which will be append to the query path, and separate by "&" e.g. http://www.baidu.com?query_param1=value1&query_param2=value2
  • reqHeaders: the request http headers
  • bodyObj: the HTTP requested body content transferred to a goland object
  • respObj: the HTTP response content transferred to a goland object

RETURNS:

  • error: nil if success otherwise the specific error

func SetAccessLimit

func SetAccessLimit(cli bce.Client, domain string, accessLimit *AccessLimit) error

SetAccessLimit - set the qps for on one client For details, please refer https://cloud.baidu.com/doc/CDN/s/Kjy6v02wt

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • accessLimit: the access setting

RETURNS:

  • error: nil if success otherwise the specific error

func SetCacheShared added in v0.9.34

func SetCacheShared(cli bce.Client, domain string, cacheSharedConfig *CacheShared) error

SetCacheShared - set sharing cache with the other domain. For example, 1.test.com shared cache with 2.test.com. First, we query http://2.test.com/index.html and got missed. Secondly, we query http://1.test.com/index.html and got hit because of the CacheShared setting before. For details, please refer https://cloud.baidu.com/doc/CDN/s/0kf272ds7

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain
  • cacheSharedConfig: enabled sets true for shared with the specified domain, otherwise no shared.

RETURNS:

  • error: nil if success otherwise the specific error

func SetCacheTTL

func SetCacheTTL(cli bce.Client, domain string, cacheTTLs []CacheTTL) error

SetCacheTTL - add some rules for cached setting For details, please refer https://cloud.baidu.com/doc/CDN/s/wjxzhgxnx

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • cacheTTLs: the cache setting list

RETURNS:

  • error: nil if success otherwise the specific error

func SetCacheUrlArgs

func SetCacheUrlArgs(cli bce.Client, domain string, cacheFullUrl *CacheUrlArgs) error

SetCacheUrlArgs - tell the CDN system cache the url's params or not For details, please refer https://cloud.baidu.com/doc/CDN/s/vjxzho0kx

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • cacheFullUrl: whether cache the full url or not, full url means include params, also some extra params can be avoided

RETURNS:

  • error: nil if success otherwise the specific error

func SetClientIp

func SetClientIp(cli bce.Client, domain string, clientIp *ClientIp) error

SetClientIp - set the specified HTTP header for the origin server For details, please refer https://cloud.baidu.com/doc/CDN/s/Kjy6umyrm

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • clientIp: header setting

RETURNS:

  • error: nil if success otherwise the specific error

func SetContentEncoding

func SetContentEncoding(cli bce.Client, domain string, enabled bool, encodingType string) error

SetContentEncoding - set Content-Encoding For details, please refer https://cloud.baidu.com/doc/CDN/s/0jyqyahsb

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • enabled: true means using the specified encoding algorithm indicated by "encodingType" in transferring, false means disable encoding

RETURNS:

  • error: nil if success otherwise the specific error

func SetCors

func SetCors(cli bce.Client, domain string, isAllow bool, originList []string) error

SetCors - set about Cross-origin resource sharing For details, please refer https://cloud.baidu.com/doc/CDN/s/Rjxzi1cfs

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • isAllow: true means allow Cors, false means not allow
  • originList: the origin setting, it's invalid when isAllow is false

RETURNS:

  • error: nil if success otherwise the specific error

func SetDomainHttps

func SetDomainHttps(cli bce.Client, domain string, httpsConfig *HTTPSConfig) error

SetDomainHttps - set a rule for speed HTTPS' request For details, please refer https://cloud.baidu.com/doc/CDN/s/rjy6v3tnr

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • httpsConfig: the rules about the HTTP configure

RETURNS:

  • error: nil if success otherwise the specific error

func SetDomainOrigin

func SetDomainOrigin(cli bce.Client, domain string, origins []OriginPeer, defaultHost string) error

SetDomainOrigin - set the origin setting for the new For details, please refer https://cloud.baidu.com/doc/CDN/s/xjxzi7729

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • origins: the origin servers
  • defaultHost: the default host

RETURNS:

  • error: nil if success otherwise the specific error

func SetDomainRequestAuth

func SetDomainRequestAuth(cli bce.Client, domain string, requestAuth *RequestAuth) error

SetDomainRequestAuth - set the authorized rules for requesting For details, please refer https://cloud.baidu.com/doc/CDN/s/njxzi59g9

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • requestAuth: the rules about the auth

RETURNS:

  • error: nil if success otherwise the specific error

func SetDomainSeo

func SetDomainSeo(cli bce.Client, domain string, seoSwitch *SeoSwitch) error

SetDomainSeo - set SEO setting For details, please refer https://cloud.baidu.com/doc/CDN/s/Jjxziuq4y

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • seoSwitch: the setting about SEO

RETURNS:

  • error: nil if success otherwise the specific error

func SetDsaConfig

func SetDsaConfig(cli bce.Client, domain string, dsaConfig *DSAConfig) error

SetDsaConfig - set the DSA configuration For details, please refer https://cloud.baidu.com/doc/CDN/s/0jwvyf26d

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • dsaConfig: the specified configuration for the specified domain

RETURNS:

  • error: nil if success otherwise the specific error

func SetErrorPage

func SetErrorPage(cli bce.Client, domain string, errorPages []ErrorPage) error

SetErrorPage - set the page that redirected to when error occurred For details, please refer https://cloud.baidu.com/doc/CDN/s/Ejy6vc4yb

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • errorPages: the custom pages' setting

RETURNS:

  • error: nil if success otherwise the specific error

func SetFileTrim

func SetFileTrim(cli bce.Client, domain string, fileTrim bool) error

SetFileTrim - trim the text file or not For details, please refer https://cloud.baidu.com/doc/CDN/s/Xjy6vimct

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • fileTrim: true means trimming the text file, false means do nothing

RETURNS:

  • error: nil if success otherwise the specific error

func SetFollowProtocol

func SetFollowProtocol(cli bce.Client, domain string, isFollowProtocol bool) error

SetFollowProtocol - set whether using the same protocol or not when back to the sourced server For details, please refer https://cloud.baidu.com/doc/CDN/s/9jxzi89k2

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • isFollowProtocol: true in using the same protocol or not when back to the sourced server, false for other

RETURNS:

  • error: nil if success otherwise the specific error

func SetHttpHeader

func SetHttpHeader(cli bce.Client, domain string, httpHeaders []HttpHeader) error

SetHttpHeader -set some HTTP headers which can be added or deleted when response form CDN edge node For details, please refer https://cloud.baidu.com/doc/CDN/s/Jjxzil1sd

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • httpHeaders: the HTTP headers' setting

RETURNS:

  • error: nil if success otherwise the specific error

func SetIPv6 added in v0.9.34

func SetIPv6(cli bce.Client, domain string, enabled bool) error

SetIPv6 - open/close IPv6 For details, please refer https://cloud.baidu.com/doc/CDN/s/qkggncsxp

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain
  • enabled: true for setting IPv6 switch on otherwise closed

RETURNS:

  • error: nil if success otherwise the specific error

func SetIpACL

func SetIpACL(cli bce.Client, domain string, blackList []string, whiteList []string) error

SetRefererACL - set a rule for filter some HTTP request, blackList and whiteList only one can be set For details, please refer https://cloud.baidu.com/doc/CDN/s/8jxzhwc4d

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • blackList: the forbidden ip
  • whiteList: the available ip

RETURNS:

  • error: nil if success otherwise the specific error

func SetLimitRate

func SetLimitRate(cli bce.Client, domain string, limitRate int) error

Deprecated SetLimitRate - set limited speed

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • limitRate: the limited rate, "1024" means the transmittal speed is less than 1024 Byte/s

RETURNS:

  • error: nil if success otherwise the specific error

func SetMediaDrag

func SetMediaDrag(cli bce.Client, domain string, mediaDragConf *MediaDragConf) error

SetMediaDrag - set the media setting about mp4 and flv For details, please refer https://cloud.baidu.com/doc/CDN/s/4jy6v6xk3

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • mediaDragConf: media setting about mp4 and flv

RETURNS:

  • error: nil if success otherwise the specific error

func SetMobileAccess

func SetMobileAccess(cli bce.Client, domain string, distinguishClient bool) error

SetMobileAccess - distinguish the client or not For details, please refer https://cloud.baidu.com/doc/CDN/s/Mjy6vmv6g

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • distinguishClient: true means distinguishing the client, false means not

RETURNS:

  • error: nil if success otherwise the specific error

func SetOCSP added in v0.9.34

func SetOCSP(cli bce.Client, domain string, enabled bool) error

SetOCSP - set "OCSP" for the specified domain, For details, please refer https://cloud.baidu.com/doc/CDN/s/Pkf2c0ugn

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain
  • enabled: true for "OCSP" opening otherwise closed

RETURNS:

  • error: nil if success otherwise the specific error

func SetOfflineMode added in v0.9.34

func SetOfflineMode(cli bce.Client, domain string, enabled bool) error

SetOfflineMode - set "offlineMode" for the specified domain, setting true means also response old cached object when got origin server error instead of response error to client directly. For details, please refer https://cloud.baidu.com/doc/CDN/s/xkhopuj48

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain
  • enabled: true for offlineMode opening otherwise closed

RETURNS:

  • error: nil if success otherwise the specific error

func SetOriginProtocol added in v0.9.22

func SetOriginProtocol(cli bce.Client, domain string, originProtocol string) error

SetOriginProtocol - set the http protocol back to backend server. The valid "originProtocol" must be "http", "https" or "*", "http" means send the HTTP request to the backend server, "https" means send the HTTPS request to the backend server, "*" means send the request follow the client's requesting protocol. For details, please refer https://cloud.baidu.com/doc/CDN/s/7k9jdhhlm

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • originProtocol: the protocol used for back to the backend server

RETURNS:

  • error: nil if success otherwise the specific error

func SetQUIC added in v0.9.34

func SetQUIC(cli bce.Client, domain string, enabled bool) error

SetQUIC - open or close QUIC. open QUIC require enabled HTTPS first For details, please refer https://cloud.baidu.com/doc/CDN/s/Qkggmoz7p

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain
  • enabled: true for QUIC opening otherwise closed

RETURNS:

  • error: nil if success otherwise the specific error

func SetRangeSwitch

func SetRangeSwitch(cli bce.Client, domain string, enabled bool) error

SetRangeSwitch - set the range setting For details, please refer https://cloud.baidu.com/doc/CDN/s/Fjxziabst

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • enabled: true means enable range cached, false means disable range cached

RETURNS:

  • error: nil if success otherwise the specific error

func SetRefererACL

func SetRefererACL(cli bce.Client, domain string, blackList []string, whiteList []string, isAllowEmpty bool) error

SetRefererACL - set a rule for filter some HTTP request, blackList and whiteList only one can be set For details, please refer https://cloud.baidu.com/doc/CDN/s/yjxzhvf21

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • blackList: the forbidden host
  • whiteList: the available host

RETURNS:

  • error: nil if success otherwise the specific error

func SetRetryOrigin added in v0.9.34

func SetRetryOrigin(cli bce.Client, domain string, retryOrigin *RetryOrigin) error

SetRetryOrigin - set the policy for retry origin servers if got failed For details, please refer https://cloud.baidu.com/doc/CDN/s/ukhopl3bq

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain
  • retryOrigin: retry policy

RETURNS:

  • error: nil if success otherwise the specific error

func SetTlsVersions

func SetTlsVersions(cli bce.Client, domain string, tlsVersions []string) error

SetTlsVersions - set some TLS versions that you want

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • tlsVersions: TLS version settings

RETURNS:

  • error: nil if success otherwise the specific error

func SetTrafficLimit added in v0.9.34

func SetTrafficLimit(cli bce.Client, domain string, trafficLimit *TrafficLimit) error

SetTrafficLimit - set the traffic limitation for the specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/ujxzi418e

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • trafficLimit: config of traffic limitation

RETURNS:

  • error: nil if success otherwise the specific error

func SetUaACL added in v0.9.34

func SetUaACL(cli bce.Client, domain string, blackList []string, whiteList []string) error

SetUaACL - set a rule for filter the specified HTTP header named "User-Agent" For details, please refer https://cloud.baidu.com/doc/CDN/s/uk88i2a86

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain
  • blackList: the forbidden UA
  • whiteList: the available UA

RETURNS:

  • error: nil if success otherwise the specific error

Types

type AccessLimit

type AccessLimit struct {
	Enabled bool `json:"enabled"`
	Limit   int  `json:"limit,omitempty"`
}

AccessLimit defined a struct for access restriction in one client

func GetAccessLimit

func GetAccessLimit(cli bce.Client, domain string) (*AccessLimit, error)

GetAccessLimit - get the qps setting For details, please refer https://cloud.baidu.com/doc/CDN/s/rjy6v3tnr

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *AccessLimit: the access setting
  • error: nil if success otherwise the specific error

type AvgSpeedDetail

type AvgSpeedDetail struct {
	*DetailBase
	AvgSpeed int64 `json:"avgspeed"`
}

func GetAvgSpeed

func GetAvgSpeed(cli bce.Client, queryCondition *QueryCondition) ([]AvgSpeedDetail, error)

GetAvgSpeed - get the average speed For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E6%9F%A5%E8%AF%A2%E5%B9%B3%E5%9D%87%E9%80%9F%E7%8E%87

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []AvgSpeedDetail: the detail list about the average speed
  • error: nil if success otherwise the specific error

type AvgSpeedRegionData

type AvgSpeedRegionData struct {
	*NetSite
	AvgSpeed int64 `json:"avgspeed"`
}

type AvgSpeedRegionDetail

type AvgSpeedRegionDetail struct {
	*DetailBase
	Distribution []AvgSpeedRegionData `json:"distribution"`
}

func GetAvgSpeedByRegion

func GetAvgSpeedByRegion(cli bce.Client, queryCondition *QueryCondition, prov string, isp string) ([]AvgSpeedRegionDetail, error)

GetAvgSpeed - get the average speed filter by location For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%AE%BF%E9%97%AE%E5%88%86%E5%B8%83%E6%9F%A5%E8%AF%A2%E5%B9%B3%E5%9D%87%E9%80%9F%E7%8E%87

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • prov: the specified area, like "beijing"
  • isp: the specified ISP, like "ct"

RETURNS:

  • []AvgSpeedRegionDetail: the detail list about the average speed
  • error: nil if success otherwise the specific error

type BackOriginNode added in v0.9.34

type BackOriginNode struct {
	CNNAME   string `json:"cnname"`
	IP       string `json:"ip"`
	Level    string `json:"level"`
	City     string `json:"city"`
	Province string `json:"province"`
	ISP      string `json:"isp"`
}

BackOriginNode defined a struct for CDN node which may request the origin server if cache missed.

func GetBackOriginNodes added in v0.9.34

func GetBackOriginNodes(cli bce.Client) ([]BackOriginNode, error)

GetBackOriginNodes - get CDN nodes that may request the origin server if cache missed For details, please refer https://cloud.baidu.com/doc/CDN/s/8jwvyeunq#%E7%99%BE%E5%BA%A6%E5%9B%9E%E6%BA%90ip%E5%9C%B0%E5%9D%80%E6%AE%B5%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3

PARAMS:

  • cli: the client agent can execute sending request

RETURNS:

  • []BackOriginNode: list of CDN node
  • error: nil if success otherwise the specific error

type CRecordQueryData

type CRecordQueryData struct {
	EndTime   string
	StartTime string
	Url       string
	Marker    string
	TaskType  string
}

CRecordQueryData defined a struct for the query conditions about the operated records

type CStatusQueryData

type CStatusQueryData struct {
	EndTime   string
	StartTime string
	Url       string
	Marker    string
	Id        string
}

CStatusQueryData defined a struct for the query conditions about the tasks' progress

type CacheShared added in v0.9.34

type CacheShared struct {
	Enabled    bool   `json:"enabled"`
	SharedWith string `json:"domain,omitempty"`
}

CacheShared defined a struct for sharing cache with the other domain

func GetCacheShared added in v0.9.34

func GetCacheShared(cli bce.Client, domain string) (*CacheShared, error)

GetCacheShared - get shared cache setting For details, please refer https://cloud.baidu.com/doc/CDN/s/Mjy6vo9z2

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *CacheShared: shared cache setting
  • error: nil if success otherwise the specific error

type CacheTTL

type CacheTTL struct {
	Type   string `json:"type"`
	Value  string `json:"value"`
	Weight int    `json:"weight,omitempty"`
	TTL    int    `json:"ttl"`
}

CacheTTL defined a struct for cached rules setting

func GetCacheTTL

func GetCacheTTL(cli bce.Client, domain string) ([]CacheTTL, error)

GetCacheTTL - get the current cached setting For details, please refer https://cloud.baidu.com/doc/CDN/s/ljxzhl9bu

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • []CacheTTL: the cache setting list
  • error: nil if success otherwise the specific error

type CacheUrlArgs

type CacheUrlArgs struct {
	CacheFullUrl bool     `json:"cacheFullUrl"`
	CacheUrlArgs []string `json:"cacheUrlArgs,omitempty"`
}

CacheUrlArgs defined a struct for cache keys

func GetCacheUrlArgs

func GetCacheUrlArgs(cli bce.Client, domain string) (*CacheUrlArgs, error)

GetCacheUrlArgs - get the cached rules For details, please refer https://cloud.baidu.com/doc/CDN/s/sjxzhsb6h

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *CacheUrlArgs: the details about cached rules
  • error: nil if success otherwise the specific error

type CachedDetail

type CachedDetail struct {
	Status     string `json:"status"`
	CreatedAt  string `json:"createdAt"`
	StartedAt  string `json:"startedAt"`
	FinishedAt string `json:"finishedAt"`
	Progress   int64  `json:"progress"`
}

CachedDetail defined a struct for task details

type ClientIp

type ClientIp struct {
	Enabled bool   `json:"enabled"`
	Name    string `json:"name,omitempty"`
}

ClientIp defined a struct for how to get client IP

func GetClientIp

func GetClientIp(cli bce.Client, domain string) (*ClientIp, error)

GetClientIp - get the setting about getting client IP For details, please refer https://cloud.baidu.com/doc/CDN/s/8jy6urcq5

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *ClientIp: the HTTP header setting for origin server to get client IP
  • error: nil if success otherwise the specific error

type CorsCfg

type CorsCfg struct {
	IsAllow bool
	Origins []string
}

CorsCfg defined a struct for cors setting

func GetCors

func GetCors(cli bce.Client, domain string) (*CorsCfg, error)

GetCors - get the Cors setting For details, please refer https://cloud.baidu.com/doc/CDN/s/tjxzi2d7t

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *CorsCfg: the Cors setting
  • error: nil if success otherwise the specific error

type DSAConfig

type DSAConfig struct {
	Enabled bool      `json:"enabled"`
	Rules   []DSARule `json:"rules"`
	Comment string    `json:"comment,omitempty"`
}

DSAConfig defined a struct for DSA configuration

type DSADomain

type DSADomain struct {
	Domain     string    `json:"domain"`
	Rules      []DSARule `json:"rules"`
	ModifyTime string    `json:"modifyTime"`
	Comment    string    `json:"comment"`
}

DSADomain defined a struct about the specified domain's DSA setting

func ListDsaDomains

func ListDsaDomains(cli bce.Client) ([]DSADomain, error)

ListDsaDomains - retrieve all the domains in DSA service For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf1sq

PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • []DSADomain: the details about DSA domains
  • error: nil if success otherwise the specific error

type DSARule

type DSARule struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

DSARule defined a struct for DSA urls

type DetailBase

type DetailBase struct {
	Timestamp string `json:"timestamp"`
	Key       string `json:"key,omitempty"`
}

type DomainConfig

type DomainConfig struct {
	Domain         string       `json:"domain"`
	Cname          string       `json:"cname"`
	Status         string       `json:"status"`
	CreateTime     string       `json:"createTime"`
	LastModifyTime string       `json:"lastModifyTime"`
	IsBan          string       `json:"isBan"`
	Origin         []OriginPeer `json:"origin"`
	DefaultHost    string       `json:"defaultHost,omitempty"`
	CacheTTL       []CacheTTL   `json:"cacheTTL"`
	LimitRate      int          `json:"limitRate"`
	RequestAuth    *RequestAuth `json:"requestAuth,omitempty"`
	Https          *HTTPSConfig `json:"https,omitempty"`
	FollowProtocol bool         `json:"followProtocol"`
	SeoSwitch      *SeoSwitch   `json:"seoSwitch"`
	Form           string       `json:"form"`
}

DomainConfig defined a struct for a specified domain's configuration

func GetDomainConfig

func GetDomainConfig(cli bce.Client, domain string) (*DomainConfig, error)

GetDomainConfig - get the configuration for the specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/2jwvyf39o

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *DomainConfig: the configuration about the specified domain
  • error: nil if success otherwise the specific error

type DomainCreatedInfo

type DomainCreatedInfo struct {
	Domain string `json:"domain"`
	Status string `json:"status"`
	Cname  string `json:"cname"`
}

DomainCreatedInfo defined a struct for `CreateDomain` return

func CreateDomain

func CreateDomain(cli bce.Client, domain string, originInit *OriginInit) (*DomainCreatedInfo, error)

CreateDomain - add a specified domain into CDN service For details, please refer https://cloud.baidu.com/doc/CDN/s/gjwvyex4o

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • originInit: initialized data for a CDN domain

RETURNS:

  • *DomainCreatedInfo: the details about created a CDN domain
  • error: nil if success otherwise the specific error

type DomainStatus

type DomainStatus struct {
	Domain string `json:"domain"`
	Status string `json:"status"`
}

DomainStatus defined a struct for domain info, the status only include "RUNNING", "OPERATING" and "STOPPED", the other status is undefined

func GetDomainStatus

func GetDomainStatus(cli bce.Client, status string, rule string) ([]DomainStatus, error)

GetDomainStatus - get domains' details For details, please refer https://cloud.baidu.com/doc/CDN/s/8jwvyewf1

PARAMS:

  • cli: the client agent which can perform sending request
  • status: the specified running status, the available values are "RUNNING", "STOPPED", OPERATING or "ALL"
  • rule: the regex matching rule

RETURNS:

  • []DomainStatus: domain details list
  • error: nil if success otherwise the specific error

type DomainValidInfo

type DomainValidInfo struct {
	Domain  string
	IsValid bool   `json:"isValid"`
	Message string `json:"message"`
}

DomainValidInfo defined a struct for `IsValidDomain` return

func IsValidDomain

func IsValidDomain(cli bce.Client, domain string) (*DomainValidInfo, error)

IsValidDomain - check the specified domain whether it can be added to CDN service or not For details, please refer https://cloud.baidu.com/doc/CDN/s/qjwvyexh6

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *DomainValidInfo: available information about the specified domain
  • error: nil if success otherwise the specific error

type ErrorDetail

type ErrorDetail struct {
	*DetailBase
	Counters []ErrorKvCounter `json:"counters"`
}

func GetError

func GetError(cli bce.Client, queryCondition *QueryCondition) ([]ErrorDetail, error)

GetError - get the error code's data For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#cdn%E9%94%99%E8%AF%AF%E7%A0%81%E5%88%86%E7%B1%BB%E7%BB%9F%E8%AE%A1%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []ErrorDetail: the top N error details
  • error: nil if success otherwise the specific error

type ErrorKvCounter

type ErrorKvCounter struct {
	Code     string      `json:"code"`
	Counters []KvCounter `json:"counters"`
}

type ErrorPage

type ErrorPage struct {
	Code         int    `json:"code"`
	RedirectCode int    `json:"redirectCode,omitempty"`
	Url          string `json:"url"`
}

ErrorPage defined a struct for redirecting to the custom page when error occur

func GetErrorPage

func GetErrorPage(cli bce.Client, domain string) ([]ErrorPage, error)

GetErrorPage - get the custom pages' setting For details, please refer https://cloud.baidu.com/doc/CDN/s/qjy6vfk2u

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • []ErrorPage: the pages' setting
  • error: nil if success otherwise the specific error

type FlowDetail

type FlowDetail struct {
	*DetailBase
	Flow float64 `json:"flow"`
	Bps  int64   `json:"bps"`
}

func GetFlow

func GetFlow(cli bce.Client, queryCondition *QueryCondition, level string) ([]FlowDetail, error)

GetFlow - get the flow data For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E6%9F%A5%E8%AF%A2%E6%B5%81%E9%87%8F%E3%80%81%E5%B8%A6%E5%AE%BD

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []FlowDetail: the detail list about flow
  • error: nil if success otherwise the specific error

func GetFlowByProtocol

func GetFlowByProtocol(cli bce.Client, queryCondition *QueryCondition, protocol string) ([]FlowDetail, error)

GetFlowByProtocol - get the flow data filter by protocol For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E6%9F%A5%E8%AF%A2%E6%B5%81%E9%87%8F%E3%80%81%E5%B8%A6%E5%AE%BD%E5%88%86%E5%8D%8F%E8%AE%AE

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • protocol: the specified HTTP protocol, like "http" or "https", "all" means both "http" and "https"

RETURNS:

  • []FlowDetail: the detail list about flow
  • error: nil if success otherwise the specific error

func GetSrcFlow

func GetSrcFlow(cli bce.Client, queryCondition *QueryCondition) ([]FlowDetail, error)

GetSrcFlow - get the flow data in backed to sourced server For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E6%9F%A5%E8%AF%A2%E5%9B%9E%E6%BA%90%E6%B5%81%E9%87%8F%E3%80%81%E5%9B%9E%E6%BA%90%E5%B8%A6%E5%AE%BD

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []FlowDetail: the detail list about flow
  • error: nil if success otherwise the specific error

type FlowRegionData

type FlowRegionData struct {
	*NetSite
	Flow float64 `json:"flow"`
	Bps  int64   `json:"bps"`
}

type FlowRegionDetail

type FlowRegionDetail struct {
	*DetailBase
	Distribution []FlowRegionData `json:"distribution"`
}

func GetFlowByRegion

func GetFlowByRegion(cli bce.Client, queryCondition *QueryCondition, prov string, isp string) ([]FlowRegionDetail, error)

GetFlowByRegion - get the flow data filter by location For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E6%9F%A5%E8%AF%A2%E6%B5%81%E9%87%8F%E3%80%81%E5%B8%A6%E5%AE%BD%EF%BC%88%E5%88%86%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%AE%BF%E9%97%AE%E5%88%86%E5%B8%83%EF%BC%89

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • prov: the specified area, like "beijing"
  • isp: the specified ISP, like "ct"

RETURNS:

  • []FlowRegionDetail: the detail list about flow
  • error: nil if success otherwise the specific error

type HTTPSConfig

type HTTPSConfig struct {
	Enabled           bool   `json:"enabled"`
	CertId            string `json:"certId,omitempty"`
	HttpRedirect      bool   `json:"httpRedirect"`
	HttpRedirectCode  int    `json:"httpRedirectCode,omitempty"`
	HttpsRedirect     bool   `json:"httpsRedirect"`
	HttpsRedirectCode int    `json:"httpsRedirectCode"`
	Http2Enabled      bool   `json:"http2Enabled"`
	SslVersion        string `json:"sslVersion,omitempty"`

	// Deprecated: You can no longer use this field,
	// The better choice is use SetOriginProtocol/GetOriginProtocol.
	HttpOrigin bool `json:"-"`
}

HTTPSConfig defined a struct for configuration about HTTPS

func GetDomainHttps

func GetDomainHttps(cli bce.Client, domain string) (*HTTPSConfig, error)

GetDomainHttps - get the setting about HTTPS

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *HTTPSConfig: the rules about the HTTP configure
  • error: nil if success otherwise the specific error

type HitDetail

type HitDetail struct {
	*DetailBase
	HitRate float64 `json:"hitrate"`
}

func GetPvHit

func GetPvHit(cli bce.Client, queryCondition *QueryCondition) ([]HitDetail, error)

GetPvHit - get the detail about PV hit rate For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E8%AF%B7%E6%B1%82%E5%91%BD%E4%B8%AD%E7%8E%87%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []HitDetail: the detail list about pv rate
  • error: nil if success otherwise the specific error

func GetRealHit

func GetRealHit(cli bce.Client, queryCondition *QueryCondition) ([]HitDetail, error)

GetRealHit - get the detail about byte hit rate For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E5%AD%97%E8%8A%82%E5%91%BD%E4%B8%AD%E7%8E%87%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []HitDetail: the detail list about byte rate
  • error: nil if success otherwise the specific error

type HttpCodeDetail

type HttpCodeDetail struct {
	*DetailBase
	Counters []KvCounter `json:"counters"`
}

func GetHttpCode

func GetHttpCode(cli bce.Client, queryCondition *QueryCondition) ([]HttpCodeDetail, error)

GetHttpCode - get the http code's statistics For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E7%8A%B6%E6%80%81%E7%A0%81%E7%BB%9F%E8%AE%A1%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []HttpCodeDetail: the detail list about http code
  • error: nil if success otherwise the specific error

func GetSrcHttpCode

func GetSrcHttpCode(cli bce.Client, queryCondition *QueryCondition) ([]HttpCodeDetail, error)

GetSrcHttpCode - get the http code's statistics in backed to sourced server For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E5%9B%9E%E6%BA%90%E7%8A%B6%E6%80%81%E7%A0%81%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []HttpCodeDetail: the detail list about http code
  • error: nil if success otherwise the specific error

type HttpCodeRegionData

type HttpCodeRegionData struct {
	*NetSite
	Counters []KvCounter `json:"counters"`
}

type HttpCodeRegionDetail

type HttpCodeRegionDetail struct {
	*DetailBase
	Distribution []HttpCodeRegionData `json:"distribution"`
}

func GetHttpCodeByRegion

func GetHttpCodeByRegion(cli bce.Client, queryCondition *QueryCondition, prov string, isp string) ([]HttpCodeRegionDetail, error)

GetHttpCodeByRegion - get the http code's statistics filter by location For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E7%8A%B6%E6%80%81%E7%A0%81%E7%BB%9F%E8%AE%A1%E6%9F%A5%E8%AF%A2%EF%BC%88%E5%88%86%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%AE%BF%E9%97%AE%E5%88%86%E5%B8%83%EF%BC%89

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • prov: the specified area, like "beijing"
  • isp: the specified ISP, like "ct"

RETURNS:

  • []HttpCodeRegionDetail: the detail list about http code
  • error: nil if success otherwise the specific error

type HttpHeader

type HttpHeader struct {
	Type     string `json:"type"`
	Header   string `json:"header"`
	Value    string `json:"value"`
	Action   string `json:"action,omitempty"`
	Describe string `json:"describe,omitempty"`
}

HttpHeader defined a struct for a operation about HTTP header

func GetHttpHeader

func GetHttpHeader(cli bce.Client, domain string) ([]HttpHeader, error)

GetHttpHeader - get the HTTP headers' setting For details, please refer https://cloud.baidu.com/doc/CDN/s/6jxzip3wn

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • error: nil if success otherwise the specific error
  • []HttpHeader: the HTTP headers in setting

type IpACL

type IpACL struct {
	BlackList []string `json:"blackList,omitempty"`
	WhiteList []string `json:"whiteList,omitempty"`
}

IpACL defined a struct for black IP and white IP

func GetIpACL

func GetIpACL(cli bce.Client, domain string) (*IpACL, error)

GetIpACL - get black IP or white IP For details, please refer https://cloud.baidu.com/doc/CDN/s/jjzkp5ku7

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *api.IpACL: ip setting
  • error: nil if success otherwise the specific error

type IpInfo

type IpInfo struct {
	IP      string `json:"ip"`
	IsCdnIp bool   `json:"cdnIP"`
	Isp     string `json:"isp"`
	Region  string `json:"region"`
}

IpInfo defined a struct for IP info

func GetIpInfo

func GetIpInfo(cli bce.Client, ip string, action string) (*IpInfo, error)

GetIpInfo - retrieves information about the specified IP For details, please refer https://cloud.baidu.com/doc/CDN/s/8jwvyeunq#%E5%8D%95%E4%B8%AAip%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3

PARAMS:

  • cli: the client agent can execute sending request
  • ip: the specified ip addr
  • action: the action for operating the ip addr

RETURNS:

  • *IpInfo: the information about the specified ip addr
  • error: nil if success otherwise the specific error

func GetIpListInfo added in v0.9.34

func GetIpListInfo(cli bce.Client, ips []string, action string) ([]IpInfo, error)

GetIpListInfo - retrieves information about the specified IP list For details, please refer https://cloud.baidu.com/doc/CDN/s/8jwvyeunq#ip-list-%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3

PARAMS:

  • cli: the client agent can execute sending request
  • ips: IP list
  • action: the action for operating the ip addr

RETURNS:

  • []IpInfo: IP list's information
  • error: nil if success otherwise the specific error

type KvCounter

type KvCounter struct {
	Name  int64 `json:"name"`
	Count int64 `json:"count"`
}

type LogBase

type LogBase struct {
	Domain string `json:"domain"`
	Url    string `json:"url"`
	Name   string `json:"name"`
	Size   int64  `json:"size"`
}

type LogEntry

type LogEntry struct {
	*LogBase
	*TimeInterval
}

LogEntry defined a struct for log information

func GetDomainLog

func GetDomainLog(cli bce.Client, domain string, timeInterval TimeInterval) ([]LogEntry, error)

GetDomainLog -get one domain's log urls For details, please refer https://cloud.baidu.com/doc/CDN/s/cjwvyf0r9

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain
  • timeInterval: the specified time interval

RETURNS:

  • []LogEntry: the log detail list
  • error: nil if success otherwise the specific error

func GetMultiDomainLog

func GetMultiDomainLog(cli bce.Client, queryData *LogQueryData) ([]LogEntry, error)

GetMultiDomainLog - get many domains' log urls For details, please refer https://cloud.baidu.com/doc/CDN/API.html#.49.B0.4F.9D.D3.1A.FB.6F.59.A6.8A.B6.08.E9.BC.EF

PARAMS:

  • cli: the client agent which can perform sending request
  • queryData: the querying conditions
  • error: nil if success otherwise the specific error

type LogQueryData

type LogQueryData struct {
	TimeInterval
	Type     int      `json:"type,omitempty"`
	Domains  []string `json:"domains,omitempty"`
	PageNo   int      `json:"pageNo,omitempty"`
	PageSize int      `json:"pageSize,omitempty"`
}

LogQueryData defined a struct for query conditions

type MediaCfg

type MediaCfg struct {
	FileSuffix   []string `json:"fileSuffix"`
	StartArgName string   `json:"startArgName,omitempty"`
	EndArgName   string   `json:"endArgName,omitempty"`
	DragMode     string   `json:"dragMode"`
}

MediaCfg defined a struct for a media dragging config

type MediaDragConf

type MediaDragConf struct {
	Mp4 *MediaCfg `json:"mp4,omitempty"`
	Flv *MediaCfg `json:"flv,omitempty"`
}

MediaDragConf defined a struct for dragging configs about 'Mp4' and 'Flv'

func GetMediaDrag

func GetMediaDrag(cli bce.Client, domain string) (*MediaDragConf, error)

GetMediaDrag - get the media setting For details, please refer https://cloud.baidu.com/doc/CDN/s/Ojy6v9q8f

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *MediaDragConf: the media setting about mp4 and flv
  • error: nil if success otherwise the specific error

type NetSite

type NetSite struct {
	Location string `json:"location"`
	Isp      string `json:"isp"`
}

NetSite defined a struct for the ISP's information

type OriginInit

type OriginInit struct {
	Origin      []OriginPeer `json:"origin"`
	DefaultHost string       `json:"defaultHost,omitempty"`
	Form        string       `json:"form,omitempty"`
}

OriginInit defined a struct for creating a new CDN service in `OPENCDN`

type OriginPeer

type OriginPeer struct {
	Peer      string `json:"peer"`
	Host      string `json:"host,omitempty"`
	Backup    bool   `json:"backup"`
	Follow302 bool   `json:"follow302"`
}

OriginPeer defined a struct for an origin server setting

type PVRegionData

type PVRegionData struct {
	*NetSite
	Pv  int64 `json:"pv"`
	Qps int64 `json:"qps"`
}

type PrefetchDetail

type PrefetchDetail struct {
	*CachedDetail
	Task PrefetchTask `json:"task"`
}

PrefetchDetail defined a struct for prefetch task information

type PrefetchId

type PrefetchId string

func Prefetch

func Prefetch(cli bce.Client, tasks []PrefetchTask) (PrefetchId, error)

Prefetch - tells the CDN system to prefetch the specified files For details, please refer https://cloud.baidu.com/doc/CDN/s/Rjwvyf0ff

PARAMS:

  • cli: the client agent which can perform sending request
  • tasks: the tasks about prefetch the files from the CDN nodes
  • error: nil if success otherwise the specific error

type PrefetchStatus

type PrefetchStatus struct {
	Details     []PrefetchDetail `json:"details"`
	IsTruncated bool             `json:"isTruncated"`
	NextMarker  string           `json:"nextMarker"`
}

PrefetchStatus defined a struct for prefetch status

func GetPrefetchStatus

func GetPrefetchStatus(cli bce.Client, queryData *CStatusQueryData) (*PrefetchStatus, error)

GetPrefetchStatus - get the prefetch progress For details, please refer https://cloud.baidu.com/doc/CDN/s/4jwvyf01w

PARAMS:

  • cli: the client agent which can perform sending request
  • queryData: querying conditions, it contains the time interval, the task ID and the specified url

RETURNS:

  • *PrefetchStatus: the details about the prefetch
  • error: nil if success otherwise the specific error

type PrefetchTask

type PrefetchTask struct {
	Url       string `json:"url"`
	Speed     int64  `json:"speed,omitempty"`
	StartTime string `json:"startTime,omitempty"`
}

PrefetchTask defined a struct for prefetch task

type PurgeTask

type PurgeTask struct {
	Url  string `json:"url"`
	Type string `json:"type,omitempty"`
}

PurgeTask defined a struct for purged task

type PurgedDetail

type PurgedDetail struct {
	*CachedDetail
	Task PurgeTask `json:"task"`
}

PurgedDetail defined a struct for purged task information

type PurgedId

type PurgedId string

func Purge

func Purge(cli bce.Client, tasks []PurgeTask) (PurgedId, error)

Purge - tells the CDN system to purge the specified files For more details, please refer https://cloud.baidu.com/doc/CDN/s/ijwvyeyyj

PARAMS:

  • cli: the client agent which can perform sending request
  • tasks: the tasks about purging the files from the CDN nodes

RETURNS:

  • PurgedId: an ID representing a purged task, using it to search the task progress
  • error: nil if success otherwise the specific error

type PurgedStatus

type PurgedStatus struct {
	Details     []PurgedDetail `json:"details"`
	IsTruncated bool           `json:"isTruncated"`
	NextMarker  string         `json:"nextMarker"`
}

PurgedStatus defined a struct for purged status

func GetPurgedStatus

func GetPurgedStatus(cli bce.Client, queryData *CStatusQueryData) (*PurgedStatus, error)

GetPurgedStatus - get the purged progress For details, please refer https://cloud.baidu.com/doc/CDN/s/ujwvyezqm

PARAMS:

  • cli: the client agent which can perform sending request
  • queryData: querying conditions, it contains the time interval, the task ID and the specified url

RETURNS:

  • *PurgedStatus: the details about the purged
  • error: nil if success otherwise the specific error

type PvDetail

type PvDetail struct {
	*DetailBase
	Pv  int64 `json:"pv"`
	Qps int64 `json:"qps"`
}

func GetPv

func GetPv(cli bce.Client, queryCondition *QueryCondition, level string) ([]PvDetail, error)

GetPv - get the PV data For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#pvqps%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • level: the node level, the available values are "edge", "internal" and "all"

RETURNS:

  • []PvDetail: the detail list about page view
  • error: nil if success otherwise the specific error

func GetSrcPv

func GetSrcPv(cli bce.Client, queryCondition *QueryCondition) ([]PvDetail, error)

GetSrcPv - get the PV data in back to the sourced server For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E5%9B%9E%E6%BA%90pvqps%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []PvDetail: the detail list about page view
  • error: nil if success otherwise the specific error

type PvRegionDetail

type PvRegionDetail struct {
	*DetailBase
	Distribution []PVRegionData `json:"distribution"`
}

func GetPvByRegion

func GetPvByRegion(cli bce.Client, queryCondition *QueryCondition, prov string, isp string) ([]PvRegionDetail, error)

GetAvgPvByRegion - get the PV data filter by location For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#%E6%9F%A5%E8%AF%A2pvqps%E5%88%86%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%AE%BF%E9%97%AE%E5%88%86%E5%B8%83

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • prov: the specified area, like "beijing"
  • isp: the specified ISP, like "ct"

RETURNS:

  • []PvRegionDetail: the detail list about page view
  • error: nil if success otherwise the specific error

type QueryCondition

type QueryCondition struct {
	EndTime   string   `json:"endTime,omitempty"`
	StartTime string   `json:"startTime,omitempty"`
	Period    int      `json:"period,omitempty"`
	KeyType   int      `json:"key_type"`
	Key       []string `json:"key,omitempty"`
	GroupBy   string   `json:"groupBy,omitempty"`
}

QueryCondition defined a struct for query condition

type QuotaDetail

type QuotaDetail struct {
	DirRemain int64 `json:"dirRemain"`
	UrlRemain int64 `json:"urlRemain"`
	DirQuota  int64 `json:"dirQuota"`
	UrlQuota  int64 `json:"urlQuota"`
}

QuotaDetail defined a struct for query quota

func GetQuota

func GetQuota(cli bce.Client) (*QuotaDetail, error)

GetQuota - get the quota about purge and prefetch For details, please refer https://cloud.baidu.com/doc/CDN/s/zjwvyeze3

RETURNS:

  • cli: the client agent which can perform sending request
  • QuotaDetail: the quota details about a specified user
  • error: nil if success otherwise the specific error

type RecordDetail

type RecordDetail struct {
	Status     string `json:"status"`
	Url        string `json:"url"`
	Type       string `json:"type"`
	CreatedAt  string `json:"createdAt"`
	StartedAt  string `json:"startedAt"`
	FinishedAt string `json:"finishedAt"`
	Progress   int64  `json:"progress"`
	Reason     string `json:"reason"`
	Operator   string `json:"operator"`
}

RecordDetail defined a struct for one operating record

type RecordDetails

type RecordDetails struct {
	Details     []RecordDetail `json:"details"`
	IsTruncated bool           `json:"isTruncated"`
	NextMarker  string         `json:"nextMarker"`
}

RecordDetails defined a struct for multi operating records in some querying conditions

func GetCacheOpRecords

func GetCacheOpRecords(cli bce.Client, queryData *CRecordQueryData) (*RecordDetails, error)

GetCacheOpRecords get the history operating records For details, please refer https://cloud.baidu.com/doc/CDN/s/5jypnzjqt

PARAMS:

  • cli: the client agent which can perform sending request
  • queryData: querying conditions, it contains the time interval, the task type and the specified url

RETURNS:

  • *RecordDetails: the details about the records
  • error: nil if success otherwise the specific error

type RefererACL

type RefererACL struct {
	BlackList  []string `json:"blackList,omitempty"`
	WhiteList  []string `json:"whiteList,omitempty"`
	AllowEmpty bool     `json:"allowEmpty"`
}

RefererACL defined a struct for referer ACL setting

func GetRefererACL

func GetRefererACL(cli bce.Client, domain string) (*RefererACL, error)

GetRefererACL - get referer ACL setting For details, please refer https://cloud.baidu.com/doc/CDN/s/Ujzkotvtb

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *api.RefererACL: referer ACL setting
  • error: nil if success otherwise the specific error

type RequestAuth

type RequestAuth struct {
	Type      string   `json:"type"`
	Key1      string   `json:"key1"`
	Key2      string   `json:"key2,omitempty"`
	Timeout   int      `json:"timeout,omitempty"`
	WhiteList []string `json:"whiteList,omitempty"`
	SignArg   string   `json:"signArg,omitempty"`
	TimeArg   string   `json:"timeArg,omitempty"`
}

RequestAuth defined a struct for the authorization setting

type RetryOrigin added in v0.9.34

type RetryOrigin struct {
	Codes []int `json:"codes"`
}

RetryOrigin defined a struct for how to retry origin servers

func GetRetryOrigin added in v0.9.34

func GetRetryOrigin(cli bce.Client, domain string) (*RetryOrigin, error)

GetRetryOrigin - get the policy for retry origin servers For details, please refer https://cloud.baidu.com/doc/CDN/s/bkhoppbhd

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *RetryOrigin: policy of retry origin servers
  • error: nil if success otherwise the specific error

type SeoSwitch

type SeoSwitch struct {
	DirectlyOrigin string `json:"diretlyOrigin"`
	PushRecord     string `json:"pushRecord"`
}

SeoSwitch defined a struct for SEO setting

func GetDomainSeo

func GetDomainSeo(cli bce.Client, domain string) (*SeoSwitch, error)

GetDomainSeo - retrieve the setting about SEO There are two types of data that the server responds to 1. `{"seoSwitch":[]}` indicates no setting about SEO 2. `{"seoSwitch":{"diretlyOrigin":"ON","pushRecord":"OFF"}}` indicates it had normal setting about SEO So the code need to handle the complex affairs

For details, please refer https://cloud.baidu.com/doc/CDN/s/Djxzjfz8f

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *SeoSwitch: the setting about SEO
  • error: nil if success otherwise the specific error

type TimeInterval

type TimeInterval struct {
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
}

TimeInterval defined a struct contains the started time and the end time

type TopNCounter

type TopNCounter struct {
	Name string  `json:"name"`
	Pv   int64   `json:"pv"`
	Flow float64 `json:"flow"`
}

type TopNDetail

type TopNDetail struct {
	*DetailBase
	TotalPv   int64         `json:"total_pv"`
	TotalFlow float64       `json:"total_flow"`
	Counters  []TopNCounter `json:"counters"`
}

func GetTopNDomains

func GetTopNDomains(cli bce.Client, queryCondition *QueryCondition, httpCode string) ([]TopNDetail, error)

GetTopNDomains - get the top N domains that requested For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#topn-domains

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • httpCode: the specified HTTP code, like "200"

RETURNS:

  • []TopNDetail: the top N domains' detail
  • error: nil if success otherwise the specific error

func GetTopNReferers

func GetTopNReferers(cli bce.Client, queryCondition *QueryCondition, httpCode string) ([]TopNDetail, error)

GetTopNReferers - get the top N urls that brought by requested For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#topn-referers

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • httpCode: the specified HTTP code, like "200"

RETURNS:

  • []TopNDetail: the top N referer urls' detail
  • error: nil if success otherwise the specific error

func GetTopNUrls

func GetTopNUrls(cli bce.Client, queryCondition *QueryCondition, httpCode string) ([]TopNDetail, error)

GetTopNUrls - get the top N urls that requested For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#topn-urls

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions
  • httpCode: the specified HTTP code, like "200"

RETURNS:

  • []TopNDetail: the top N urls' detail
  • error: nil if success otherwise the specific error

type TrafficLimit added in v0.9.34

type TrafficLimit struct {
	Enabled          bool   `json:"enable"`
	LimitRate        int    `json:"limitRate,omitempty"`
	LimitStartHour   int    `json:"limitStartHour,omitempty"`
	LimitEndHour     int    `json:"limitEndHour,omitempty"`
	LimitRateAfter   int    `json:"limitRateAfter,omitempty"`
	TrafficLimitArg  string `json:"trafficLimitArg,omitempty"`
	TrafficLimitUnit string `json:"trafficLimitUnit,omitempty"`
}

TrafficLimit defined a struct for configure the traffic limitation

func GetTrafficLimit added in v0.9.34

func GetTrafficLimit(cli bce.Client, domain string) (*TrafficLimit, error)

GetTrafficLimit - get the traffic limitation of the specified domain For details, please refer https://cloud.baidu.com/doc/CDN/s/7k4npdru0

PARAMS:

  • cli: the client agent which can perform sending request
  • domain: the specified domain

RETURNS:

  • *TrafficLimit: config of traffic limitation
  • error: nil if success otherwise the specific error

type UaACL added in v0.9.34

type UaACL struct {
	BlackList []string `json:"blackList,omitempty"`
	WhiteList []string `json:"whiteList,omitempty"`
}

UaACL defined a struct for black UA and white UA

func GetUaACL added in v0.9.34

func GetUaACL(cli bce.Client, domain string) (*UaACL, error)

GetUaACL - get black UA or white UA For details, please refer https://cloud.baidu.com/doc/CDN/s/ak88ix19h

PARAMS:

  • cli: the client agent can execute sending request
  • domain: the specified domain

RETURNS:

  • *api.UaACL: filter config for UA
  • error: nil if success otherwise the specific error

type UvDetail

type UvDetail struct {
	*DetailBase
	Uv int64 `json:"uv"`
}

func GetUv

func GetUv(cli bce.Client, queryCondition *QueryCondition) ([]UvDetail, error)

GetUv - get the UV data For details, please refer https://cloud.baidu.com/doc/CDN/s/5jwvyf8zn#uv%E6%9F%A5%E8%AF%A2

PARAMS:

  • cli: the client agent which can perform sending request
  • queryCondition: the querying conditions

RETURNS:

  • []UvDetail: the detail list about unique visitor
  • error: nil if success otherwise the specific error

Jump to

Keyboard shortcuts

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