-
Notifications
You must be signed in to change notification settings - Fork 38
/
resize_udbinstance.go
83 lines (60 loc) · 3.16 KB
/
resize_udbinstance.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors.
//go:generate ucloud-gen-go-api UDB ResizeUDBInstance
package udb
import (
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)
// ResizeUDBInstanceRequest is request schema for ResizeUDBInstance action
type ResizeUDBInstanceRequest struct {
request.CommonBase
// [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html)
// Region *string `required:"true"`
// [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html)
// Zone *string `required:"false"`
// [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html)
// ProjectId *int `required:"false"`
// 实例的Id
DBId *string `required:"true"`
// 内存限制(MB),目前支持以下几档 1000M/2000M/4000M/ 6000M/8000M/ 12000M/16000M/ 24000M/32000M/ 48000M/64000M/96000M。
MemoryLimit *int `required:"true"`
// 磁盘空间(GB), 暂时支持20G-3000G
DiskSpace *int `required:"true"`
// 是否使用SSD,默认为false
UseSSD *bool `required:"false"`
// SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
SSDType *string `required:"false"`
// 专区的ID,如果有值表示专区中的DB配置升降级
UDBCId *string `required:"false"`
// UDB数据库机型: "Normal": "标准机型" , "SATA_SSD": "SSD机型" , "PCIE_SSD": "SSD高性能机型" , "Normal_Volume": "标准大容量机型", "SATA_SSD_Volume": "SSD大容量机型" , "PCIE_SSD_Volume": "SSD高性能大容量机型"
InstanceType *string `required:"false"`
// UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal"
InstanceMode *string `required:"false"`
// DB关闭状态下升降级,升降级后是否启动DB,默认为false
StartAfterUpgrade *bool `required:"false"`
// 使用的代金券id
CouponId *string `required:"false"`
}
// ResizeUDBInstanceResponse is response schema for ResizeUDBInstance action
type ResizeUDBInstanceResponse struct {
response.CommonBase
}
// NewResizeUDBInstanceRequest will create request of ResizeUDBInstance action.
func (c *UDBClient) NewResizeUDBInstanceRequest() *ResizeUDBInstanceRequest {
req := &ResizeUDBInstanceRequest{}
// setup request with client config
c.Client.SetupRequest(req)
// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
return req
}
// ResizeUDBInstance - 修改(升级和降级)UDB实例的配置,包括内存和磁盘的配置,对于内存升级无需关闭实例,其他场景需要事先关闭实例。两套参数可以配置升降机:1.配置UseSSD和SSDType 2.配置InstanceType,不需要配置InstanceMode。这两套第二套参数的优先级更高
func (c *UDBClient) ResizeUDBInstance(req *ResizeUDBInstanceRequest) (*ResizeUDBInstanceResponse, error) {
var err error
var res ResizeUDBInstanceResponse
err = c.Client.InvokeAction("ResizeUDBInstance", req, &res)
if err != nil {
return &res, err
}
return &res, nil
}