consts.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 huawei
  15. // 华为云返回的时间格式
  16. const DATETIME_FORMAT = "2006-01-02T15:04:05.999999999"
  17. // Task status
  18. const (
  19. TASK_SUCCESS = "SUCCESS"
  20. TASK_FAIL = "FAIL"
  21. )
  22. // Charging Type
  23. const (
  24. POST_PAID = "postPaid" // 按需付费
  25. PRE_PAID = "prePaid" // 包年包月
  26. )
  27. // 资源类型 https://support.huaweicloud.com/api-oce/zh-cn_topic_0079291752.html
  28. const (
  29. RESOURCE_TYPE_VM = "hws.resource.type.vm" // ECS虚拟机
  30. RESOURCE_TYPE_VOLUME = "hws.resource.type.volume" // EVS卷
  31. RESOURCE_TYPE_BANDWIDTH = "hws.resource.type.bandwidth" // VPC带宽
  32. RESOURCE_TYPE_IP = "hws.resource.type.ip" // VPC公网IP
  33. RESOURCE_TYPE_IMAGE = "hws.resource.type.marketplace" // 市场镜像
  34. )
  35. // Not Found Error code
  36. // 网络等资源直接通过http code 404即可判断资源不存在。另外有些资源可能不是返回404这里单独列出来
  37. const (
  38. VM_NOT_FOUND = "Ecs.0114" // 云服务器不存在
  39. ECS_NOT_FOUND = "Ecs.0614" // 弹性云服务器不存在
  40. IMG_ID_NOT_FOUND = "IMG.0027" // 请求的镜像ID不存在
  41. IMG_NOT_FOUND = "IMG.0027" // 镜像不存在
  42. IMG_ERR_NOT_FOUND = "IMG.0057" // 镜像文件不存在或者为空或者不是允许格式的文件
  43. IMG_BACKUP_NOT_FOUND = "IMG.0020" // 备份不存在
  44. IMG_VM_BACKUP_NOT_FOUND = "IMG.0127" // 云服务器备份不存在
  45. IMG_VM_NOT_FOUND = "IMG.0005" // 云主机不存在
  46. JOB_NOT_FOUND = "Common.0011" // jobId为空
  47. EVS_NOT_FOUND = "EVS.5404" // 磁盘、快照和备份等资源未找到。
  48. FIP_NOT_FOUND = "VPC.0504" // 未找到弹性公网IP。
  49. VPC_NOT_FOUND = "VPC.0012" // 未找到弹性公网VPC。
  50. )
  51. var NOT_FOUND_CODES = []string{
  52. VM_NOT_FOUND,
  53. ECS_NOT_FOUND,
  54. IMG_ID_NOT_FOUND,
  55. IMG_NOT_FOUND,
  56. IMG_ERR_NOT_FOUND,
  57. IMG_BACKUP_NOT_FOUND,
  58. IMG_VM_BACKUP_NOT_FOUND,
  59. IMG_VM_NOT_FOUND,
  60. JOB_NOT_FOUND,
  61. EVS_NOT_FOUND,
  62. FIP_NOT_FOUND,
  63. VPC_NOT_FOUND,
  64. }
  65. // 包周期资源相关常量
  66. // https://support.huaweicloud.com/api-bpconsole/zh-cn_topic_0082522029.html
  67. // expire_mode 0:进入宽限期 1:转按需 2:自动退订 3:自动续订(当前只支持ECS、EVS和VPC)
  68. const (
  69. EXPIRE_MODE_TO_POSTPAID = 1
  70. EXPIRE_MODE_AUTO_UNSUBSCRIBE = 2
  71. EXPIRE_MODE_AUTO_RENEW = 3
  72. )
  73. const (
  74. PERIOD_TYPE_MONTH = 2
  75. PERIOD_TYPE_YEAR = 3
  76. )
  77. const (
  78. AUTO_PAY_TRUE = 1
  79. AUTO_PAY_FALSE = 0
  80. )