-
Notifications
You must be signed in to change notification settings - Fork 38
/
describe_udbinstance.go
74 lines (54 loc) · 2.58 KB
/
describe_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
//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 DescribeUDBInstance
package udb
import (
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)
// DescribeUDBInstanceRequest is request schema for DescribeUDBInstance action
type DescribeUDBInstanceRequest struct {
request.CommonBase
// 可用区。参见 [可用区列表](../summary/regionlist.html)
Zone *string `required:"false"`
// DB种类,分为sql和nosql,如果是列表操作,则需要指定
ClassType *string `required:"true"`
// 分页显示起始偏移位置,列表操作则指定
Offset *int `required:"true"`
// 分页显示数量,列表操作则指定
Limit *int `required:"true"`
// DB实例id,如果指定则获取描述,否则为列表操作, 指定Offset/Limit/ClassType DBId可通过DescribeUDBInstance获取
DBId *string `required:"false"`
// 是否查看专区里面DB
IsInUDBC *bool `required:"false"`
// IsInUDBC为True,UDBCId为空,说明查看整个可用区的专区的db,如果UDBId不为空则只查看此专区下面的db
UDBCId *string `required:"false"`
// 当只获取这个特定DBId的信息时,如果有该选项,那么把这个DBId实例的所有从库信息一起拉取并返回
IncludeSlaves *bool `required:"false"`
}
// DescribeUDBInstanceResponse is response schema for DescribeUDBInstance action
type DescribeUDBInstanceResponse struct {
response.CommonBase
// DB实例信息列表 UDBInstanceSet
DataSet []UDBInstanceSet
// 用户db组的数量,对于 mysql: 主从结对数量,没有slave,则只有master mongodb: 副本集数量
TotalCount int
}
// NewDescribeUDBInstanceRequest will create request of DescribeUDBInstance action.
func (c *UDBClient) NewDescribeUDBInstanceRequest() *DescribeUDBInstanceRequest {
req := &DescribeUDBInstanceRequest{}
// 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
}
// DescribeUDBInstance - 获取UDB实例信息,支持两类操作:(1)指定DBId用于获取该db的信息;(2)指定ClassType、Offset、Limit用于列表操作,查询某一个类型db。
func (c *UDBClient) DescribeUDBInstance(req *DescribeUDBInstanceRequest) (*DescribeUDBInstanceResponse, error) {
var err error
var res DescribeUDBInstanceResponse
err = c.client.InvokeAction("DescribeUDBInstance", req, &res)
if err != nil {
return &res, err
}
return &res, nil
}