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