Revision 4f9d1a69 src/com/rackspace/cloud/loadbalancer/api/client/LoadBalancer.java
b/src/com/rackspace/cloud/loadbalancer/api/client/LoadBalancer.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import java.util.ArrayList; |
7 | 7 |
|
8 |
import com.rackspace.cloud.servers.api.client.Account; |
|
9 |
|
|
10 |
import android.util.Log; |
|
11 |
|
|
8 | 12 |
|
9 | 13 |
public class LoadBalancer extends Entity { |
10 | 14 |
|
... | ... | |
20 | 24 |
private String updated; |
21 | 25 |
private String sessionPersistence; |
22 | 26 |
private String clusterName; |
27 |
private String virtualIpType; |
|
28 |
private String region; |
|
23 | 29 |
private ConnectionThrottle connectionThrottle; |
24 | 30 |
private ArrayList<VirtualIp> virtualIps; |
25 | 31 |
private ArrayList<Node> nodes; |
26 | 32 |
|
27 |
|
|
33 |
public static String getRegionUrl(String region){ |
|
34 |
if(region.equals("ORD")){ |
|
35 |
return Account.getAccount().getLoadBalancerORDUrl(); |
|
36 |
} |
|
37 |
else if(region.equals("DFW")){ |
|
38 |
return Account.getAccount().getLoadBalancerDFWUrl(); |
|
39 |
} |
|
40 |
else{ |
|
41 |
return ""; |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
28 | 45 |
public String getId() { |
29 | 46 |
return id; |
30 | 47 |
} |
... | ... | |
46 | 63 |
} |
47 | 64 |
|
48 | 65 |
public void setProtocol(String protocol) { |
49 |
this.protocol = protocol; |
|
66 |
this.protocol = protocol.toUpperCase();
|
|
50 | 67 |
} |
51 | 68 |
|
52 | 69 |
public String getPort() { |
... | ... | |
136 | 153 |
public void setNodes(ArrayList<Node> nodes) { |
137 | 154 |
this.nodes = nodes; |
138 | 155 |
} |
156 |
|
|
157 |
public String getVirtualIpType(){ |
|
158 |
return virtualIpType; |
|
159 |
} |
|
160 |
|
|
161 |
public String setVirtualIpType(String virtualIpType){ |
|
162 |
return this.virtualIpType = virtualIpType.toUpperCase(); |
|
163 |
} |
|
164 |
|
|
165 |
public String getRegion(){ |
|
166 |
return region; |
|
167 |
} |
|
168 |
|
|
169 |
public String setRegion(String region){ |
|
170 |
return this.region = region; |
|
171 |
} |
|
139 | 172 |
|
140 | 173 |
public static long getSerialversionuid() { |
141 | 174 |
return serialVersionUID; |
... | ... | |
147 | 180 |
+ getName() + "\" id=\"" + getId() + "</loadBalancer>"; |
148 | 181 |
return xml; |
149 | 182 |
} |
183 |
|
|
184 |
public String toDetailedXML(){ |
|
185 |
String xml = "<loadBalancer xmlns=\"http://docs.openstack.org/loadbalancers/api/v1.0\"" + |
|
186 |
" name=\"" + getName() + "\"" + |
|
187 |
" port=\"" + getPort() + "\"" + |
|
188 |
" protocol=\"" + getProtocol() + "\"" + |
|
189 |
" algorithm=\"" + getAlgorithm() + "\"" + ">" + |
|
190 |
" <virtualIps>" + |
|
191 |
"<virtualIp type=\"" + getVirtualIpType() + "\"" + "/>" + |
|
192 |
" </virtualIps>" + |
|
193 |
" <nodes>"; |
|
194 |
for(Node node : getNodes()){ |
|
195 |
xml += "<node address=\"" + node.getAddress() + "\"" + " port=\"" + node.getPort() + "\"" + |
|
196 |
" condition=\"" + node.getCondition() + "\"" + "/>"; |
|
197 |
} |
|
198 |
xml += " </nodes>" + |
|
199 |
" </loadBalancer>"; |
|
200 |
Log.d("info", xml); |
|
201 |
return xml; |
|
202 |
} |
|
150 | 203 |
} |
Also available in: Unified diff