File: zones.go

package info (click to toggle)
golang-github-denverdino-aliyungo 0.0~git20180921.13fa8aa-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,824 kB
  • sloc: xml: 1,359; makefile: 3
file content (209 lines) | stat: -rw-r--r-- 4,437 bytes parent folder | download | duplicates (3)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
package pvtz

import (
	"github.com/denverdino/aliyungo/common"
	"github.com/denverdino/aliyungo/util"
)

type DescribeZonesArgs struct {
	Keyword      string
	Lang         string
	UserClientIp string
	common.Pagination
}

//
type ZoneType struct {
	ZoneName    string
	ZoneId      string
	IsPtr       bool
	RecordCount int
	CreateTime  util.ISO6801Time
	UpdateTime  util.ISO6801Time
}

type DescribeZonesResponse struct {
	common.Response
	common.PaginationResult
	Zones struct {
		Zone []ZoneType
	}
}

// DescribeZones describes zones
//
// You can read doc at https://help.aliyun.com/document_detail/66243.html
func (client *Client) DescribeZones(args *DescribeZonesArgs) (zones []ZoneType, err error) {

	result := []ZoneType{}

	for {
		response := DescribeZonesResponse{}
		err = client.Invoke("DescribeZones", args, &response)

		if err != nil {
			return result, err
		}

		result = append(result, response.Zones.Zone...)

		nextPage := response.PaginationResult.NextPage()
		if nextPage == nil {
			break
		}
		args.Pagination = *nextPage
	}

	return result, nil
}

type AddZoneArgs struct {
	ZoneName     string
	Lang         string
	UserClientIp string
}

type AddZoneResponse struct {
	common.Response
	Success  bool
	ZoneId   string
	ZoneName string
}

// AddZone add zone
//
// You can read doc at https://help.aliyun.com/document_detail/66240.html
func (client *Client) AddZone(args *AddZoneArgs) (response *AddZoneResponse, err error) {
	response = &AddZoneResponse{}

	err = client.Invoke("AddZone", args, &response)

	return response, err
}

type DeleteZoneArgs struct {
	ZoneId       string
	Lang         string
	UserClientIp string
}

type DeleteZoneResponse struct {
	common.Response
	ZoneId string
}

// DeleteZone delete zone
//
// You can read doc at https://help.aliyun.com/document_detail/66240.html
func (client *Client) DeleteZone(args *DeleteZoneArgs) (err error) {
	response := &DeleteZoneResponse{}
	err = client.Invoke("DeleteZone", args, &response)

	return err
}

type CheckZoneNameArgs struct {
	ZoneName     string
	Lang         string
	UserClientIp string
}

type CheckZoneNameResponse struct {
	common.Response
	Success bool
	Check   bool
}

// CheckZoneName check zone name available or not
//
// You can read doc at https://help.aliyun.com/document_detail/66240.html
func (client *Client) CheckZoneName(args *CheckZoneNameArgs) (bool, error) {
	response := &CheckZoneNameResponse{}
	err := client.Invoke("CheckZoneName", args, &response)
	if err != nil {
		return false, err
	}

	return response.Check, err
}

type UpdateZoneRemarkArgs struct {
	ZoneId       string
	Lang         string
	UserClientIp string
	Remark       string
}

type UpdateZoneRemarkResponse struct {
	common.Response
	ZoneId string
}

// CheckZoneName check zone name available or not
//
// You can read doc at https://help.aliyun.com/document_detail/66242.html
func (client *Client) UpdateZoneRemark(args *UpdateZoneRemarkArgs) error {
	response := &UpdateZoneRemarkResponse{}
	err := client.Invoke("UpdateZoneRemark", args, &response)
	return err
}

type DescribeZoneInfoArgs struct {
	ZoneId       string
	Lang         string
	UserClientIp string
	common.Pagination
}

type VPCType struct {
	RegionId common.Region
	VpcId    string
	VpcName  string
}

type DescribeZoneInfoResponse struct {
	common.Response
	ZoneName        string
	ZoneId          string
	Remark          string
	RecordCount     int
	RegionName      string
	IsPtr           bool
	CreateTime      util.ISO6801Time
	CreateTimestamp int64
	UpdateTime      util.ISO6801Time
	UpdateTimestamp int64
	BindVpcs        struct {
		VPC []VPCType
	}
}

// DescribeZoneInfo describes zone info
//
// You can read doc at https://help.aliyun.com/document_detail/66244.html
func (client *Client) DescribeZoneInfo(args *DescribeZoneInfoArgs) (response *DescribeZoneInfoResponse, err error) {

	response = &DescribeZoneInfoResponse{}
	err = client.Invoke("DescribeZoneInfo", args, response)
	return response, err
}

type BindZoneVpcArgs struct {
	ZoneId       string
	Lang         string
	UserClientIp string
	Vpcs         []VPCType
}

type BindZoneVpcResponse struct {
	common.Response
}

// BindZoneVpc bind zone to VPC
//
// You can read doc at https://help.aliyun.com/document_detail/66244.html
func (client *Client) BindZoneVpc(args *BindZoneVpcArgs) (err error) {
	response := &BindZoneVpcResponse{}
	err = client.Invoke("BindZoneVpc", args, response)
	return err
}