| 1 | package slb |
| 2 | |
| 3 | import ( |
| 4 | "github.com/denverdino/aliyungo/common" |
| 5 | ) |
| 6 | |
| 7 | type VBackendServerType struct { |
| 8 | ServerId string |
| 9 | Weight int |
| 10 | Port int |
| 11 | Type string |
| 12 | } |
| 13 | |
| 14 | type VServerGroup struct { |
| 15 | VServerGroupName string |
| 16 | VServerGroupId string |
| 17 | } |
| 18 | |
| 19 | type VBackendServers struct { |
| 20 | BackendServer []VBackendServerType |
| 21 | } |
| 22 | |
| 23 | type CreateVServerGroupArgs struct { |
| 24 | LoadBalancerId string |
| 25 | RegionId common.Region |
| 26 | VServerGroupName string |
| 27 | VServerGroupId string |
| 28 | BackendServers string |
| 29 | } |
| 30 | |
| 31 | type SetVServerGroupAttributeArgs struct { |
| 32 | LoadBalancerId string |
| 33 | RegionId common.Region |
| 34 | VServerGroupName string |
| 35 | VServerGroupId string |
| 36 | BackendServers string |
| 37 | } |
| 38 | |
| 39 | type AddVServerGroupBackendServersArgs CreateVServerGroupArgs |
| 40 | type RemoveVServerGroupBackendServersArgs CreateVServerGroupArgs |
| 41 | type ModifyVServerGroupBackendServersArgs struct { |
| 42 | VServerGroupId string |
| 43 | RegionId common.Region |
| 44 | OldBackendServers string |
| 45 | NewBackendServers string |
| 46 | } |
| 47 | |
| 48 | type DeleteVServerGroupArgs struct { |
| 49 | VServerGroupId string |
| 50 | RegionId common.Region |
| 51 | } |
| 52 | |
| 53 | type DescribeVServerGroupsArgs struct { |
| 54 | LoadBalancerId string |
| 55 | RegionId common.Region |
| 56 | } |
| 57 | |
| 58 | type DescribeVServerGroupAttributeArgs struct { |
| 59 | VServerGroupId string |
| 60 | RegionId common.Region |
| 61 | } |
| 62 | |
| 63 | type CreateVServerGroupResponse struct { |
| 64 | common.Response |
| 65 | VServerGroupId string |
| 66 | VServerGroupName string |
| 67 | BackendServers VBackendServers |
| 68 | } |
| 69 | |
| 70 | type SetVServerGroupAttributeResponse struct { |
| 71 | common.Response |
| 72 | VServerGroupId string |
| 73 | VServerGroupName string |
| 74 | BackendServers VBackendServers |
| 75 | } |
| 76 | |
| 77 | type AddVServerGroupBackendServersResponse CreateVServerGroupResponse |
| 78 | type RemoveVServerGroupBackendServersResponse CreateVServerGroupResponse |
| 79 | type ModifyVServerGroupBackendServersResponse CreateVServerGroupResponse |
| 80 | type DeleteVServerGroupResponse struct{ common.Response } |
| 81 | type DescribeVServerGroupsResponse struct { |
| 82 | common.Response |
| 83 | VServerGroups struct { |
| 84 | VServerGroup []VServerGroup |
| 85 | } |
| 86 | } |
| 87 | type DescribeVServerGroupAttributeResponse CreateVServerGroupResponse |
| 88 | |
| 89 | func (client *Client) CreateVServerGroup(args *CreateVServerGroupArgs) (response *CreateVServerGroupResponse, err error) { |
| 90 | response = &CreateVServerGroupResponse{} |
| 91 | err = client.Invoke("CreateVServerGroup", args, response) |
| 92 | if err != nil { |
| 93 | return nil, err |
| 94 | } |
| 95 | return response, err |
| 96 | } |
| 97 | |
| 98 | func (client *Client) SetVServerGroupAttribute(args *SetVServerGroupAttributeArgs) (response *SetVServerGroupAttributeResponse, err error) { |
| 99 | response = &SetVServerGroupAttributeResponse{} |
| 100 | err = client.Invoke("SetVServerGroupAttribute", args, response) |
| 101 | if err != nil { |
| 102 | return nil, err |
| 103 | } |
| 104 | return response, err |
| 105 | } |
| 106 | |
| 107 | func (client *Client) AddVServerGroupBackendServers(args *AddVServerGroupBackendServersArgs) (response *AddVServerGroupBackendServersResponse, err error) { |
| 108 | response = &AddVServerGroupBackendServersResponse{} |
| 109 | err = client.Invoke("AddVServerGroupBackendServers", args, response) |
| 110 | if err != nil { |
| 111 | return nil, err |
| 112 | } |
| 113 | return response, err |
| 114 | } |
| 115 | |
| 116 | func (client *Client) RemoveVServerGroupBackendServers(args *RemoveVServerGroupBackendServersArgs) (response *RemoveVServerGroupBackendServersResponse, err error) { |
| 117 | response = &RemoveVServerGroupBackendServersResponse{} |
| 118 | err = client.Invoke("RemoveVServerGroupBackendServers", args, response) |
| 119 | if err != nil { |
| 120 | return nil, err |
| 121 | } |
| 122 | return response, err |
| 123 | } |
| 124 | |
| 125 | func (client *Client) ModifyVServerGroupBackendServers(args *ModifyVServerGroupBackendServersArgs) (response *ModifyVServerGroupBackendServersResponse, err error) { |
| 126 | response = &ModifyVServerGroupBackendServersResponse{} |
| 127 | err = client.Invoke("ModifyVServerGroupBackendServers", args, response) |
| 128 | if err != nil { |
| 129 | return nil, err |
| 130 | } |
| 131 | return response, err |
| 132 | } |
| 133 | |
| 134 | func (client *Client) DeleteVServerGroup(args *DeleteVServerGroupArgs) (response *DeleteVServerGroupResponse, err error) { |
| 135 | response = &DeleteVServerGroupResponse{} |
| 136 | err = client.Invoke("DeleteVServerGroup", args, response) |
| 137 | if err != nil { |
| 138 | return nil, err |
| 139 | } |
| 140 | return response, err |
| 141 | } |
| 142 | |
| 143 | func (client *Client) DescribeVServerGroups(args *DescribeVServerGroupsArgs) (response *DescribeVServerGroupsResponse, err error) { |
| 144 | response = &DescribeVServerGroupsResponse{} |
| 145 | err = client.Invoke("DescribeVServerGroups", args, response) |
| 146 | if err != nil { |
| 147 | return nil, err |
| 148 | } |
| 149 | return response, err |
| 150 | } |
| 151 | |
| 152 | func (client *Client) DescribeVServerGroupAttribute(args *DescribeVServerGroupAttributeArgs) (response *DescribeVServerGroupAttributeResponse, err error) { |
| 153 | response = &DescribeVServerGroupAttributeResponse{} |
| 154 | err = client.Invoke("DescribeVServerGroupAttribute", args, response) |
| 155 | if err != nil { |
| 156 | return nil, err |
| 157 | } |
| 158 | return response, err |
| 159 | } |