fix(region): cdn domain config

This commit is contained in:
ioito
2023-02-02 19:41:54 +08:00
parent 58a20e4bf4
commit 974ce57c24
9 changed files with 812 additions and 7 deletions

View File

@@ -57,6 +57,14 @@ type SCdnOrigin struct {
Priority int
}
type CdnCreateOptions struct {
Domain string
ServiceType string
Area string
Origins SCdnOrigins
}
// +onecloud:model-api-gen
type SCdnOrigins []SCdnOrigin
@@ -68,16 +76,226 @@ func (self SCdnOrigins) String() string {
return jsonutils.Marshal(self).String()
}
// 是否忽略参数
type SCDNCacheKeys struct {
// 开启关闭忽略参数
Enabled *bool
// 是否忽略大小
IgnoreCase *bool
// 分路径缓存键配置
KeyRules []CacheKeyRule
}
type CacheKeyRule struct {
RulePaths []string
RuleType string
FullUrlCache bool
IgnoreCase bool
QueryString CacheKeyRuleQueryString
RuleTag string
}
type CacheKeyRuleQueryString struct {
Enabled bool
Action string
Value string
}
func (self SCDNCacheKeys) IsZero() bool {
return jsonutils.Marshal(self) == jsonutils.Marshal(&SCDNCacheKeys{})
}
func (self SCDNCacheKeys) String() string {
return jsonutils.Marshal(self).String()
}
// 是否分片回源
type SCDNRangeOriginPull struct {
Enabled *bool
RangeOriginPullRules []SRangeOriginPullRule
}
type SRangeOriginPullRule struct {
Enabled bool
RuleType string
RulePaths []string
}
func (self SCDNRangeOriginPull) IsZero() bool {
return jsonutils.Marshal(self) == jsonutils.Marshal(&SCDNRangeOriginPull{})
}
func (self SCDNRangeOriginPull) String() string {
return jsonutils.Marshal(self).String()
}
type CacheRule struct {
// 规则类型:
// all所有文件生效
// file指定文件后缀生效
// directory指定路径生效
// path指定绝对路径生效
// index首页
CacheType string
// CacheType 对应类型下的匹配内容
CacheContents []string
// 过期时间: 秒
CacheTime int
}
type SCDNCache struct {
RuleCache []SCacheRuleCache
}
type SCacheRuleCache struct {
RulePaths []string
RuleType string
Priority int
CacheConfig *RuleCacheConfig
}
type RuleCacheConfig struct {
Cache *struct {
Enabled bool
CacheTime int
CompareMaxAge bool
IgnoreCacheControl bool
IgnoreSetCookie bool
}
NoCache *struct {
Enabled bool
Revalidate bool
}
FollowOrigin *struct {
Enabled bool
HeuristicCache struct {
Enabled bool
CacheConfig struct {
HeuristicCacheTimeSwitch bool
HeuristicCacheTime int
}
}
}
}
func (self SCDNCache) IsZero() bool {
return jsonutils.Marshal(self) == jsonutils.Marshal(&SCDNCache{})
}
func (self SCDNCache) String() string {
return jsonutils.Marshal(self).String()
}
type SCDNHttps struct {
// https 配置开关
Enabled *bool
// http2 配置开关
Http2 *bool
}
func (self SCDNHttps) IsZero() bool {
return jsonutils.Marshal(self) == jsonutils.Marshal(&SCDNHttps{})
}
func (self SCDNHttps) String() string {
return jsonutils.Marshal(self).String()
}
type SCDNForceRedirect struct {
// 访问强制跳转配置开关
Enabled *bool
// 访问强制跳转类型
// enmu: http, https
RedirectType string
}
func (self SCDNForceRedirect) IsZero() bool {
return jsonutils.Marshal(self) == jsonutils.Marshal(&SCDNForceRedirect{})
}
func (self SCDNForceRedirect) String() string {
return jsonutils.Marshal(self).String()
}
type RefererRule struct {
// 规则类型:
// all所有文件生效
// file指定文件后缀生效
// directory指定路径生效
// path指定绝对路径生效
RuleType string
RulePaths []string
RefererType string
Referers []string
AllowEmpty *bool
}
type SCDNReferer struct {
// 是否开启防盗链
Enabled *bool
RefererRules []RefererRule
}
func (self SCDNReferer) IsZero() bool {
return jsonutils.Marshal(self) == jsonutils.Marshal(&SCDNReferer{})
}
func (self SCDNReferer) String() string {
return jsonutils.Marshal(self).String()
}
type SMaxAgeRule struct {
MaxAgeType string
MaxAgeContents []string
MaxAgeTime int
FollowOrigin bool
}
// 浏览器缓存配置
type SCDNMaxAge struct {
Enabled *bool
MaxAgeRules []SMaxAgeRule
}
func (self SCDNMaxAge) IsZero() bool {
return jsonutils.Marshal(self) == jsonutils.Marshal(&SCDNMaxAge{})
}
func (self SCDNMaxAge) String() string {
return jsonutils.Marshal(self).String()
}
func init() {
gotypes.RegisterSerializable(reflect.TypeOf(&SCdnOrigins{}), func() gotypes.ISerializable {
return &SCdnOrigins{}
})
}
type CdnCreateOptions struct {
Domain string
ServiceType string
Area string
gotypes.RegisterSerializable(reflect.TypeOf(&SCDNCacheKeys{}), func() gotypes.ISerializable {
return &SCDNCacheKeys{}
})
Origins SCdnOrigins
gotypes.RegisterSerializable(reflect.TypeOf(&SCDNRangeOriginPull{}), func() gotypes.ISerializable {
return &SCDNRangeOriginPull{}
})
gotypes.RegisterSerializable(reflect.TypeOf(&SCDNCache{}), func() gotypes.ISerializable {
return &SCDNCache{}
})
gotypes.RegisterSerializable(reflect.TypeOf(&SCDNHttps{}), func() gotypes.ISerializable {
return &SCDNHttps{}
})
gotypes.RegisterSerializable(reflect.TypeOf(&SCDNForceRedirect{}), func() gotypes.ISerializable {
return &SCDNForceRedirect{}
})
gotypes.RegisterSerializable(reflect.TypeOf(&SCDNReferer{}), func() gotypes.ISerializable {
return &SCDNReferer{}
})
gotypes.RegisterSerializable(reflect.TypeOf(&SCDNMaxAge{}), func() gotypes.ISerializable {
return &SCDNMaxAge{}
})
}

