forked from ucloud/ucloud-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
describe_snapshot.go
80 lines (58 loc) · 2.24 KB
/
describe_snapshot.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
//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors.
//go:generate ucloud-gen-go-api UHost DescribeSnapshot
package uhost
import (
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)
// DescribeSnapshotRequest is request schema for DescribeSnapshot action
type DescribeSnapshotRequest struct {
request.CommonBase
// 可用区。参见 [可用区列表](../summary/regionlist.html)
Zone *string `required:"true"`
// 快照的资源ID,例如SnapshotIds.0代表希望获取信息的快照1,SnapshotIds.2代表快照2。 如果不传,则返回当前Region所有符合条件的快照。
SnapshotIds []string `required:"false"`
// 列表起始位置偏移量,默认为0
Offset *int `required:"false"`
// 返回数据长度,默认为20,最大10000000
Limit *int `required:"false"`
// 若传,则返回该主机下的所有快照
UHostId *string `required:"false"`
// 磁盘id,若磁盘传入,对应的UHostId必须一同传入
DiskId *string `required:"false"`
}
// DescribeSnapshotResponse is response schema for DescribeSnapshot action
type DescribeSnapshotResponse struct {
response.CommonBase
// 满足条件的快照总数
TotalCount int
// 快照列表,每项参数可见下面SnapshotSet
UHostSnapshotSet []SnapshotSet
// 总配额数
TotalQuota int
// 已使用的配额数
TotalUsed int
// 每块磁盘的快照配额
PerDiskQuota int
// 每块磁盘已经使用的配额数。如果不传DiskId,则返回0.
DiskUsed int
}
// NewDescribeSnapshotRequest will create request of DescribeSnapshot action.
func (c *UHostClient) NewDescribeSnapshotRequest() *DescribeSnapshotRequest {
req := &DescribeSnapshotRequest{}
// 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
}
// DescribeSnapshot - 拉取快照列表
func (c *UHostClient) DescribeSnapshot(req *DescribeSnapshotRequest) (*DescribeSnapshotResponse, error) {
var err error
var res DescribeSnapshotResponse
err = c.client.InvokeAction("DescribeSnapshot", req, &res)
if err != nil {
return &res, err
}
return &res, nil
}