yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/cloudprovider/cdn.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package cloudprovider 16 17 import ( 18 "reflect" 19 20 "yunion.io/x/jsonutils" 21 "yunion.io/x/pkg/gotypes" 22 ) 23 24 // +onecloud:model-api-gen 25 type SCdnDomain struct { 26 // cdn加速域名 27 Domain string 28 // 状态 rejected(域名未审核)|processing(部署中)|online|offline 29 Status string 30 // 区域 mainland|overseas|global 31 Area string 32 // cdn Cname 33 Cname string 34 // 源站 35 Origin string 36 // 源站类型 domain|ip|bucket 37 OriginType string 38 } 39 40 // +onecloud:model-api-gen 41 type SCdnOrigin struct { 42 // 源站类型 43 // domain: 域名类型, cos:对象存储源站, ip:IP 列表作为源站 44 // enmu: domain, cos, ip 45 // required: true 46 Type string 47 // 源站地址 48 Origin string 49 // 回主源站时 Host 头部 50 ServerName string 51 // 回源协议 52 // enmu: http, follow, https 53 Protocol string 54 Path string 55 Port int 56 Enabled string 57 Priority int 58 } 59 60 // +onecloud:model-api-gen 61 type SCdnOrigins []SCdnOrigin 62 63 func (self SCdnOrigins) IsZero() bool { 64 return len(self) == 0 65 } 66 67 func (self SCdnOrigins) String() string { 68 return jsonutils.Marshal(self).String() 69 } 70 71 func init() { 72 gotypes.RegisterSerializable(reflect.TypeOf(&SCdnOrigins{}), func() gotypes.ISerializable { 73 return &SCdnOrigins{} 74 }) 75 } 76 77 type CdnCreateOptions struct { 78 Domain string 79 ServiceType string 80 Area string 81 82 Origins SCdnOrigins 83 }