elasticcache.go 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. package compute
  15. import (
  16. "time"
  17. "yunion.io/x/onecloud/pkg/apis"
  18. billing_api "yunion.io/x/onecloud/pkg/apis/billing"
  19. )
  20. type ElasticcacheDetails struct {
  21. apis.VirtualResourceDetails
  22. VpcResourceInfo
  23. ZoneResourceInfoBase
  24. SElasticcache
  25. // IP子网名称
  26. Network string `json:"network"`
  27. // 关联安全组列表
  28. Secgroups []apis.StandaloneShortDesc `json:"secgroups"`
  29. // 备可用区列表
  30. SlaveZoneInfos []apis.StandaloneShortDesc `json:"slave_zone_infos"`
  31. }
  32. func (self ElasticcacheDetails) GetMetricTags() map[string]string {
  33. ret := map[string]string{
  34. "id": self.Id,
  35. "redis_id": self.Id,
  36. "redis_ip": self.PrivateIpAddr,
  37. "redis_name": self.Name,
  38. "zone": self.Zone,
  39. "zone_id": self.ZoneId,
  40. "zone_ext_id": self.ZoneExtId,
  41. "status": self.Status,
  42. "cloudregion": self.Cloudregion,
  43. "cloudregion_id": self.CloudregionId,
  44. "region_ext_id": self.RegionExtId,
  45. "tenant": self.Project,
  46. "tenant_id": self.ProjectId,
  47. "brand": self.Brand,
  48. "account": self.Account,
  49. "account_id": self.AccountId,
  50. "domain_id": self.DomainId,
  51. "project_domain": self.ProjectDomain,
  52. "external_id": self.ExternalId,
  53. }
  54. return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
  55. }
  56. func (self ElasticcacheDetails) GetMetricPairs() map[string]string {
  57. ret := map[string]string{}
  58. return ret
  59. }
  60. type ElasticcacheResourceInfo struct {
  61. // 弹性缓存实例名称
  62. Elasticcache string `json:"elasticcache"`
  63. // 引擎
  64. Engine string `json:"engine"`
  65. // 引擎版本
  66. EngineVersion string `json:"engine_version"`
  67. // 归属VPC ID
  68. VpcId string `json:"vpc_id"`
  69. VpcResourceInfo
  70. // 归属Zone ID
  71. ZoneId string `json:"zone_id"`
  72. ZoneResourceInfoBase
  73. }
  74. type ELasticcacheResourceInput struct {
  75. // 弹性缓存实例(ID or Name)
  76. ElasticcacheId string `json:"elasticcache_id"`
  77. // swagger:ignore
  78. // Deprecated
  79. Elasticcache string `json:"elasticcache" yunion-deprecated-by:"elasticcache_id"`
  80. }
  81. type ElasticcacheFilterListInput struct {
  82. ELasticcacheResourceInput
  83. // 以弹性缓存实例名称排序
  84. OrderByElasticcache string `json:"order_by_elasticcache"`
  85. VpcFilterListInput
  86. ZonalFilterListBase
  87. }
  88. type ElasticcacheAccountDetails struct {
  89. apis.StatusStandaloneResourceDetails
  90. apis.ProjectizedResourceInfo
  91. ElasticcacheResourceInfo
  92. SElasticcacheAccount
  93. ProjectId string `json:"tenant_id"`
  94. }
  95. type ElasticcacheAclDetails struct {
  96. apis.StandaloneResourceDetails
  97. apis.ProjectizedResourceInfo
  98. ElasticcacheResourceInfo
  99. SElasticcacheAcl
  100. ProjectId string `json:"tenant_id"`
  101. }
  102. type ElasticcacheParameterDetails struct {
  103. apis.StandaloneResourceDetails
  104. ElasticcacheResourceInfo
  105. SElasticcacheParameter
  106. }
  107. type ElasticcacheSyncstatusInput struct {
  108. }
  109. type ElasticcacheRemoteUpdateInput struct {
  110. // 是否覆盖替换所有标签
  111. ReplaceTags *bool `json:"replace_tags" help:"replace all remote tags"`
  112. }
  113. type ElasticcacheJointResourceDetails struct {
  114. apis.VirtualJointResourceBaseDetails
  115. // 弹性缓存实例名称
  116. Elasticcache string `json:"elasticcache"`
  117. // 弹性缓存实例ID
  118. ElasticcacheId string `json:"elasticcache_id"`
  119. }
  120. type ElasticcacheJointsListInput struct {
  121. apis.VirtualJointResourceBaseListInput
  122. ElasticcacheFilterListInput
  123. }
  124. type ElasticcacheJointBaseUpdateInput struct {
  125. apis.VirtualJointResourceBaseUpdateInput
  126. }
  127. type ElasticcacheSecgroupsInput struct {
  128. // 安全组Id列表
  129. // 实例必须处于运行状态
  130. //
  131. //
  132. // | 平台 | 最多绑定安全组数量 |
  133. // |-------------|------------------- |
  134. // | 腾讯云 | 10 |
  135. // | 华为云 | 不支持安全组 |
  136. // | 阿里云 | 不支持安全组 |
  137. SecgroupIds []string `json:"secgroup_ids"`
  138. }
  139. type ElasticcacheCreateInput struct {
  140. apis.VirtualResourceCreateInput
  141. // 安全组列表
  142. // 腾讯云需要传此参数
  143. // required: false
  144. ElasticcacheSecgroupsInput
  145. // 主可用区名称或Id
  146. ZoneId string `json:"zone_id"`
  147. // swagger:ignore
  148. Zone string `json:"zone" yunion-deprecated-by:"zone_id"`
  149. // 备可用区名称或Id列表, split by: ,
  150. // 默认副本与主可用区一致
  151. // 支持此参数的云厂商: 腾讯云
  152. // required: false
  153. SlaveZones string `json:"slave_zones"`
  154. // Ip子网名称或Id,建议使用Id
  155. // required: true
  156. NetworkId string `json:"network_id"`
  157. // swagger:ignore
  158. Network string `json:"network" yunion-deprecated-by:"network_id"`
  159. // 网络类型
  160. // enum: ["vpc", "cLassic"]
  161. // required: true
  162. NetworkType string `json:"network_type"`
  163. // 弹性缓存Engine
  164. // enum: ["redis", "memcached"]
  165. // required: true
  166. Engine string `json:"engine"`
  167. // 弹性缓存Engine版本
  168. // required: false
  169. EngineVersion string `json:"engine_version"`
  170. // 实例规格
  171. // required: false
  172. InstanceType string `json:"instance_type"`
  173. NodeType string `json:"node_type"`
  174. // swagger:ignore
  175. MemorySizeMb int `json:"memory_size_mb" yunion-deprecated-by:"capacity_mb"`
  176. // 初始密码
  177. // required: false
  178. Password string `json:"password"`
  179. ResetPassword bool `json:"reset_password"`
  180. // 安全组名称或Id
  181. // default: default
  182. SecgroupIds []string `json:"secgroup_ids"`
  183. // 内网IP
  184. // 阿里云、华为云此参数可选,其它公有云该参数无效
  185. // required: false
  186. PrivateIp string `json:"private_ip"`
  187. // swagger:ignore
  188. VpcId string `json:"vpc_id"`
  189. // swagger:ignore
  190. ManagerId string `json:"manager_id"`
  191. // 包年包月时间周期
  192. Duration string `json:"duration"`
  193. // 到期释放时间
  194. ReleaseAt time.Time `json:"release_at"`
  195. // 是否自动续费(仅包年包月时生效)
  196. // default: false
  197. AutoRenew bool `json:"auto_renew"`
  198. // 计费方式
  199. // enum: ["postpaid", "prepaid"]
  200. BillingType billing_api.TBillingType `json:"billing_type"`
  201. // swagger:ignore
  202. BillingCycle string `json:"billing_cycle"`
  203. // 弹性缓存维护时间段
  204. // 华为云此参数可选,其它云该参数无效
  205. // enum: ["22:00:00", "02:00:00", "06:00:00", "10:00:00", "14:00:00", "18:00:00"]
  206. // required: false
  207. MaintainStartTime string `json:"maintain_start_time"`
  208. LocalCategory string `json:"local_category"`
  209. CapacityMb int `json:"capacity_mb"`
  210. CloudregionId string `json:"cloudregion_id"`
  211. }