Documentation ¶
Overview ¶
cdn 包提供了 Fusion CDN的常见功能。相关功能的文档参考:https://developer.qiniu.com/fusion。 目前提供了文件和目录刷新,文件预取,获取域名带宽和流量数据,获取域名日志列表等功能。
Index ¶
- Variables
- func CreateTimestampAntileechURL(urlStr string, encryptKey string, durationInSeconds int64) (antileechURL string, err error)
- type CdnManager
- func (m *CdnManager) GetBandwidthData(startDate, endDate, granularity string, domainList []string) (bandwidthData TrafficResp, err error)
- func (m *CdnManager) GetCdnLogList(day string, domains []string) (listLogResult ListLogResult, err error)
- func (m *CdnManager) GetFluxData(startDate, endDate, granularity string, domainList []string) (fluxData TrafficResp, err error)
- func (m *CdnManager) PrefetchUrls(urls []string) (result PrefetchResp, err error)
- func (m *CdnManager) RefreshDirs(dirs []string) (result RefreshResp, err error)
- func (m *CdnManager) RefreshUrls(urls []string) (result RefreshResp, err error)
- func (m *CdnManager) RefreshUrlsAndDirs(urls, dirs []string) (result RefreshResp, err error)
- type ListLogRequest
- type ListLogResult
- type LogDomainInfo
- type PrefetchReq
- type PrefetchResp
- type RefreshReq
- type RefreshResp
- type TrafficData
- type TrafficReq
- type TrafficResp
Constants ¶
This section is empty.
Variables ¶
var (
FusionHost = "http://fusion.qiniuapi.com"
)
Fusion CDN服务域名
Functions ¶
Types ¶
type CdnManager ¶
type CdnManager struct {
// contains filtered or unexported fields
}
CdnManager 提供了文件和目录刷新,文件预取,获取域名带宽和流量数据,获取域名日志列表等功能
func NewCdnManager ¶
func NewCdnManager(mac *auth.Credentials) *CdnManager
NewCdnManager 用来构建一个新的 CdnManager
func (*CdnManager) GetBandwidthData ¶
func (m *CdnManager) GetBandwidthData(startDate, endDate, granularity string, domainList []string) (bandwidthData TrafficResp, err error)
GetBandwidthData 方法用来获取域名访问带宽数据
StartDate string 必须 开始日期,例如:2016-07-01 EndDate string 必须 结束日期,例如:2016-07-03 Granularity string 必须 粒度,取值:5min / hour /day Domains []string 必须 域名列表
func (*CdnManager) GetCdnLogList ¶
func (m *CdnManager) GetCdnLogList(day string, domains []string) ( listLogResult ListLogResult, err error)
GetCdnLogList 获取CDN域名访问日志的下载链接
func (*CdnManager) GetFluxData ¶
func (m *CdnManager) GetFluxData(startDate, endDate, granularity string, domainList []string) (fluxData TrafficResp, err error)
GetFluxData 方法用来获取域名访问流量数据
StartDate string 必须 开始日期,例如:2016-07-01 EndDate string 必须 结束日期,例如:2016-07-03 Granularity string 必须 粒度,取值:5min / hour /day Domains []string 必须 域名列表
func (*CdnManager) PrefetchUrls ¶
func (m *CdnManager) PrefetchUrls(urls []string) (result PrefetchResp, err error)
PrefetchUrls 预取文件链接,每次最多不可以超过100条
func (*CdnManager) RefreshDirs ¶
func (m *CdnManager) RefreshDirs(dirs []string) (result RefreshResp, err error)
RefreshDirs 刷新目录
func (*CdnManager) RefreshUrls ¶
func (m *CdnManager) RefreshUrls(urls []string) (result RefreshResp, err error)
RefreshUrls 刷新文件
func (*CdnManager) RefreshUrlsAndDirs ¶
func (m *CdnManager) RefreshUrlsAndDirs(urls, dirs []string) (result RefreshResp, err error)
RefreshUrlsAndDirs 方法用来刷新文件或目录 urls 要刷新的单个url列表,单次方法调用总数不超过100条;单个url,即一个具体的url, 例如:http://bar.foo.com/index.html dirs 要刷新的目录url列表,单次方法调用总数不超过10条;目录dir,即表示一个目录级的url, 例如:http://bar.foo.com/dir/,
type ListLogRequest ¶
ListLogRequest 日志下载请求内容
type ListLogResult ¶
type ListLogResult struct { Code int `json:"code"` Error string `json:"error"` Data map[string][]LogDomainInfo `json:"data"` }
ListLogResult 日志下载相应内容
type LogDomainInfo ¶
type LogDomainInfo struct { Name string `json:"name"` Size int64 `json:"size"` ModifiedTime int64 `json:"mtime"` URL string `json:"url"` }
LogDomainInfo 日志下载信息
type PrefetchResp ¶
type PrefetchResp struct { Code int `json:"code"` Error string `json:"error"` RequestID string `json:"requestId,omitempty"` InvalidUrls []string `json:"invalidUrls,omitempty"` QuotaDay int `json:"quotaDay,omitempty"` SurplusDay int `json:"surplusDay,omitempty"` }
PrefetchResp 文件预取响应内容
type RefreshReq ¶
RefreshReq 为缓存刷新请求内容
type RefreshResp ¶
type RefreshResp struct { Code int `json:"code"` Error string `json:"error"` RequestID string `json:"requestId,omitempty"` InvalidUrls []string `json:"invalidUrls,omitempty"` InvalidDirs []string `json:"invalidDirs,omitempty"` URLQuotaDay int `json:"urlQuotaDay,omitempty"` URLSurplusDay int `json:"urlSurplusDay,omitempty"` DirQuotaDay int `json:"dirQuotaDay,omitempty"` DirSurplusDay int `json:"dirSurplusDay,omitempty"` }
RefreshResp 缓存刷新响应内容
type TrafficData ¶
TrafficData 为带宽/流量数据
type TrafficReq ¶
type TrafficReq struct { StartDate string `json:"startDate"` EndDate string `json:"endDate"` Granularity string `json:"granularity"` Domains string `json:"domains"` }
TrafficReq 为批量查询带宽/流量的API请求内容
StartDate 开始日期,格式例如:2016-07-01 EndDate 结束日期,格式例如:2016-07-03 Granularity 取值粒度,取值可选值:5min/hour/day Domains 域名列表,彼此用 ; 连接
type TrafficResp ¶
type TrafficResp struct { Code int `json:"code"` Error string `json:"error"` Time []string `json:"time,omitempty"` Data map[string]TrafficData `json:"data,omitempty"` }
TrafficResp 为带宽/流量查询响应内容