View File

@@ -1522,5 +1522,20 @@ type ICloudCDNDomain interface {
GetCname() string
GetOrigins() *SCdnOrigins
// 是否忽略参数
GetCacheKeys() (*SCDNCacheKeys, error)
// 是否分片回源
GetRangeOriginPull() (*SCDNRangeOriginPull, error)
// 缓存配置
GetCache() (*SCDNCache, error)
// https配置
GetHTTPS() (*SCDNHttps, error)
// 强制跳转
GetForceRedirect() (*SCDNForceRedirect, error)
// 防盗链配置
GetReferer() (*SCDNReferer, error)
// 浏览器缓存配置
GetMaxAge() (*SCDNMaxAge, error)
Delete() error
}

View File

@@ -132,6 +132,11 @@ type SecurityGroupCreateInput struct {
Rules []secrules.SecurityRule
}
type SecurityGroupCreateOutput struct {
Return bool
GroupId string
}
type SecurityRule struct {
minPriority int
maxPriority int

View File

@@ -74,6 +74,20 @@ type SCDNDomain struct {
ServiceType string `list:"user" width:"32" create:"domain_required"`
// 加速区域
Area string `list:"user" width:"32" update:"domain" create:"domain_required"`
// 是否忽略参数
CacheKeys *cloudprovider.SCDNCacheKeys `list:"user" create:"domain_optional"`
// 是否分片回源
RangeOriginPull *cloudprovider.SCDNRangeOriginPull `list:"user" create:"domain_optional"`
// 缓存配置
Cache *cloudprovider.SCDNCache `list:"user" create:"domain_optional"`
// https配置
HTTPS *cloudprovider.SCDNHttps `list:"user" create:"domain_optional"`
// 强制跳转
ForceRedirect *cloudprovider.SCDNForceRedirect `list:"user" create:"domain_optional"`
// 防盗链配置
Referer *cloudprovider.SCDNReferer `list:"user" create:"domain_optional"`
// 浏览器缓存配置
MaxAge *cloudprovider.SCDNMaxAge `list:"user" create:"domain_optional"`
}
func (manager *SCDNDomainManager) GetContextManagers() [][]db.IModelManager {
@@ -212,6 +226,28 @@ func (self *SCDNDomain) SyncWithCloudCDNDomain(ctx context.Context, userCred mcc
self.ServiceType = ext.GetServiceType()
self.Cname = ext.GetCname()
self.Origins = ext.GetOrigins()
cacheKeys, err := ext.GetCacheKeys()
if err == nil {
self.CacheKeys = cacheKeys
}
if rangeOrigin, err := ext.GetRangeOriginPull(); err == nil {
self.RangeOriginPull = rangeOrigin
}
if cache, err := ext.GetCache(); err == nil {
self.Cache = cache
}
if https, err := ext.GetHTTPS(); err == nil {
self.HTTPS = https
}
if fr, err := ext.GetForceRedirect(); err == nil {
self.ForceRedirect = fr
}
if referer, err := ext.GetReferer(); err == nil {
self.Referer = referer
}
if maxAge, err := ext.GetMaxAge(); err == nil {
self.MaxAge = maxAge
}
return nil
})
if err != nil {
@@ -246,6 +282,13 @@ func (self *SCloudprovider) newFromCloudCDNDomain(ctx context.Context, userCred
domain.ServiceType = ext.GetServiceType()
domain.Cname = ext.GetCname()
domain.Origins = ext.GetOrigins()
domain.CacheKeys, _ = ext.GetCacheKeys()
domain.RangeOriginPull, _ = ext.GetRangeOriginPull()
domain.Cache, _ = ext.GetCache()
domain.HTTPS, _ = ext.GetHTTPS()
domain.ForceRedirect, _ = ext.GetForceRedirect()
domain.Referer, _ = ext.GetReferer()
domain.MaxAge, _ = ext.GetMaxAge()
err := CDNDomainManager.TableSpec().Insert(ctx, &domain)
if err != nil {

View File

@@ -65,7 +65,7 @@ type SCdnSources struct {
}
type SCdnDomain struct {
multicloud.SResourceBase
multicloud.SCDNDomainBase
client *SAliyunClient

View File

@@ -0,0 +1,53 @@
// 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 multicloud
import (
"yunion.io/x/pkg/errors"
"yunion.io/x/onecloud/pkg/cloudprovider"
)
type SCDNDomainBase struct {
SResourceBase
}
func (self *SCDNDomainBase) GetCacheKeys() (*cloudprovider.SCDNCacheKeys, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetCacheKeys")
}
func (self *SCDNDomainBase) GetRangeOriginPull() (*cloudprovider.SCDNRangeOriginPull, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetRangeOriginPull")
}
func (self *SCDNDomainBase) GetCache() (*cloudprovider.SCDNCache, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetCache")
}
func (self *SCDNDomainBase) GetHTTPS() (*cloudprovider.SCDNHttps, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetHTTPS")
}
func (self *SCDNDomainBase) GetForceRedirect() (*cloudprovider.SCDNForceRedirect, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetForceRedirect")
}
func (self *SCDNDomainBase) GetReferer() (*cloudprovider.SCDNReferer, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetReferer")
}
func (self *SCDNDomainBase) GetMaxAge() (*cloudprovider.SCDNMaxAge, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetMaxAge")
}

View File

@@ -55,6 +55,134 @@ type SCdnDomain struct {
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 {
@@ -319,3 +447,252 @@ func (self *SQcloudClient) CreateCDNDomain(opts *cloudprovider.CdnCreateOptions)
}
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, 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
}

View File

@@ -0,0 +1,42 @@
// 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 cloudprovider
import "yunion.io/x/pkg/errors"
const (
ErrMissingParameter = errors.Error("MissingParameterError")
ErrInputParameter = errors.Error("InputParameterError")
ErrInvalidProvider = errors.Error("InvalidProvider")
ErrNoBalancePermission = errors.Error("NoBalancePermission")
ErrForbidden = errors.Error("ForbiddenError")
ErrTooLarge = errors.Error("TooLargeEntity")
ErrUnsupportedProtocol = errors.Error("UnsupportedProtocol")
ErrInvalidAccessKey = errors.Error("InvalidAccessKey")
ErrUnauthorized = errors.Error("UnauthorizedError")
ErrInvalidCredential = errors.Error("InvalidCredentialError")
ErrNoPermission = errors.Error("NoPermission")
ErrNoSuchProvder = errors.Error("no such provider")
ErrNotFound = errors.ErrNotFound
ErrDuplicateId = errors.ErrDuplicateId
ErrInvalidStatus = errors.ErrInvalidStatus
ErrTimeout = errors.ErrTimeout
ErrNotImplemented = errors.ErrNotImplemented
ErrNotSupported = errors.ErrNotSupported
ErrAccountReadOnly = errors.ErrAccountReadOnly
ErrUnknown = errors.Error("UnknownError")
)

View File

@@ -0,0 +1,52 @@
// 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 multicloud
import (
"yunion.io/x/cloudmux/pkg/cloudprovider"
"yunion.io/x/pkg/errors"
)
type SCDNDomainBase struct {
SResourceBase
}
func (self *SCDNDomainBase) GetCacheKeys() (*cloudprovider.SCDNCacheKeys, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetCacheKeys")
}
func (self *SCDNDomainBase) GetRangeOriginPull() (*cloudprovider.SCDNRangeOriginPull, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetRangeOriginPull")
}
func (self *SCDNDomainBase) GetCache() (*cloudprovider.SCDNCache, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetCache")
}
func (self *SCDNDomainBase) GetHTTPS() (*cloudprovider.SCDNHttps, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetHTTPS")
}
func (self *SCDNDomainBase) GetForceRedirect() (*cloudprovider.SCDNForceRedirect, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetForceRedirect")
}
func (self *SCDNDomainBase) GetReferer() (*cloudprovider.SCDNReferer, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetReferer")
}
func (self *SCDNDomainBase) GetMaxAge() (*cloudprovider.SCDNMaxAge, error) {
return nil, errors.Wrapf(cloudprovider.ErrNotImplemented, "GetMaxAge")
}