abroad

package
v0.9.198 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_SERVICE_DOMAIN = "cdn.baidubce.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*bce.BceClient
}

Client of CDN service is a kind of BceClient, so derived from BceClient

func NewClient

func NewClient(ak, sk, endpoint string) (*Client, error)

NewClient make the CDN service client with default configuration Use `cli.Config.xxx` to access the config or change it to non-default value

func (*Client) CreateDomain added in v0.9.176

func (cli *Client) CreateDomain(domain string, originConfig []api.OriginPeer) (*api.DomainCreatedInfo, error)

CreateDomain - create a BCE ABROAD-CDN domain For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ekbsyn5o5

PARAMS:

  • domain: the specified domain
  • originInit: origin server for a ABROAD-CDN domain

RETURNS:

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

func (*Client) CreateDomainWithOptions added in v0.9.176

func (cli *Client) CreateDomainWithOptions(domain string, origins []api.OriginPeer, opts ...CreateDomainOption) (*api.DomainCreatedInfo, error)

CreateDomainWithOptions - create a BCE ABROAD-CDN domain with optional configurations. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ekbsyn5o5

PARAMS:

  • domain: the specified domain
  • origins: the origin servers
  • opts: optional configure for a CDN domain, e.g. bind with BCE tags.

RETURNS:

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

func (*Client) DeleteDomain added in v0.9.176

func (cli *Client) DeleteDomain(domain string) error

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

PARAMS:

  • domain: the specified domain

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) DisableDomain added in v0.9.176

func (cli *Client) DisableDomain(domain string) error

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

PARAMS:

  • domain: the specified domain

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) EnableDomain added in v0.9.176

func (cli *Client) EnableDomain(domain string) error

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

PARAMS:

  • domain: the specified domain

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) GetDomainConfig

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

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

PARAMS:

  • domain: the specified domain

RETURNS:

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

func (*Client) GetDomainLog

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

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

PARAMS:

  • domain: the specified domain
  • timeInterval: the specified time interval

RETURNS:

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

func (*Client) GetFlow

func (cli *Client) GetFlow(options ...api.QueryStatOption) ([]api.FlowDetail, error)

GetFlow - get the statistics of traffic(flow). For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Bkbszintg

PARAMS:

  • 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 (*Client) GetHttpCode

func (cli *Client) GetHttpCode(options ...api.QueryStatOption) ([]api.HttpCodeDetail, error)

GetHttpCode - get the statistics of accessing HTTP codes. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ekbszvxv5

PARAMS:

  • 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

func (*Client) GetPrefetchStatus

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

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

PARAMS:

  • 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

func (*Client) GetPurgedStatus

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

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

PARAMS:

  • 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

func (*Client) GetPv

func (cli *Client) GetPv(options ...api.QueryStatOption) ([]api.PvDetail, error)

GetPv - get the statistics of pv/qps. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/dkbszg48s

PARAMS:

  • 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

func (*Client) GetQuota

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

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

RETURNS:

  • QuotaDetail: the quota details about a specified user
  • error: nil if success otherwise the specific error

func (*Client) GetRealHit

func (cli *Client) GetRealHit(options ...api.QueryStatOption) ([]api.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:

  • 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

func (*Client) GetSrcFlow

func (cli *Client) GetSrcFlow(options ...api.QueryStatOption) ([]api.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:

  • 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

func (*Client) GetTags added in v0.9.177

func (cli *Client) GetTags(domain string) ([]model.TagModel, error)

GetTags - get tags the ABROAD-CDN domain bind with.

PARAMS:

  • domain: the specified domain

RETURNS:

  • []Tag: tags the ABROAD-CDN domain bind with
  • error: nil if success otherwise the specific error

func (*Client) ListDomainInfos added in v0.9.195

func (cli *Client) ListDomainInfos(marker string) ([]api.DomainInfo, string, error)

ListDomainInfos - list all domains that in ABROAD-CDN service For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/1kbsyj9m6

PARAMS:

  • 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

func (*Client) ListDomains added in v0.9.176

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

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

PARAMS:

  • 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 (*Client) Prefetch

func (cli *Client) Prefetch(tasks []api.PrefetchTask) (api.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:

  • tasks: the tasks about prefetch the files from the CDN nodes
  • error: nil if success otherwise the specific error

func (*Client) Purge

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

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:

  • 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

func (*Client) SendCustomRequest

func (cli *Client) SendCustomRequest(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:

  • 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 (*Client) SetCacheFullUrl

func (cli *Client) SetCacheFullUrl(domain string, cacheFullUrl bool) error

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:

  • 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 (*Client) SetCacheTTL

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

SetCacheTTL - add rules to cache asserts. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/Zkbstm0vg

PARAMS:

  • domain: the specified domain
  • cacheTTLs: the cache setting list

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SetDomainOrigin

func (cli *Client) SetDomainOrigin(domain string, origins []api.OriginPeer) error

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

PARAMS:

  • domain: the specified domain
  • origins: the origin servers

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SetDomainOriginWithOptions

func (cli *Client) SetDomainOriginWithOptions(domain string, origins []api.OriginPeer, opts ...DomainOriginOption) error

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

PARAMS:

  • domain: the specified domain
  • origins: the origin servers
  • opts: optional configurations for origin, unused now!!!

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SetHTTPSConfig added in v0.9.176

func (cli *Client) SetHTTPSConfig(domain string, httpsConfig *api.HTTPSConfig) error

SetHTTPSConfig - enable or disable HTTPS. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ckb0fx9ea

PARAMS:

  • domain: the specified domain
  • httpsConfig: HTTPS configurations.

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SetHTTPSConfigWithOptions added in v0.9.176

func (cli *Client) SetHTTPSConfigWithOptions(domain string, enabled bool, options ...api.HTTPSConfigOption) error

SetHTTPSConfigWithOptions - enable or disable HTTPS. For details, please refer https://cloud.baidu.com/doc/CDN-ABROAD/s/ckb0fx9ea

PARAMS:

  • 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 (*Client) SetHostToOrigin

func (cli *Client) SetHostToOrigin(domain string, originHost string) error

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:

  • domain: the specified domain
  • originHost: specified HOST header for origin server

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SetIpACL

func (cli *Client) SetIpACL(domain string, ipACL *api.IpACL) error

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:

  • domain: the specified domain
  • ipACL: IP whitelist or blacklist

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SetOriginProtocol added in v0.9.181

func (cli *Client) SetOriginProtocol(domain, originProtocol string) error

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 (*Client) SetRefererACL

func (cli *Client) SetRefererACL(domain string, refererACL *api.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:

  • domain: the specified domain
  • refererACL: referer of whitelist or blacklist

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) SetTags added in v0.9.177

func (cli *Client) SetTags(domain string, tags []model.TagModel) error

SetTags - bind ABROAD-CDN domain with the specified tags.

PARAMS:

  • domain: the specified domain
  • tags: identifying ABROAD-CDN domain as something

RETURNS:

  • error: nil if success otherwise the specific error

type CreateDomainOption added in v0.9.176

type CreateDomainOption func(interface{})

CreateDomainOption defined a method for setting optional configurations.

func CreateDomainWithTags added in v0.9.176

func CreateDomainWithTags(tags []model.TagModel) CreateDomainOption

CreateDomainWithTags defined a method for binding a CDN domain with the specified tags.

type DomainOriginOption

type DomainOriginOption func(interface{})

DomainOriginOption defined a method for setting optional origin configurations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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