| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702 |
- // Copyright 2019 Yunion
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- package qcloud
- import (
- "fmt"
- "strconv"
- "yunion.io/x/jsonutils"
- "yunion.io/x/pkg/errors"
- api "yunion.io/x/cloudmux/pkg/apis/compute"
- "yunion.io/x/cloudmux/pkg/cloudprovider"
- "yunion.io/x/cloudmux/pkg/multicloud"
- )
- type SCdnOrigin struct {
- Origins []string `json:"Origins"`
- OriginType string `json:"OriginType"`
- ServerName string `json:"ServerName"`
- CosPrivateAccess string `json:"CosPrivateAccess"`
- OriginPullProtocol string `json:"OriginPullProtocol"`
- BackupOrigins []string `json:"BackupOrigins"`
- BackupOriginType string `json:"BackupOriginType"`
- BackupServerName string `json:"BackupServerName"`
- }
- type SCdnDomain struct {
- multicloud.SCDNDomainBase
- QcloudTags
- client *SQcloudClient
- Area string `json:"Area"`
- Cname string `json:"Cname"`
- CreateTime string `json:"CreateTime"`
- Disable string `json:"Disable"`
- Domain string `json:"Domain"`
- Origin SCdnOrigin `json:"Origin"`
- ProjectId string `json:"ProjectId"`
- Readonly string `json:"Readonly"`
- ResourceID string `json:"ResourceId"`
- ServiceType string `json:"ServiceType"`
- Status string `json:"Status"`
- UpdateTime string `json:"UpdateTime"`
- config *SCdnConfig
- }
- func (self *SCdnDomain) GetConfig() (*SCdnConfig, error) {
- var err error = nil
- if self.config == nil {
- self.config, err = self.client.GetCdnConfig(self.ResourceID)
- }
- return self.config, err
- }
- type SCacheKey struct {
- FullUrlCache string
- IgnoreCase string
- KeyRules []struct {
- RulePaths []string
- RuleType string
- FullUrlCache string
- IgnoreCase string
- QueryString struct {
- Switch string
- Action string
- Value string
- }
- RuleTag string
- }
- }
- type SCache struct {
- RuleCache []CdnCache
- }
- type CdnCache struct {
- CdnCacheCacheConfig CdnCacheCacheConfig `json:"CacheConfig"`
- RulePaths []string `json:"RulePaths"`
- RuleType string `json:"RuleType"`
- }
- type CdnCacheCacheConfig struct {
- CdnCacheCacheConfigCache CdnCacheCacheConfigCache `json:"Cache"`
- CdnCacheCacheConfigFollowOrigin CdnCacheCacheConfigFollowOrigin `json:"FollowOrigin"`
- CdnCacheCacheConfigNoCache CdnCacheCacheConfigNoCache `json:"NoCache"`
- }
- type CdnCacheCacheConfigFollowOrigin struct {
- CdnCacheCacheConfigFollowOriginHeuristicCache CdnCacheCacheConfigFollowOriginHeuristicCache `json:"HeuristicCache"`
- Switch string `json:"Switch"`
- }
- type CdnCacheCacheConfigFollowOriginHeuristicCache struct {
- CdnCacheCacheConfigFollowOriginHeuristicCacheCacheConfig CdnCacheCacheConfigFollowOriginHeuristicCacheCacheConfig `json:"CacheConfig"`
- Switch string `json:"Switch"`
- }
- type CdnCacheCacheConfigFollowOriginHeuristicCacheCacheConfig struct {
- HeuristicCacheTime int `json:"HeuristicCacheTime"`
- HeuristicCacheTimeSwitch string `json:"HeuristicCacheTimeSwitch"`
- }
- type CdnCacheCacheConfigNoCache struct {
- Revalidate string `json:"Revalidate"`
- Switch string `json:"Switch"`
- }
- type CdnCacheCacheConfigCache struct {
- CacheTime int `json:"CacheTime"`
- CompareMaxAge string `json:"CompareMaxAge"`
- IgnoreCacheControl string `json:"IgnoreCacheControl"`
- IgnoreSetCookie string `json:"IgnoreSetCookie"`
- Switch string `json:"Switch"`
- }
- type SRangeOriginPull struct {
- Switch string
- RangeRules []struct {
- Switch string
- RuleType string
- RulePaths []string
- }
- Cache *SCache
- }
- type SCdnHttps struct {
- Switch string
- Http2 string
- }
- type SForceRedirect struct {
- Switch string
- RedirectType string
- }
- type SCdnReferer struct {
- Switch string
- RefererRules []struct {
- RuleType string
- RulePaths []string
- RefererType string
- Referers []string
- AllowEmpty bool
- }
- }
- type SMaxAge struct {
- Switch string
- MaxAgeRules []struct {
- MaxAgeType string
- MaxAgeContents []string
- MaxAgeTime int
- FollowOrigin string
- }
- }
- type SCdnConfig struct {
- CacheKey *SCacheKey
- RangeOriginPull *SRangeOriginPull
- Cache *SCache
- Https *SCdnHttps
- ForceRedirect *SForceRedirect
- Referer *SCdnReferer
- MaxAge *SMaxAge
- }
- func (self *SCdnDomain) GetName() string {
- return self.Domain
- }
- func (self *SCdnDomain) GetGlobalId() string {
- return self.Domain
- }
- func (self *SCdnDomain) GetId() string {
- return self.Domain
- }
- func (self *SCdnDomain) GetStatus() string {
- return self.Status
- }
- func (self *SCdnDomain) GetEnabled() bool {
- return self.Disable == "normal"
- }
- func (self *SCdnDomain) GetCname() string {
- return self.Cname
- }
- func (self *SCdnDomain) GetOrigins() *cloudprovider.SCdnOrigins {
- ret := cloudprovider.SCdnOrigins{}
- if self.Origin.OriginType == "cos" {
- self.Origin.OriginType = api.CDN_DOMAIN_ORIGIN_TYPE_BUCKET
- }
- for _, org := range self.Origin.Origins {
- ret = append(ret, cloudprovider.SCdnOrigin{
- Type: self.Origin.OriginType,
- ServerName: self.Origin.ServerName,
- Protocol: self.Origin.OriginPullProtocol,
- Origin: org,
- })
- }
- for _, org := range self.Origin.BackupOrigins {
- ret = append(ret, cloudprovider.SCdnOrigin{
- Type: self.Origin.BackupOriginType,
- ServerName: self.Origin.BackupServerName,
- Origin: org,
- })
- }
- return &ret
- }
- func (self *SCdnDomain) GetArea() string {
- return self.Area
- }
- func (self *SCdnDomain) GetServiceType() string {
- return self.ServiceType
- }
- func (self *SQcloudClient) GetCdnDomain(domain string) (*SCdnDomain, error) {
- domains, _, err := self.DescribeCdnDomains([]string{domain}, nil, "", 0, 100)
- if err != nil {
- return nil, errors.Wrapf(err, "DescribeCdnDomains")
- }
- for i := range domains {
- if domains[i].Domain == domain {
- domains[i].client = self
- return &domains[i], nil
- }
- }
- return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", domain)
- }
- func (self *SCdnDomain) Refresh() error {
- domain, err := self.client.GetCdnDomain(self.Domain)
- if err != nil {
- return err
- }
- return jsonutils.Update(self, domain)
- }
- func (self *SCdnDomain) Delete() error {
- err := self.client.StopCdnDomain(self.Domain)
- if err != nil {
- return errors.Wrapf(err, "StopCdnDomain")
- }
- return self.client.DeleteCdnDomain(self.Domain)
- }
- func (self *SCdnDomain) SetTags(tags map[string]string, replace bool) error {
- region, err := self.client.getDefaultRegion()
- if err != nil {
- return errors.Wrapf(err, "getDefaultRegion")
- }
- return region.SetResourceTags("cdn", "domain", []string{self.Domain}, tags, replace)
- }
- func (self *SQcloudClient) StopCdnDomain(domain string) error {
- params := map[string]string{
- "Domain": domain,
- }
- _, err := self.cdnRequest("StopCdnDomain", params)
- return errors.Wrapf(err, "StopCdnDomain")
- }
- func (self *SQcloudClient) StartCdnDomain(domain string) error {
- params := map[string]string{
- "Domain": domain,
- }
- _, err := self.cdnRequest("StartCdnDomain", params)
- return errors.Wrapf(err, "StartCdnDomain")
- }
- func (self *SQcloudClient) DeleteCdnDomain(domain string) error {
- params := map[string]string{
- "Domain": domain,
- }
- _, err := self.cdnRequest("DeleteCdnDomain", params)
- return errors.Wrapf(err, "DeleteCdnDomain")
- }
- type SDomains struct {
- RequestID string `json:"RequestId"`
- Domains []SCdnDomain `json:"Domains"`
- TotalNumber int `json:"TotalNumber"`
- }
- func (self *SQcloudClient) GetICloudCDNDomains() ([]cloudprovider.ICloudCDNDomain, error) {
- cdns, err := self.DescribeAllCdnDomains(nil, nil, "")
- if err != nil {
- return nil, err
- }
- ret := []cloudprovider.ICloudCDNDomain{}
- for i := range cdns {
- cdns[i].client = self
- ret = append(ret, &cdns[i])
- }
- return ret, nil
- }
- func (self *SQcloudClient) GetICloudCDNDomainByName(name string) (cloudprovider.ICloudCDNDomain, error) {
- domains, _, err := self.DescribeCdnDomains([]string{name}, nil, "", 0, 1)
- if err != nil {
- return nil, errors.Wrapf(err, "DescribeCdnDomains")
- }
- for i := range domains {
- if domains[i].Domain == name {
- domains[i].client = self
- return &domains[i], nil
- }
- }
- return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", name)
- }
- func (client *SQcloudClient) AddCdnDomain(domain string, originType string, origins []string, cosPrivateAccess string) error {
- params := map[string]string{}
- params["Domain"] = domain
- params["ServiceType"] = "web"
- for i := range origins {
- params[fmt.Sprintf("Origin.Origins.%d", i)] = origins[i]
- }
- params["Origin.OriginType"] = originType
- params["Origin.CosPrivateAccess"] = cosPrivateAccess
- _, err := client.cdnRequest("AddCdnDomain", params)
- if err != nil {
- return errors.Wrapf(err, `AddCdnDomain %s`, params)
- }
- return nil
- }
- func (client *SQcloudClient) DescribeCdnDomains(domains, origins []string, domainType string, offset int, limit int) ([]SCdnDomain, int, error) {
- params := map[string]string{}
- params["Offset"] = strconv.Itoa(offset)
- params["Limit"] = strconv.Itoa(limit)
- filterIndex := 0
- if len(domains) > 0 {
- params[fmt.Sprintf("Filters.%d.Name", filterIndex)] = "domain"
- for i := range domains {
- params[fmt.Sprintf("Filters.%d.Value.%d", filterIndex, i)] = domains[i]
- }
- filterIndex++
- }
- if len(origins) > 0 {
- params[fmt.Sprintf("Filters.%d.Name", filterIndex)] = "origin"
- for i := range origins {
- params[fmt.Sprintf("Filters.%d.Value.%d", filterIndex, i)] = origins[i]
- }
- filterIndex++
- }
- if len(domainType) > 0 {
- params[fmt.Sprintf("Filters.%d.Name", filterIndex)] = "domainType"
- params[fmt.Sprintf("Filters.%d.Value.0", filterIndex)] = domainType
- filterIndex++
- }
- resp, err := client.cdnRequest("DescribeDomainsConfig", params)
- if err != nil {
- return nil, 0, errors.Wrapf(err, "DescribeDomainsConfig %s", params)
- }
- cdnDomains := []SCdnDomain{}
- err = resp.Unmarshal(&cdnDomains, "Domains")
- if err != nil {
- return nil, 0, errors.Wrapf(err, "resp.Unmarshal")
- }
- totalcount, _ := resp.Float("TotalNumber")
- return cdnDomains, int(totalcount), nil
- }
- func (client *SQcloudClient) DescribeAllCdnDomains(domains, origins []string, domainType string) ([]SCdnDomain, error) {
- cdnDomains := make([]SCdnDomain, 0)
- for {
- part, total, err := client.DescribeCdnDomains(domains, origins, domainType, len(cdnDomains), 50)
- if err != nil {
- return nil, errors.Wrap(err, "DescribeCdnDomains")
- }
- cdnDomains = append(cdnDomains, part...)
- if len(cdnDomains) >= total {
- break
- }
- }
- return cdnDomains, nil
- }
- func (self *SQcloudClient) CreateCDNDomain(opts *cloudprovider.CdnCreateOptions) (*SCdnDomain, error) {
- params := map[string]string{
- "Domain": opts.Domain,
- "ServiceType": opts.ServiceType,
- }
- if len(opts.Area) > 0 {
- params["Area"] = opts.Area
- }
- originTypes := map[string][]string{}
- for _, origin := range opts.Origins {
- _, ok := originTypes[origin.Type]
- if !ok {
- originTypes[origin.Type] = []string{}
- }
- originTypes[origin.Type] = append(originTypes[origin.Type], origin.Origin)
- }
- for _, origin := range opts.Origins {
- params["Origin.OriginType"] = origin.Type
- if origin.Type == api.CDN_DOMAIN_ORIGIN_TYPE_BUCKET {
- params["Origin.OriginType"] = "cos"
- if len(origin.ServerName) > 0 {
- params["Origin.ServerName"] = origin.ServerName
- } else {
- params["Origin.ServerName"] = origin.Origin
- }
- }
- if len(origin.Protocol) > 0 {
- params["Origin.OriginPullProtocol"] = origin.Protocol
- }
- origins, ok := originTypes[origin.Type]
- if ok {
- for i, origin := range origins {
- params[fmt.Sprintf("Origin.Origins.%d", i)] = origin
- }
- }
- }
- _, err := self.cdnRequest("AddCdnDomain", params)
- if err != nil {
- return nil, errors.Wrapf(err, "AddCdnDomain")
- }
- return self.GetCdnDomain(opts.Domain)
- }
- func (self *SQcloudClient) GetCdnConfig(resourceId string) (*SCdnConfig, error) {
- params := map[string]string{
- "Filters.0.Name": "resourceId",
- "Filters.0.Value.0": resourceId,
- "Limit": "1",
- }
- resp, err := self.cdnRequest("DescribeDomainsConfig", params)
- if err != nil {
- return nil, errors.Wrapf(err, "DescribeDomainsConfig")
- }
- result := struct {
- Domains []SCdnConfig
- TotalNumber int
- }{}
- err = resp.Unmarshal(&result)
- if err != nil {
- return nil, errors.Wrapf(err, "resp.Unmarshal")
- }
- for i := range result.Domains {
- return &result.Domains[i], nil
- }
- return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", resourceId)
- }
- func (self *SCdnDomain) GetCacheKeys() (*cloudprovider.SCDNCacheKeys, error) {
- config, err := self.GetConfig()
- if err != nil {
- return nil, err
- }
- if config.CacheKey == nil {
- return nil, nil
- }
- enabled, ignoreCase := false, false
- ret := &cloudprovider.SCDNCacheKeys{
- KeyRules: []cloudprovider.CacheKeyRule{},
- }
- if config.CacheKey.FullUrlCache == "on" {
- enabled = true
- }
- if config.CacheKey.IgnoreCase == "on" {
- ignoreCase = true
- }
- ret.Enabled, ret.IgnoreCase = &enabled, &ignoreCase
- for _, r := range config.CacheKey.KeyRules {
- rule := cloudprovider.CacheKeyRule{
- RulePaths: r.RulePaths,
- RuleType: r.RuleType,
- FullUrlCache: r.FullUrlCache == "on",
- IgnoreCase: r.IgnoreCase == "on",
- RuleTag: r.RuleTag,
- QueryString: cloudprovider.CacheKeyRuleQueryString{
- Enabled: r.QueryString.Switch == "on",
- Action: r.QueryString.Action,
- Value: r.QueryString.Value,
- },
- }
- ret.KeyRules = append(ret.KeyRules, rule)
- }
- return ret, nil
- }
- func (self *SCdnDomain) GetRangeOriginPull() (*cloudprovider.SCDNRangeOriginPull, error) {
- config, err := self.GetConfig()
- if err != nil {
- return nil, err
- }
- if config.RangeOriginPull == nil {
- return nil, nil
- }
- ret := &cloudprovider.SCDNRangeOriginPull{RangeOriginPullRules: []cloudprovider.SRangeOriginPullRule{}}
- enabled := false
- if config.RangeOriginPull.Switch == "on" {
- enabled = true
- }
- ret.Enabled = &enabled
- for _, obj := range config.RangeOriginPull.RangeRules {
- rule := cloudprovider.SRangeOriginPullRule{
- Enabled: false,
- RuleType: obj.RuleType,
- RulePaths: obj.RulePaths,
- }
- if obj.Switch == "on" {
- rule.Enabled = true
- }
- ret.RangeOriginPullRules = append(ret.RangeOriginPullRules, rule)
- }
- return ret, nil
- }
- func (self *SCdnDomain) GetCache() (*cloudprovider.SCDNCache, error) {
- config, err := self.GetConfig()
- if err != nil {
- return nil, err
- }
- if config.Cache == nil {
- return nil, nil
- }
- ret := &cloudprovider.SCDNCache{
- RuleCache: []cloudprovider.SCacheRuleCache{},
- }
- for i, r := range config.Cache.RuleCache {
- rule := cloudprovider.SCacheRuleCache{
- Priority: i + 1,
- RulePaths: r.RulePaths,
- RuleType: r.RuleType,
- CacheConfig: &cloudprovider.RuleCacheConfig{},
- }
- if r.CdnCacheCacheConfig.CdnCacheCacheConfigCache.Switch == "on" {
- rule.CacheConfig.Cache = &struct {
- Enabled bool
- CacheTime int
- CompareMaxAge bool
- IgnoreCacheControl bool
- IgnoreSetCookie bool
- }{
- Enabled: true,
- CacheTime: r.CdnCacheCacheConfig.CdnCacheCacheConfigCache.CacheTime,
- CompareMaxAge: r.CdnCacheCacheConfig.CdnCacheCacheConfigCache.CompareMaxAge == "on",
- IgnoreCacheControl: r.CdnCacheCacheConfig.CdnCacheCacheConfigCache.IgnoreCacheControl == "on",
- IgnoreSetCookie: r.CdnCacheCacheConfig.CdnCacheCacheConfigCache.IgnoreSetCookie == "on",
- }
- } else if r.CdnCacheCacheConfig.CdnCacheCacheConfigNoCache.Switch == "on" {
- rule.CacheConfig.NoCache = &struct {
- Enabled bool
- Revalidate bool
- }{
- Enabled: true,
- Revalidate: r.CdnCacheCacheConfig.CdnCacheCacheConfigNoCache.Revalidate == "on",
- }
- } else if r.CdnCacheCacheConfig.CdnCacheCacheConfigFollowOrigin.Switch == "on" {
- follow := r.CdnCacheCacheConfig.CdnCacheCacheConfigFollowOrigin
- rule.CacheConfig.FollowOrigin = &struct {
- Enabled bool
- HeuristicCache struct {
- Enabled bool
- CacheConfig struct {
- HeuristicCacheTimeSwitch bool
- HeuristicCacheTime int
- }
- }
- }{
- Enabled: true,
- }
- rule.CacheConfig.FollowOrigin.HeuristicCache.Enabled = follow.Switch == "on"
- rule.CacheConfig.FollowOrigin.HeuristicCache.CacheConfig.HeuristicCacheTimeSwitch = follow.CdnCacheCacheConfigFollowOriginHeuristicCache.Switch == "on"
- rule.CacheConfig.FollowOrigin.HeuristicCache.CacheConfig.HeuristicCacheTime = follow.CdnCacheCacheConfigFollowOriginHeuristicCache.CdnCacheCacheConfigFollowOriginHeuristicCacheCacheConfig.HeuristicCacheTime
- }
- ret.RuleCache = append(ret.RuleCache, rule)
- }
- return ret, nil
- }
- func (self *SCdnDomain) GetHTTPS() (*cloudprovider.SCDNHttps, error) {
- config, err := self.GetConfig()
- if err != nil {
- return nil, err
- }
- if config.Https == nil {
- return nil, nil
- }
- ret := &cloudprovider.SCDNHttps{}
- enabled, enableHttp2 := false, false
- if config.Https.Switch == "on" {
- enabled = true
- }
- if config.Https.Http2 == "on" {
- enableHttp2 = true
- }
- ret.Enabled, ret.Http2 = &enabled, &enableHttp2
- return ret, nil
- }
- func (self *SCdnDomain) GetForceRedirect() (*cloudprovider.SCDNForceRedirect, error) {
- config, err := self.GetConfig()
- if err != nil {
- return nil, err
- }
- if config.ForceRedirect == nil {
- return nil, nil
- }
- ret := &cloudprovider.SCDNForceRedirect{
- RedirectType: config.ForceRedirect.RedirectType,
- }
- enabled := false
- if config.ForceRedirect.Switch == "on" {
- enabled = true
- }
- ret.Enabled = &enabled
- return ret, nil
- }
- func (self *SCdnDomain) GetReferer() (*cloudprovider.SCDNReferer, error) {
- config, err := self.GetConfig()
- if err != nil {
- return nil, err
- }
- if config.Referer == nil {
- return nil, nil
- }
- ret := &cloudprovider.SCDNReferer{
- RefererRules: []cloudprovider.RefererRule{},
- }
- enabled := false
- if config.Referer.Switch == "on" {
- enabled = true
- }
- ret.Enabled = &enabled
- for _, r := range config.Referer.RefererRules {
- rule := cloudprovider.RefererRule{
- RuleType: r.RuleType,
- RulePaths: r.RulePaths,
- RefererType: r.RuleType,
- Referers: r.Referers,
- AllowEmpty: &r.AllowEmpty,
- }
- ret.RefererRules = append(ret.RefererRules, rule)
- }
- return ret, nil
- }
- func (self *SCdnDomain) GetMaxAge() (*cloudprovider.SCDNMaxAge, error) {
- config, err := self.GetConfig()
- if err != nil {
- return nil, err
- }
- if config.MaxAge == nil {
- return nil, nil
- }
- ret := &cloudprovider.SCDNMaxAge{}
- enabled := false
- if config.MaxAge.Switch == "on" {
- enabled = true
- }
- ret.Enabled = &enabled
- for _, r := range config.MaxAge.MaxAgeRules {
- rule := cloudprovider.SMaxAgeRule{
- MaxAgeType: r.MaxAgeType,
- MaxAgeContents: r.MaxAgeContents,
- MaxAgeTime: r.MaxAgeTime,
- FollowOrigin: false,
- }
- if r.FollowOrigin == "on" {
- rule.FollowOrigin = true
- }
- ret.MaxAgeRules = append(ret.MaxAgeRules, rule)
- }
- return ret, nil
- }
- func (self *SCdnDomain) GetProjectId() string {
- return self.ProjectId
- }
|