| 1 |
package pvtz |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/denverdino/aliyungo/common" |
| 5 |
"github.com/denverdino/aliyungo/util" |
| 6 |
) |
| 7 |
|
| 8 |
type DescribeZonesArgs struct { |
| 9 |
Keyword string |
| 10 |
Lang string |
| 11 |
UserClientIp string |
| 12 |
common.Pagination |
| 13 |
} |
| 14 |
|
| 15 |
|
| 16 |
type ZoneType struct { |
| 17 |
ZoneName string |
| 18 |
ZoneId string |
| 19 |
IsPtr bool |
| 20 |
RecordCount int |
| 21 |
CreateTime util.ISO6801Time |
| 22 |
UpdateTime util.ISO6801Time |
| 23 |
} |
| 24 |
|
| 25 |
type DescribeZonesResponse struct { |
| 26 |
common.Response |
| 27 |
common.PaginationResult |
| 28 |
Zones struct { |
| 29 |
Zone []ZoneType |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
func (client *Client) DescribeZones(args *DescribeZonesArgs) (zones []ZoneType, err error) { |
| 37 |
|
| 38 |
result := []ZoneType{} |
| 39 |
|
| 40 |
for { |
| 41 |
response := DescribeZonesResponse{} |
| 42 |
err = client.Invoke("DescribeZones", args, &response) |
| 43 |
|
| 44 |
if err != nil { |
| 45 |
return result, err |
| 46 |
} |
| 47 |
|
| 48 |
result = append(result, response.Zones.Zone...) |
| 49 |
|
| 50 |
nextPage := response.PaginationResult.NextPage() |
| 51 |
if nextPage == nil { |
| 52 |
break |
| 53 |
} |
| 54 |
args.Pagination = *nextPage |
| 55 |
} |
| 56 |
|
| 57 |
return result, nil |
| 58 |
} |
| 59 |
|
| 60 |
type AddZoneArgs struct { |
| 61 |
ZoneName string |
| 62 |
Lang string |
| 63 |
UserClientIp string |
| 64 |
} |
| 65 |
|
| 66 |
type AddZoneResponse struct { |
| 67 |
common.Response |
| 68 |
Success bool |
| 69 |
ZoneId string |
| 70 |
ZoneName string |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
func (client *Client) AddZone(args *AddZoneArgs) (response *AddZoneResponse, err error) { |
| 77 |
response = &AddZoneResponse{} |
| 78 |
|
| 79 |
err = client.Invoke("AddZone", args, &response) |
| 80 |
|
| 81 |
return response, err |
| 82 |
} |
| 83 |
|
| 84 |
type DeleteZoneArgs struct { |
| 85 |
ZoneId string |
| 86 |
Lang string |
| 87 |
UserClientIp string |
| 88 |
} |
| 89 |
|
| 90 |
type DeleteZoneResponse struct { |
| 91 |
common.Response |
| 92 |
ZoneId string |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
func (client *Client) DeleteZone(args *DeleteZoneArgs) (err error) { |
| 99 |
response := &DeleteZoneResponse{} |
| 100 |
err = client.Invoke("DeleteZone", args, &response) |
| 101 |
|
| 102 |
return err |
| 103 |
} |
| 104 |
|
| 105 |
type CheckZoneNameArgs struct { |
| 106 |
ZoneName string |
| 107 |
Lang string |
| 108 |
UserClientIp string |
| 109 |
} |
| 110 |
|
| 111 |
type CheckZoneNameResponse struct { |
| 112 |
common.Response |
| 113 |
Success bool |
| 114 |
Check bool |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
func (client *Client) CheckZoneName(args *CheckZoneNameArgs) (bool, error) { |
| 121 |
response := &CheckZoneNameResponse{} |
| 122 |
err := client.Invoke("CheckZoneName", args, &response) |
| 123 |
if err != nil { |
| 124 |
return false, err |
| 125 |
} |
| 126 |
|
| 127 |
return response.Check, err |
| 128 |
} |
| 129 |
|
| 130 |
type UpdateZoneRemarkArgs struct { |
| 131 |
ZoneId string |
| 132 |
Lang string |
| 133 |
UserClientIp string |
| 134 |
Remark string |
| 135 |
} |
| 136 |
|
| 137 |
type UpdateZoneRemarkResponse struct { |
| 138 |
common.Response |
| 139 |
ZoneId string |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
func (client *Client) UpdateZoneRemark(args *UpdateZoneRemarkArgs) error { |
| 146 |
response := &UpdateZoneRemarkResponse{} |
| 147 |
err := client.Invoke("UpdateZoneRemark", args, &response) |
| 148 |
return err |
| 149 |
} |
| 150 |
|
| 151 |
type DescribeZoneInfoArgs struct { |
| 152 |
ZoneId string |
| 153 |
Lang string |
| 154 |
UserClientIp string |
| 155 |
common.Pagination |
| 156 |
} |
| 157 |
|
| 158 |
type VPCType struct { |
| 159 |
RegionId common.Region |
| 160 |
VpcId string |
| 161 |
VpcName string |
| 162 |
} |
| 163 |
|
| 164 |
type DescribeZoneInfoResponse struct { |
| 165 |
common.Response |
| 166 |
ZoneName string |
| 167 |
ZoneId string |
| 168 |
Remark string |
| 169 |
RecordCount int |
| 170 |
RegionName string |
| 171 |
IsPtr bool |
| 172 |
CreateTime util.ISO6801Time |
| 173 |
CreateTimestamp int64 |
| 174 |
UpdateTime util.ISO6801Time |
| 175 |
UpdateTimestamp int64 |
| 176 |
BindVpcs struct { |
| 177 |
VPC []VPCType |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
func (client *Client) DescribeZoneInfo(args *DescribeZoneInfoArgs) (response *DescribeZoneInfoResponse, err error) { |
| 185 |
|
| 186 |
response = &DescribeZoneInfoResponse{} |
| 187 |
err = client.Invoke("DescribeZoneInfo", args, response) |
| 188 |
return response, err |
| 189 |
} |
| 190 |
|
| 191 |
type BindZoneVpcArgs struct { |
| 192 |
ZoneId string |
| 193 |
Lang string |
| 194 |
UserClientIp string |
| 195 |
Vpcs []VPCType |
| 196 |
} |
| 197 |
|
| 198 |
type BindZoneVpcResponse struct { |
| 199 |
common.Response |
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
func (client *Client) BindZoneVpc(args *BindZoneVpcArgs) (err error) { |
| 206 |
response := &BindZoneVpcResponse{} |
| 207 |
err = client.Invoke("BindZoneVpc", args, response) |
| 208 |
return err |
| 209 |
} |