Documentation
¶
Index ¶
- func SendCustomRequest(cli bce.Client, method string, urlPath string, ...) error
- type AntiHotLink
- type CacheCodeTtl
- type CacheKey
- type CacheTtl
- type ErrorPage
- type HSTS
- type HTTP3
- type HttpHeader
- type LogEntry
- type LogQueryData
- type LogQueryResult
- type OriginArg
- type OriginOptions
- type OriginRedirectOptions
- type OriginTimeout
- type PageRule
- type PrefetchId
- type PrefetchRecord
- type PrefetchRecords
- type PrefetchStatusQueryData
- type PrefetchTask
- type PurgeRecord
- type PurgeRecords
- type PurgeStatusQueryData
- type PurgeTask
- type PurgedId
- type RealIp
- type RefreshRevalidate
- type Rule
- type RuleCacheKey
- type RuleConfig
- type SiteConfig
- type SiteConfigUpdateResult
- type StatDataPoint
- type StatFilterItem
- type StatLimit
- type StatPeakQueryData
- type StatResult
- func GetStatPeak(cli bce.Client, queryData *StatPeakQueryData) (StatResult, error)
- func GetStatSumByGroup(cli bce.Client, queryData *StatSumByGroupQueryData) (StatResult, error)
- func GetStatTime(cli bce.Client, queryData *StatTimeQueryData) (StatResult, error)
- func GetStatTimeByGroup(cli bce.Client, queryData *StatTimeByGroupQueryData) (StatResult, error)
- func GetStatTopByGroup(cli bce.Client, queryData *StatTopByGroupQueryData) (StatResult, error)
- type StatSumByGroupQueryData
- type StatTimeByGroupQueryData
- type StatTimeQueryData
- type StatTopByGroupQueryData
- type TrafficLimit
- type UrlRules
- type WebSocket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
Types ¶
type AntiHotLink ¶ added in v0.9.271
type AntiHotLink struct {
AntiType *string `json:"antiType,omitempty"`
SecretKey *string `json:"secretKey,omitempty"`
NewsecretKey *string `json:"newsecretKey,omitempty"`
Timeout *int `json:"timeout,omitempty"`
TimestampFormat *string `json:"timestampFormat,omitempty"`
AuthArg *string `json:"authArg,omitempty"`
}
AntiHotLink defined the anti-hot-link strategy in rule scope.
type CacheCodeTtl ¶ added in v0.9.271
type CacheCodeTtl struct {
Value string `json:"value"`
Weight int `json:"weight"`
OverrideOrigin bool `json:"overrideOrigin"`
Ttl int `json:"ttl"`
Type string `json:"type"`
}
CacheCodeTtl defined status-code cache rule for a site.
type CacheKey ¶ added in v0.9.270
type CacheKey struct {
Query *bool `json:"query,omitempty"`
IncludeArgs *[]string `json:"include_args,omitempty"`
ExcludeArgs *[]string `json:"exclude_args,omitempty"`
}
CacheKey defined the query string strategy for cache key.
type CacheTtl ¶ added in v0.9.270
type CacheTtl struct {
Value string `json:"value"`
Weight int `json:"weight"`
OverrideOrigin bool `json:"override_origin"`
Ttl int `json:"ttl"`
Type string `json:"type"`
}
CacheTtl defined cache rule for a site
type ErrorPage ¶ added in v0.9.271
ErrorPage defined a single custom error-page entry in rule scope.
type HSTS ¶ added in v0.9.270
type HSTS struct {
MaxAge *int `json:"maxAge,omitempty"`
IncludeSubDomains *bool `json:"includeSubDomains,omitempty"`
Preload *bool `json:"preload,omitempty"`
}
HSTS defined the HSTS strategy for a site.
type HTTP3 ¶ added in v0.9.270
type HTTP3 struct {
Enable *bool `json:"enable,omitempty"`
}
HTTP3 defined the HTTP3 strategy for a site.
type HttpHeader ¶ added in v0.9.270
type HttpHeader struct {
Type string `json:"type"`
Header string `json:"header"`
Value string `json:"value"`
Action string `json:"action"`
}
HttpHeader defined HTTP header rule.
type LogEntry ¶
type LogEntry struct {
Domain string `json:"domain"`
Url string `json:"url"`
Name string `json:"name"`
Size int64 `json:"size"`
LogTimeBegin string `json:"logTimeBegin"`
LogTimeEnd string `json:"logTimeEnd"`
}
LogEntry defined a struct for one offline log file information
type LogQueryData ¶
type LogQueryData struct {
Site string `json:"site"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
DomainList []string `json:"domainList,omitempty"`
PageNo int `json:"pageNo,omitempty"`
PageSize int `json:"pageSize,omitempty"`
}
LogQueryData defined a struct for offline log query conditions, used as request body
type LogQueryResult ¶
type LogQueryResult struct {
LogEntryList []LogEntry `json:"logEntryList"`
TotalCount string `json:"totalCount"`
}
LogQueryResult defined a struct for the offline log query result
func GetOfflineLog ¶
func GetOfflineLog(cli bce.Client, queryData *LogQueryData) (*LogQueryResult, error)
GetOfflineLog - get the offline log download urls of one or multi domains under a site For details, please refer https://cloud.baidu.com/doc/GEO/s/hmmljdegd
PARAMS:
- cli: the client agent which can perform sending request
- queryData: the querying conditions
RETURNS:
- *LogQueryResult: the offline log entries and total count
- error: nil if success otherwise the specific error
type OriginArg ¶ added in v0.9.271
type OriginArg struct {
Ignore *string `json:"ignore,omitempty"`
Args *[]string `json:"args,omitempty"`
}
OriginArg defined the origin-args strategy in rule scope.
type OriginOptions ¶ added in v0.9.271
type OriginOptions struct {
Range *string `json:"range,omitempty"`
PartSize *int `json:"partSize,omitempty"`
}
OriginOptions defined origin range/part-size strategy in rule scope.
type OriginRedirectOptions ¶ added in v0.9.271
type OriginRedirectOptions struct {
EnableRedirectFollow *string `json:"enableRedirectFollow,omitempty"`
MaxRedirectFollowCount *int `json:"maxRedirectFollowCount,omitempty"`
}
OriginRedirectOptions defined the origin redirect strategy in rule scope.
type OriginTimeout ¶ added in v0.9.271
type OriginTimeout struct {
LoadTimeout *int `json:"loadTimeout,omitempty"`
ConnectTimeout *int `json:"connectTimeout,omitempty"`
}
OriginTimeout defined the origin timeout strategy in rule scope.
type PageRule ¶ added in v0.9.271
type PageRule struct {
Name string `json:"name"`
Status string `json:"status"`
Rules [][]Rule `json:"rules"`
Config *RuleConfig `json:"config,omitempty"`
}
PageRule defined a rule-engine entry of a site.
type PrefetchId ¶
type PrefetchId string
func Prefetch ¶
func Prefetch(cli bce.Client, site string, tasks []PrefetchTask) (PrefetchId, error)
Prefetch - tells the EO system to prefetch the specified files For details, please refer https://cloud.baidu.com/doc/GEO/s/5mhsuituv
PARAMS:
- cli: the client agent which can perform sending request
- site: the site that the prefetch tasks belong to
- tasks: the tasks about prefetch the files from the EO nodes
RETURNS:
- PrefetchId: an ID representing a prefetch task, using it to search the task progress
- error: nil if success otherwise the specific error
type PrefetchRecord ¶
type PrefetchRecord struct {
Status string `json:"status"`
Task PrefetchTask `json:"task"`
CreatedAt string `json:"createdAt"`
StartedAt string `json:"startedAt,omitempty"`
FinishedAt string `json:"finishedAt,omitempty"`
Progress int64 `json:"progress"`
Operator string `json:"operator"`
Reason string `json:"reason,omitempty"`
Id string `json:"id"`
}
PrefetchRecord defined a struct for prefetch task information
type PrefetchRecords ¶
type PrefetchRecords struct {
Details []PrefetchRecord `json:"details"`
IsTruncated bool `json:"isTruncated"`
NextMarker string `json:"nextMarker,omitempty"`
}
PrefetchRecords defined a struct for multi operating prefetch task records
func GetPrefetchStatus ¶
func GetPrefetchStatus(cli bce.Client, queryData *PrefetchStatusQueryData) (*PrefetchRecords, error)
GetPrefetchStatus - get the prefetch progress For details, please refer https://cloud.baidu.com/doc/GEO/s/Bmhsv5i9u
PARAMS:
- cli: the client agent which can perform sending request
- queryData: querying conditions, it contains the site, the time interval, the task ID and the marker
RETURNS:
- *PrefetchRecords: the details about the prefetch
- error: nil if success otherwise the specific error
type PrefetchStatusQueryData ¶
type PrefetchStatusQueryData struct {
Site string
Id string
StartTime string
EndTime string
Marker string
}
PrefetchStatusQueryData defined a struct for the query conditions about the prefetch tasks' progress
type PrefetchTask ¶
type PrefetchTask struct {
Url string `json:"url"`
}
PrefetchTask defined a struct for prefetch task
type PurgeRecord ¶
type PurgeRecord struct {
Status string `json:"status"`
Task PurgeTask `json:"task"`
CreatedAt string `json:"createdAt"`
FinishedAt string `json:"finishedAt,omitempty"`
Progress int64 `json:"progress"`
Operator string `json:"operator"`
}
PurgeRecord defined a struct for purged task information
type PurgeRecords ¶
type PurgeRecords struct {
Details []PurgeRecord `json:"details"`
IsTruncated bool `json:"isTruncated"`
NextMarker string `json:"nextMarker,omitempty"`
}
PurgeRecords defined a struct for multi operating purged task records
func GetPurgedStatus ¶
func GetPurgedStatus(cli bce.Client, queryData *PurgeStatusQueryData) (*PurgeRecords, error)
GetPurgedStatus - get the purged progress For details, please refer https://cloud.baidu.com/doc/GEO/s/mmhssw91q
PARAMS:
- cli: the client agent which can perform sending request
- queryData: querying conditions, it contains the site, the time interval, the task ID, the type and the marker
RETURNS:
- *PurgeRecords: the details about the purged
- error: nil if success otherwise the specific error
type PurgeStatusQueryData ¶
type PurgeStatusQueryData struct {
Site string
Id string
StartTime string
EndTime string
Type string
Marker string
}
PurgeStatusQueryData defined a struct for the query conditions about the purge tasks' progress
type PurgedId ¶
type PurgedId string
func Purge ¶
Purge - tells the EO system to purge the specified files For details, please refer https://cloud.baidu.com/doc/GEO/s/4mhsrv9ry
PARAMS:
- cli: the client agent which can perform sending request
- site: the site that the purge tasks belong to
- tasks: the tasks about purging the files from the EO 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 RealIp ¶ added in v0.9.271
type RealIp struct {
Enabled *string `json:"enabled,omitempty"`
Name *string `json:"name,omitempty"`
}
RealIp defined the real-IP strategy in rule scope.
type RefreshRevalidate ¶ added in v0.9.271
type RefreshRevalidate struct {
Enabled *string `json:"enabled,omitempty"`
}
RefreshRevalidate defined the refresh-revalidate strategy in rule scope.
type Rule ¶ added in v0.9.271
type Rule struct {
MatchFrom string `json:"matchFrom"`
Operator string `json:"operator"`
MatchKey string `json:"matchKey,omitempty"`
Values []string `json:"values"`
IgnoreCase *bool `json:"ignoreCase,omitempty"`
}
Rule defined a single match condition inside PageRule.Rules. Outer slice means OR; inner slice means AND.
type RuleCacheKey ¶ added in v0.9.271
type RuleCacheKey struct {
Query *bool `json:"query,omitempty"`
IncludeArgs *[]string `json:"include_args,omitempty"`
ExcludeArgs *[]string `json:"exclude_args,omitempty"`
IgnoreCase *bool `json:"ignore_case,omitempty"`
}
RuleCacheKey defined the query string strategy for cache key in rule scope. It has an extra `ignore_case` field compared to the site-scope CacheKey.
type RuleConfig ¶ added in v0.9.271
type RuleConfig struct {
CacheTtl *[]CacheTtl `json:"cacheTtl,omitempty"`
CacheKey *RuleCacheKey `json:"cacheKey,omitempty"`
OfflineMode *string `json:"offlineMode,omitempty"`
RefreshRevalidate *RefreshRevalidate `json:"refreshRevalidate,omitempty"`
HttpToHttpsEnabled *string `json:"httpToHttpsEnabled,omitempty"`
HttpToHttpsCode *string `json:"httpToHttpsCode,omitempty"`
Hsts *HSTS `json:"hsts,omitempty"`
Isa *string `json:"isa,omitempty"`
Http2Disable *string `json:"http2Disable,omitempty"`
Http3 *HTTP3 `json:"http3,omitempty"`
WebSocket *WebSocket `json:"webSocket,omitempty"`
Http2Origin *string `json:"http2Origin,omitempty"`
ClientMaxBodySize *string `json:"clientMaxBodySize,omitempty"`
Compress *string `json:"compress,omitempty"`
CompressMethodArray *[]string `json:"compressMethodArray,omitempty"`
HttpHeader *[]HttpHeader `json:"httpHeader,omitempty"`
OriginTimeout *OriginTimeout `json:"originTimeout,omitempty"`
OriginRedirectOptions *OriginRedirectOptions `json:"originRedirectOptions,omitempty"`
OriginOptions *OriginOptions `json:"originOptions,omitempty"`
RealIp *RealIp `json:"realIp,omitempty"`
ErrorPage *[]ErrorPage `json:"errorPage,omitempty"`
TrafficLimit *TrafficLimit `json:"trafficLimit,omitempty"`
AntiHotLink *AntiHotLink `json:"antiHotLink,omitempty"`
OriginArg *OriginArg `json:"originArg,omitempty"`
UrlRules *[]UrlRules `json:"urlRules,omitempty"`
}
RuleConfig defined the per-rule configurations that can be applied when a PageRule matches.
type SiteConfig ¶ added in v0.9.270
type SiteConfig struct {
CacheTtl *[]CacheTtl `json:"cacheTtl,omitempty"`
CacheKey *CacheKey `json:"cacheKey,omitempty"`
OfflineMode *string `json:"offlineMode,omitempty"`
HttpToHttpsEnabled *string `json:"httpToHttpsEnabled,omitempty"`
HttpToHttpsCode *string `json:"httpToHttpsCode,omitempty"`
Hsts *HSTS `json:"hsts,omitempty"`
Http2Disable *string `json:"http2Disable,omitempty"`
Http3 *HTTP3 `json:"http3,omitempty"`
ClientMaxBodySize *string `json:"clientMaxBodySize,omitempty"`
Compress *string `json:"compress,omitempty"`
CompressMethodArray *[]string `json:"compressMethodArray,omitempty"`
Isa *string `json:"isa,omitempty"`
HttpHeader *[]HttpHeader `json:"httpHeader,omitempty"`
CacheCodeTtl *[]CacheCodeTtl `json:"cacheCodeTtl,omitempty"`
GrpcOrigin *string `json:"grpcOrigin,omitempty"`
Http2Origin *string `json:"http2Origin,omitempty"`
PageRules *[]PageRule `json:"pageRules,omitempty"`
}
SiteConfig defined a unified container for site configurations. All fields use pointer types so that callers can distinguish "not set" (nil, will be omitted) from "explicitly set to empty" (non-nil empty value, will be sent as `[]` / `{}`). New configuration items should also be added as pointer fields with `omitempty`.
func GetSiteConfig ¶ added in v0.9.270
func GetSiteConfig(cli bce.Client, site string) (*SiteConfig, error)
GetSiteConfig - get the site configurations
PARAMS:
- cli: the client agent which can perform sending request
- site: the site to be queried
RETURNS:
- *SiteConfig: the configurations of the site
- error: nil if success otherwise the specific error
type SiteConfigUpdateResult ¶ added in v0.9.270
type SiteConfigUpdateResult struct {
Status string `json:"status"`
}
SiteConfigUpdateResult defined the response of SetSiteConfig
func SetSiteConfig ¶ added in v0.9.270
func SetSiteConfig(cli bce.Client, site string, config *SiteConfig) (*SiteConfigUpdateResult, error)
SetSiteConfig - set the site-level configurations For details, please refer to https://cloud.baidu.com/doc/GEO/s/vmiia4s0j
PARAMS:
- cli: the client agent which can perform sending request
- site: the site to be configured
- config: the configurations to be set;
RETURNS:
- *SiteConfigUpdateResult: the update status returned by the server
- error: nil if success otherwise the specific error
type StatDataPoint ¶
type StatDataPoint struct {
Timestamp *int64 `json:"timestamp"`
Value json.Number `json:"value"`
GroupParams json.RawMessage `json:"groupParams"`
}
StatDataPoint defined a struct for one metric data point
- Timestamp: Int per the API doc, but the server returns null when ShowType is peak/sum/top, so use *int64
- Value: the server may return either a number (e.g. 306) or a string, so use json.Number for transparent decoding; callers can convert via Value.Int64() / Value.Float64() / Value.String() as needed
- GroupParams: List<GroupParams> per the API doc; the server returns an empty array `[]` when no group is set, and an object like `{"code":"2xx"}` when group is set, so use json.RawMessage for transparent decoding, and call GroupParamsMap() to extract the group key-value pairs
func (StatDataPoint) GroupParamsMap ¶
func (p StatDataPoint) GroupParamsMap() (map[string]string, error)
GroupParamsMap parses GroupParams into a map of group key to value. When GroupParams is empty or an empty array, returns an empty map.
type StatFilterItem ¶
type StatFilterItem struct {
Key string `json:"key"` // "site" | "host"
Value []string `json:"value"` // values for the key
Operation string `json:"operation"` // "equal" | "notequal"
}
StatFilterItem defined a filter condition for stat query
type StatLimit ¶
type StatLimit struct {
PageSize int `json:"pageSize"`
}
StatLimit defined a limit option for top queries
type StatPeakQueryData ¶
type StatPeakQueryData struct {
Metric []string `json:"metrics"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
Filter []StatFilterItem `json:"filter,omitempty"`
}
StatPeakQueryData - request body for type 2: no group, showType=peak
type StatResult ¶
type StatResult map[string][]StatDataPoint
StatResult defined the response of stat query, the key is metric name (e.g. "sum_bps", "pv")
func GetStatPeak ¶
func GetStatPeak(cli bce.Client, queryData *StatPeakQueryData) (StatResult, error)
GetStatPeak - type 2: no group, showType=peak
PARAMS:
- cli: the client agent which can perform sending request
- queryData: the querying conditions, `Metric` is required
RETURNS:
- StatResult: a map keyed by metric name, value is the data point list
- error: nil if success otherwise the specific error
func GetStatSumByGroup ¶
func GetStatSumByGroup(cli bce.Client, queryData *StatSumByGroupQueryData) (StatResult, error)
GetStatSumByGroup - type 4: showType=sum, group required
PARAMS:
- cli: the client agent which can perform sending request
- queryData: the querying conditions, `Metric` and `Group` are required
RETURNS:
- StatResult: a map keyed by metric name, value is the data point list
- error: nil if success otherwise the specific error
func GetStatTime ¶
func GetStatTime(cli bce.Client, queryData *StatTimeQueryData) (StatResult, error)
GetStatTime - type 1: no group, showType=time
PARAMS:
- cli: the client agent which can perform sending request
- queryData: the querying conditions, `Metric` is required
RETURNS:
- StatResult: a map keyed by metric name, value is the data point list
- error: nil if success otherwise the specific error
func GetStatTimeByGroup ¶
func GetStatTimeByGroup(cli bce.Client, queryData *StatTimeByGroupQueryData) (StatResult, error)
GetStatTimeByGroup - type 3: showType=time, group required
PARAMS:
- cli: the client agent which can perform sending request
- queryData: the querying conditions, `Metric` and `Group` are required
RETURNS:
- StatResult: a map keyed by metric name, value is the data point list
- error: nil if success otherwise the specific error
func GetStatTopByGroup ¶
func GetStatTopByGroup(cli bce.Client, queryData *StatTopByGroupQueryData) (StatResult, error)
GetStatTopByGroup - type 5: showType=top, group required Note: only `sum_flow`, `upstream_flow`, `download_flow`, `pv` metrics are supported by the server for top queries.
PARAMS:
- cli: the client agent which can perform sending request
- queryData: the querying conditions, `Metric` and `Group` are required
RETURNS:
- StatResult: a map keyed by metric name, value is the data point list
- error: nil if success otherwise the specific error
type StatSumByGroupQueryData ¶
type StatSumByGroupQueryData struct {
Metric []string `json:"metrics"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
Filter []StatFilterItem `json:"filter,omitempty"`
Group []string `json:"group"` // required
}
StatSumByGroupQueryData - request body for type 4: showType=sum, group required
type StatTimeByGroupQueryData ¶
type StatTimeByGroupQueryData struct {
Metric []string `json:"metrics"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
Filter []StatFilterItem `json:"filter,omitempty"`
Group []string `json:"group"` // required
}
StatTimeByGroupQueryData - request body for type 3: showType=time, group required
type StatTimeQueryData ¶
type StatTimeQueryData struct {
Metric []string `json:"metrics"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
Filter []StatFilterItem `json:"filter,omitempty"`
}
StatTimeQueryData - request body for type 1: no group, showType=time
type StatTopByGroupQueryData ¶
type StatTopByGroupQueryData struct {
Metric []string `json:"metrics"`
StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"`
Filter []StatFilterItem `json:"filter,omitempty"`
Group []string `json:"group"` // required
Limit *StatLimit `json:"limit,omitempty"` // optional, top result count limit
}
StatTopByGroupQueryData - request body for type 5: showType=top, group required
type TrafficLimit ¶ added in v0.9.271
type TrafficLimit struct {
Enable *string `json:"enable,omitempty"`
LimitRate *int `json:"limitRate,omitempty"`
LimitStartHour *int `json:"limitStartHour,omitempty"`
LimitEndHour *int `json:"limitEndHour,omitempty"`
LimitRateUnit *string `json:"limitRateUnit,omitempty"`
}
TrafficLimit defined the traffic-limit strategy in rule scope.
type UrlRules ¶ added in v0.9.271
type UrlRules struct {
Scheme *string `json:"scheme,omitempty"`
Host *string `json:"host,omitempty"`
SrcPath *string `json:"srcPath,omitempty"`
DstPath *string `json:"dstPath,omitempty"`
Query *string `json:"query,omitempty"`
Status *string `json:"status,omitempty"`
}
UrlRules defined a single URL-rewrite/redirect rule in rule scope.