Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteDomain(cli bce.Client, domain string) error
- func DisableDomain(cli bce.Client, domain string) error
- func EnableDomain(cli bce.Client, domain string) error
- func GetTags(cli bce.Client, domain string) ([]model.TagModel, error)
- func ListDomains(cli bce.Client, marker string) ([]string, string, error)
- func SendCustomRequest(cli bce.Client, method string, urlPath string, ...) error
- func SetCacheFullUrl(cli bce.Client, domain string, cacheFullUrl bool) error
- func SetCacheTTL(cli bce.Client, domain string, cacheTTLs []CacheTTL) error
- func SetDomainOrigin(cli bce.Client, domain string, origins []OriginPeer) error
- func SetHTTPSConfig(cli bce.Client, domain string, httpsConfig *HTTPSConfig) error
- func SetHTTPSConfigWithOptions(cli bce.Client, domain string, enabled bool, options ...HTTPSConfigOption) error
- func SetHostToOrigin(cli bce.Client, domain string, originHost string) error
- func SetIpACL(cli bce.Client, domain string, ipACL *IpACL) error
- func SetOriginProtocol(cli bce.Client, domain, originProtocol string) error
- func SetRefererACL(cli bce.Client, domain string, refererACL *RefererACL) error
- func SetTags(cli bce.Client, domain string, tags []model.TagModel) error
- type CRecordQueryData
- type CStatusQueryData
- type CacheTTL
- type CachedDetail
- type DomainConfig
- type DomainCreatedInfo
- type DomainInfo
- type DomainStatus
- type FlowDetail
- type HTTPSConfig
- type HTTPSConfigOption
- type HitDetail
- type HttpCodeDetail
- type IpACL
- type KvCounter
- type LogBase
- type LogEntry
- type OriginPeer
- type Period
- type PrefetchDetail
- type PrefetchId
- type PrefetchStatus
- type PrefetchTask
- type PurgeTask
- type PurgedDetail
- type PurgedId
- type PurgedStatus
- type PvDetail
- type QueryStatOption
- type QuotaDetail
- type RefererACL
- type TimeInterval
Constants ¶
const ( HTTPOrigin = "http" HTTPSOrigin = "https" )
Variables ¶
var ( Period300 = createPeriod(300) Period3600 = createPeriod(3600) Period86400 = createPeriod(86400) )
The time interval of statistics data merged by, we defined 3 valid values here.
Functions ¶
func DeleteDomain ¶ added in v0.9.176
DeleteDomain - delete a specified domain from BCE CDN system For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/4kbsytf7q
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 ¶ added in v0.9.176
DisableDomain - disable a specified domain For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/gkbsyrdck
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
RETURNS:
- error: nil if success otherwise the specific error
func EnableDomain ¶ added in v0.9.176
EnableDomain - enable a specified domain For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Zkbsypv9b
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
RETURNS:
- error: nil if success otherwise the specific error
func GetTags ¶ added in v0.9.177
GetTags - get tags the ABROAD-CDN domain bind with.
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
RETURNS:
- []Tag: tags the ABROAD-CDN domain bind with
- error: nil if success otherwise the specific error
func ListDomains ¶ added in v0.9.176
ListDomains - list all domains that in ABROAD-CDN service For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/1kbsyj9m6
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 ¶
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 SetCacheFullUrl ¶
SetCacheFullUrl - set the rule to calculate the cache key, set `cacheFullUrl` to true means the whole query(the string right after the question mark in URL) will be added to the cache key. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/nkbsxko6t
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- cacheFullUrl: the query part in URL being added to the cache key or not
RETURNS:
- error: nil if success otherwise the specific error
func SetCacheTTL ¶
SetCacheTTL - add rules to cache asserts. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Zkbstm0vg
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 SetDomainOrigin ¶
func SetDomainOrigin(cli bce.Client, domain string, origins []OriginPeer) error
SetDomainOrigin - set the origin setting for the new For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Gkbstcgaa
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- origins: the origin servers
RETURNS:
- error: nil if success otherwise the specific error
func SetHTTPSConfig ¶ added in v0.9.176
func SetHTTPSConfig(cli bce.Client, domain string, httpsConfig *HTTPSConfig) error
SetHTTPSConfig - enable or disable HTTPS. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ckb0fx9ea
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- httpsConfig: HTTPS configurations.
RETURNS:
- error: nil if success otherwise the specific error
func SetHTTPSConfigWithOptions ¶ added in v0.9.176
func SetHTTPSConfigWithOptions(cli bce.Client, domain string, enabled bool, options ...HTTPSConfigOption) error
SetHTTPSConfigWithOptions - enable or disable HTTPS. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ckb0fx9ea
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- enabled: true means enable HTTPS, otherwise disable.
- options: more operations to configure HTTPS, the valid options are: 1. HTTPSConfigCertID 2. HTTPSConfigRedirectWith301 3. HTTPSConfigEnableH2
RETURNS:
- error: nil if success otherwise the specific error
func SetHostToOrigin ¶
SetHostToOrigin - Specify a default value for the HOST header for virtual sites in your origin server. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Pkbsxw8xw
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- originHost: specified HOST header for origin server
RETURNS:
- error: nil if success otherwise the specific error
func SetIpACL ¶
SetIpACL - Set an IP whitelist or blacklist to block or allow requests from specific IP addresses. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/2kbsxt693
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- ipACL: IP whitelist or blacklist
RETURNS:
- error: nil if success otherwise the specific error
func SetOriginProtocol ¶ added in v0.9.181
SetOriginProtocol - set originProtocol.
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- originProtocol: http or https.
RETURNS:
- error: nil if success otherwise the specific error
func SetRefererACL ¶
func SetRefererACL(cli bce.Client, domain string, refererACL *RefererACL) error
SetRefererACL - Set a Referer whitelist or blacklist to enable hotlink protection. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ekbsxow69
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- refererACL: referer of whitelist or blacklist
RETURNS:
- error: nil if success otherwise the specific error
Types ¶
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 ¶
CStatusQueryData defined a struct for the query conditions about the tasks' progress
type CacheTTL ¶
type CacheTTL struct { Type string `json:"type"` Value string `json:"value"` Weight int `json:"weight,omitempty"` TTL int `json:"ttl"` OverrideOrigin bool `json:"override_origin"` }
CacheTTL defined a struct for cached rules.
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 DomainConfig ¶
type DomainConfig struct { Domain string `json:"domain"` Status string `json:"status"` Cname string `json:"cname"` Origin []OriginPeer `json:"originConfig"` CacheTTL []CacheTTL `json:"cacheTtl"` CacheFullUrl bool `json:"cacheFullUrl"` OriginHost *string `json:"originHost"` RefererACL *RefererACL `json:"refererACL"` IpACL *IpACL `json:"ipACL"` HTTPSConfig *HTTPSConfig `json:"https"` OriginProtocol string `json:"originProtocol"` Tags []model.TagModel `json:"tags"` }
DomainConfig defined a struct for total configurations.
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-ABROAD/s/9kbsye6k8
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 ¶ added in v0.9.176
DomainCreatedInfo defined a struct for `CreateDomain` return
func CreateDomain ¶ added in v0.9.176
func CreateDomain(cli bce.Client, domain string, originConfig []OriginPeer, tags []model.TagModel) (*DomainCreatedInfo, error)
CreateDomain - add a specified domain into ABROAD-CDN service For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ekbsyn5o5
PARAMS:
- cli: the client agent which can perform sending request
- domain: the specified domain
- originInit: initialized data for a ABROAD-CDN domain
- tags: bind with the specified tags
RETURNS:
- *DomainCreatedInfo: the details about created a ABROAD-CDN domain
- error: nil if success otherwise the specific error
type DomainInfo ¶ added in v0.9.195
DomainInfo defined a struct for domain information
func ListDomainInfos ¶ added in v0.9.195
ListDomainInfos - list all domains that in ABROAD-CDN service For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/1kbsyj9m6
PARAMS:
- cli: the client agent which can perform sending request
- marker: a marker is a start point of searching
RETURNS:
- []DomainInfo: 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
type DomainStatus ¶ added in v0.9.176
DomainStatus defined a struct for domain info, the status only include "RUNNING", "OPERATING" and "STOPPED", the other status is undefined
type FlowDetail ¶
type FlowDetail struct { Timestamp string `json:"timestamp"` Flow int64 `json:"flow"` Bps int64 `json:"bps"` Key string `json:"key"` }
FlowDetail hold details of statistics of traffic.
func GetFlow ¶
func GetFlow(cli bce.Client, options ...QueryStatOption) ([]FlowDetail, error)
GetFlow - get the statistics of traffic(flow). For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Bkbszintg
PARAMS:
- cli: the client agent which can perform sending request
- options: the querying conditions, valid options are: 1. QueryStatByTimeRange 2. QueryStatByPeriod 3. QueryStatByDomains 4. QueryStatByCountry
RETURNS:
- []FlowDetail: the details about traffic
- error: nil if success otherwise the specific error
func GetSrcFlow ¶
func GetSrcFlow(cli bce.Client, options ...QueryStatOption) ([]FlowDetail, error)
GetSrcFlow - get the statistics of traffic(flow) to your origin server. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/rkbsznt4v
PARAMS:
- cli: the client agent which can perform sending request
- options: the querying conditions, valid options are: 1. QueryStatByTimeRange 2. QueryStatByPeriod 3. QueryStatByDomains
RETURNS:
- []FlowDetail: the details about traffic to your origin server.
- error: nil if success otherwise the specific error
type HTTPSConfig ¶ added in v0.9.176
type HTTPSConfigOption ¶ added in v0.9.176
type HTTPSConfigOption func(interface{})
HTTPSConfigOption defined a method for setting optional configurations for HTTPS config.
func HTTPSConfigCertID ¶ added in v0.9.176
func HTTPSConfigCertID(certId string) HTTPSConfigOption
HTTPSConfigCertID defined a method to pass certId witch represents a certificate uploaded in BCE SSL platform: https://console.bce.baidu.com/cas/#/cas/purchased/common/list. This Option works while the HTTPS in enabled state.
func HTTPSConfigEnableH2 ¶ added in v0.9.176
func HTTPSConfigEnableH2() HTTPSConfigOption
HTTPSConfigEnableH2 defined a method to enable HTTP2 in CDN Edge server. This Option works while the HTTPS in enabled state.
func HTTPSConfigRedirectWith301 ¶ added in v0.9.176
func HTTPSConfigRedirectWith301() HTTPSConfigOption
HTTPSConfigRedirectWith301 defined a method to enable the CDN PoPs to redirect the requests in HTTP protocol to the HTTPS ones, with the status 301. e.g. Assume that you have a CDN domain cdn.baidu.com, configured HTTPSConfigRedirectWith301, while the request comes just like "http://cdn.baidu.com/1.txt", the CDN Edge server would respond 301 page with Location header https://cdn.baidu.com/1.txt which change the scheme from "http" to "https". This Option works while the HTTPS in enabled state.
type HitDetail ¶
type HitDetail struct { Timestamp string `json:"timestamp"` HitRate float64 `json:"hitrate"` Key string `json:"key"` }
HitDetail defined a struct for hitting ratio of Edge accessing.
func GetRealHit ¶
func GetRealHit(cli bce.Client, options ...QueryStatOption) ([]HitDetail, error)
GetRealHit - get the statistics of hit rate of accessing by traffic. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ckbszuehh
PARAMS:
- cli: the client agent which can perform sending request
- options: the querying conditions, valid options are: 1. QueryStatByTimeRange 2. QueryStatByPeriod 3. QueryStatByDomains
RETURNS:
- []HitDetail: the details about traffic hit rate.
- error: nil if success otherwise the specific error
type HttpCodeDetail ¶
type HttpCodeDetail struct { Timestamp string `json:"timestamp"` Counters []KvCounter `json:"counters"` Key string `json:"key"` }
HttpCodeDetail hold details of statistics of accessing HTTP codes.
func GetHttpCode ¶
func GetHttpCode(cli bce.Client, options ...QueryStatOption) ([]HttpCodeDetail, error)
GetHttpCode - get the statistics of accessing HTTP codes. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ekbszvxv5
PARAMS:
- cli: the client agent which can perform sending request
- options: the querying conditions, valid options are: 1. QueryStatByTimeRange 2. QueryStatByPeriod 3. QueryStatByDomains
RETURNS:
- []HttpCodeDetail: the details about accessing HTTP codes.
- error: nil if success otherwise the specific error
type LogEntry ¶
type LogEntry struct { *LogBase *TimeInterval }
LogEntry defined a struct for log information
func GetDomainLog ¶
GetDomainLog -get one domain's log urls For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/mjwvxj0ec
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
type OriginPeer ¶
type OriginPeer struct { Type string `json:"type"` Addr string `json:"addr"` Backup bool `json:"backup"` }
OriginPeer defined a struct for Origin server.
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-ABROAD/s/Dlj5ch09q
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-ABROAD/s/Mlj5e9y0i
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"`
}
PrefetchTask defined a struct for prefetch 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 ¶
Purge - tells the CDN system to purge the specified files For more details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Zkbsy0k8j
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-ABROAD/s/ikbsy9cvb
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 { Timestamp string `json:"timestamp"` Pv int64 `json:"pv"` Qps int64 `json:"qps"` Key string `json:"key"` }
PvDetail hold details of statistics of pv/qps.
func GetPv ¶
func GetPv(cli bce.Client, options ...QueryStatOption) ([]PvDetail, error)
GetPv - get the statistics of pv/qps. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/dkbszg48s
PARAMS:
- cli: the client agent which can perform sending request
- options: the querying conditions, valid options are: 1. QueryStatByTimeRange 2. QueryStatByPeriod 3. QueryStatByDomains 4. QueryStatByCountry
RETURNS:
- []PvDetail: the details about pv/qps
- error: nil if success otherwise the specific error
type QueryStatOption ¶
type QueryStatOption func(interface{})
QueryStatOption defined a method for setting optional configurations for query statistics.
func QueryStatByCountry ¶
func QueryStatByCountry(country string) QueryStatOption
QueryStatByCountry the specific Country you want to know about. The country value is one of the GEC codes. More details about GEC, you can read this article: https://baike.baidu.com/item/%E4%B8%96%E7%95%8C%E5%90%84%E5%9B%BD%E5%92%8C%E5%9C%B0%E5%8C%BA%E5%90%8D%E7%A7%B0%E4%BB%A3%E7%A0%81/6560023 and pay attention of the column of the key world "两字母代码".
func QueryStatByDomains ¶
func QueryStatByDomains(domains []string) QueryStatOption
QueryStatByDomains defined a method to pass the CDN domains you are interested in.
func QueryStatByPeriod ¶
func QueryStatByPeriod(period Period) QueryStatOption
QueryStatByPeriod the time interval of statistics data merged by, valid values are 300, 3600 and 86400 represents by Period300, Period3060 and Period86400 respectively
func QueryStatByTimeRange ¶
func QueryStatByTimeRange(startTime, endTime string) QueryStatOption
QueryStatByTimeRange the beginning and the end of the time range to query, The time values are in the ISO 8601 standard with the yyyy-MM-ddTHH:mm:ssZ format, e.g. 2024-04-15T00:00:00Z.
type QuotaDetail ¶
type QuotaDetail struct { UrlPurgeQuota int64 `json:"urlPurgeQuota"` UrlPurgeRemain int64 `json:"urlPurgeRemain"` DirPurgeQuota int64 `json:"dirPurgeQuota"` DirPurgeRemain int64 `json:"dirPurgeRemain"` PrefetchQuota int64 `json:"prefetchQuota"` PrefetchRemain int64 `json:"prefetchRemain"` }
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-ABROAD/s/flnoakciq
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 RefererACL ¶
type RefererACL struct { BlackList []string `json:"blackList"` WhiteList []string `json:"whiteList"` AllowEmpty bool `json:"allowEmpty"` }
RefererACL defined a struct for Referer whitelist or blacklist to enable hotlink protection.
type TimeInterval ¶
TimeInterval defined a struct contains the started time and the end time