mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
bug 13864: for elastic IP address return the purpose (staticNat or Lb) in listPublicIpAddresses api response
Reviewed-by: Frank
This commit is contained in:
parent
4d27f3c44b
commit
31a3b878a3
@ -331,6 +331,7 @@ public class ApiConstants {
|
||||
public static final String IS_STATIC_NAT = "isstaticnat";
|
||||
public static final String SORT_BY = "sortby";
|
||||
public static final String CHANGE_CIDR = "changecidr";
|
||||
public static final String PURPOSE = "purpose";
|
||||
|
||||
public enum HostDetails {
|
||||
all, capacity, events, stats, min;
|
||||
|
||||
@ -93,7 +93,10 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
|
||||
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
|
||||
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
|
||||
|
||||
@SerializedName(ApiConstants.PURPOSE) @Param(description="purpose of the IP address. In Acton this value is not null for Elastic IPs only, and can have either StaticNat or LB value")
|
||||
private String purpose;
|
||||
|
||||
/*
|
||||
@SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume")
|
||||
@ -207,11 +210,11 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
this.physicalNetworkId.setValue(physicalNetworkId);
|
||||
}
|
||||
|
||||
public long getphysicalNetworkId() {
|
||||
return physicalNetworkId.getValue();
|
||||
}
|
||||
|
||||
public void setIsElastic(Boolean isElastic) {
|
||||
this.isElastic = isElastic;
|
||||
}
|
||||
|
||||
public void setPurpose(String purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,6 +44,11 @@ public interface IpAddress extends ControlledEntity {
|
||||
Releasing, // The IP address is being released for other network elements and is not ready for allocation.
|
||||
Free // The IP address is ready to be allocated.
|
||||
}
|
||||
|
||||
enum Purpose {
|
||||
StaticNat,
|
||||
Lb
|
||||
}
|
||||
|
||||
long getDataCenterId();
|
||||
|
||||
|
||||
@ -759,6 +759,15 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
ipResponse.setVlanId(ipAddress.getVlanId());
|
||||
ipResponse.setVlanName(ApiDBUtils.findVlanById(ipAddress.getVlanId()).getVlanTag());
|
||||
}
|
||||
|
||||
if (ipAddress.getElastic()) {
|
||||
if (ipAddress.isOneToOneNat()) {
|
||||
ipResponse.setPurpose(IpAddress.Purpose.StaticNat.toString());
|
||||
} else {
|
||||
ipResponse.setPurpose(IpAddress.Purpose.Lb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
ipResponse.setObjectName("ipaddress");
|
||||
return ipResponse;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user