mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Remove IdentityProxy from OfferingResponse, FirewallResponse,
FirewallRuleResponse, HypervisorCapabilitiesResponse, IPAddressResponse. Signed-off-by: Min Chen <min.chen@citrix.com>
This commit is contained in:
parent
1aa30f03e7
commit
16be94e9d7
@ -28,6 +28,8 @@ public interface HypervisorCapabilities {
|
||||
*/
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
/**
|
||||
* @return type of hypervisor
|
||||
*/
|
||||
|
||||
@ -72,6 +72,8 @@ public interface IpAddress extends ControlledEntity {
|
||||
*/
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
void setState(IpAddress.State state);
|
||||
|
||||
Long getAllocatedToAccountId();
|
||||
|
||||
@ -255,6 +255,8 @@ public interface Network extends ControlledEntity {
|
||||
*/
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
String getName();
|
||||
|
||||
Mode getMode();
|
||||
|
||||
@ -24,6 +24,7 @@ import com.cloud.network.Networks.TrafficType;
|
||||
|
||||
public class NetworkProfile implements Network {
|
||||
private long id;
|
||||
private String uuid;
|
||||
private long dataCenterId;
|
||||
private long ownerId;
|
||||
private long domainId;
|
||||
@ -51,6 +52,7 @@ public class NetworkProfile implements Network {
|
||||
|
||||
public NetworkProfile(Network network) {
|
||||
this.id = network.getId();
|
||||
this.uuid = network.getUuid();
|
||||
this.broadcastUri = network.getBroadcastUri();
|
||||
this.dataCenterId = network.getDataCenterId();
|
||||
this.ownerId = network.getAccountId();
|
||||
@ -105,6 +107,12 @@ public class NetworkProfile implements Network {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDataCenterId() {
|
||||
return dataCenterId;
|
||||
|
||||
@ -52,6 +52,12 @@ public interface FirewallRule extends ControlledEntity {
|
||||
*/
|
||||
long getId();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return uuid
|
||||
*/
|
||||
String getUuid();
|
||||
|
||||
/**
|
||||
* @return external id.
|
||||
*/
|
||||
|
||||
@ -153,6 +153,13 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSourceIpAddressId() {
|
||||
return ipAddressId;
|
||||
|
||||
@ -208,6 +208,13 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSourceIpAddressId() {
|
||||
return ipAddressId;
|
||||
|
||||
@ -255,6 +255,13 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncObjType() {
|
||||
return BaseAsyncCmd.networkSyncObject;
|
||||
|
||||
@ -184,6 +184,13 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSourceIpAddressId() {
|
||||
return null;
|
||||
|
||||
@ -19,17 +19,16 @@ package org.apache.cloudstack.api.response;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
public class DiskOfferingResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="unique ID of the disk offering")
|
||||
private IdentityProxy id = new IdentityProxy("disk_offering");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.")
|
||||
private IdentityProxy domainId = new IdentityProxy("domain");
|
||||
private String domainId;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.")
|
||||
private String domain;
|
||||
@ -55,20 +54,20 @@ public class DiskOfferingResponse extends BaseResponse {
|
||||
@SerializedName("storagetype") @Param(description="the storage type for this disk offering")
|
||||
private String storageType;
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId.getValue();
|
||||
public String getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public void setDomainId(Long domainId) {
|
||||
this.domainId.setValue(domainId);
|
||||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
|
||||
@ -20,14 +20,13 @@ import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class FirewallResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the firewall rule")
|
||||
private IdentityProxy id = new IdentityProxy("firewall_rules");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the firewall rule")
|
||||
private String protocol;
|
||||
@ -59,8 +58,8 @@ public class FirewallResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the rule", responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
|
||||
@ -20,14 +20,13 @@ import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class FirewallRuleResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the port forwarding rule")
|
||||
private IdentityProxy id = new IdentityProxy("firewall_rules");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.PRIVATE_START_PORT) @Param(description = "the starting port of port forwarding rule's private port range")
|
||||
private String privateStartPort;
|
||||
@ -45,7 +44,7 @@ public class FirewallRuleResponse extends BaseResponse {
|
||||
private String publicEndPort;
|
||||
|
||||
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="the VM ID for the port forwarding rule")
|
||||
private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance");
|
||||
private String virtualMachineId;
|
||||
|
||||
@SerializedName("virtualmachinename") @Param(description="the VM name for the port forwarding rule")
|
||||
private String virtualMachineName;
|
||||
@ -54,7 +53,7 @@ public class FirewallRuleResponse extends BaseResponse {
|
||||
private String virtualMachineDisplayName;
|
||||
|
||||
@SerializedName(ApiConstants.IP_ADDRESS_ID) @Param(description="the public ip address id for the port forwarding rule")
|
||||
private IdentityProxy publicIpAddressId = new IdentityProxy("user_ip_address");
|
||||
private String publicIpAddressId;
|
||||
|
||||
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the public ip address for the port forwarding rule")
|
||||
private String publicIpAddress;
|
||||
@ -68,12 +67,12 @@ public class FirewallRuleResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with the rule", responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPrivateStartPort() {
|
||||
@ -116,12 +115,12 @@ public class FirewallRuleResponse extends BaseResponse {
|
||||
this.publicEndPort = publicPort;
|
||||
}
|
||||
|
||||
public Long getVirtualMachineId() {
|
||||
return virtualMachineId.getValue();
|
||||
public String getVirtualMachineId() {
|
||||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public void setVirtualMachineId(Long virtualMachineId) {
|
||||
this.virtualMachineId.setValue(virtualMachineId);
|
||||
public void setVirtualMachineId(String virtualMachineId) {
|
||||
this.virtualMachineId = virtualMachineId;
|
||||
}
|
||||
|
||||
public String getVirtualMachineName() {
|
||||
@ -156,12 +155,12 @@ public class FirewallRuleResponse extends BaseResponse {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Long getPublicIpAddressId() {
|
||||
return publicIpAddressId.getValue();
|
||||
public String getPublicIpAddressId() {
|
||||
return publicIpAddressId;
|
||||
}
|
||||
|
||||
public void setPublicIpAddressId(Long publicIpAddressId) {
|
||||
this.publicIpAddressId.setValue(publicIpAddressId);
|
||||
public void setPublicIpAddressId(String publicIpAddressId) {
|
||||
this.publicIpAddressId = publicIpAddressId;
|
||||
}
|
||||
|
||||
public String getCidrList() {
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@ -25,7 +24,7 @@ import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
public class HypervisorCapabilitiesResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the hypervisor capabilities row")
|
||||
private IdentityProxy id = new IdentityProxy("hypervisor_capabilities");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.HYPERVISOR_VERSION) @Param(description="the hypervisor version")
|
||||
private String hypervisorVersion;
|
||||
@ -39,17 +38,13 @@ public class HypervisorCapabilitiesResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is supported")
|
||||
private boolean isSecurityGroupEnabled;
|
||||
|
||||
@Override
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -21,14 +21,13 @@ import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class IPAddressResponse extends BaseResponse implements ControlledEntityResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="public IP address id")
|
||||
private IdentityProxy id = new IdentityProxy("user_ip_address");
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="public IP address")
|
||||
private String ipAddress;
|
||||
@ -37,7 +36,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
private Date allocated;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the zone the public IP address belongs to")
|
||||
private IdentityProxy zoneId = new IdentityProxy("data_center");
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the zone the public IP address belongs to")
|
||||
private String zoneName;
|
||||
@ -65,7 +64,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
|
||||
@SerializedName(ApiConstants.VLAN_ID) @Param(description="the ID of the VLAN associated with the IP address." +
|
||||
" This parameter is visible to ROOT admins only")
|
||||
private IdentityProxy vlanId = new IdentityProxy("vlan");
|
||||
private String vlanId;
|
||||
|
||||
@SerializedName("vlanname") @Param(description="the VLAN associated with the IP address")
|
||||
private String vlanName;
|
||||
@ -77,7 +76,7 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
private Boolean isSystem;
|
||||
|
||||
@SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="virutal machine id the ip address is assigned to (not null only for static nat Ip)")
|
||||
private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance");
|
||||
private String virtualMachineId;
|
||||
|
||||
@SerializedName("virtualmachinename") @Param(description="virutal machine name the ip address is assigned to (not null only for static nat Ip)")
|
||||
private String virtualMachineName;
|
||||
@ -86,25 +85,25 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
private String virtualMachineDisplayName;
|
||||
|
||||
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) @Param(description="the ID of the Network associated with the IP address")
|
||||
private IdentityProxy associatedNetworkId = new IdentityProxy("networks");
|
||||
private String associatedNetworkId;
|
||||
|
||||
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_NAME) @Param(description="the name of the Network associated with the IP address")
|
||||
private String associatedNetworkName;
|
||||
|
||||
@SerializedName(ApiConstants.NETWORK_ID) @Param(description="the ID of the Network where ip belongs to")
|
||||
private IdentityProxy networkId = new IdentityProxy("networks");
|
||||
private String networkId;
|
||||
|
||||
@SerializedName(ApiConstants.STATE) @Param(description="State of the ip address. Can be: Allocatin, Allocated and Releasing")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
|
||||
private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
|
||||
private String physicalNetworkId;
|
||||
|
||||
@SerializedName(ApiConstants.PURPOSE) @Param(description="purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value")
|
||||
private String purpose;
|
||||
|
||||
@SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the ip belongs to")
|
||||
private IdentityProxy vpcId = new IdentityProxy("vpc");
|
||||
private String vpcId;
|
||||
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with ip address", responseObject = ResourceTagResponse.class)
|
||||
private List<ResourceTagResponse> tags;
|
||||
|
||||
@ -122,8 +121,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
this.allocated = allocated;
|
||||
}
|
||||
|
||||
public void setZoneId(Long zoneId) {
|
||||
this.zoneId.setValue(zoneId);
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public void setZoneName(String zoneName) {
|
||||
@ -153,8 +152,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
this.forVirtualNetwork = forVirtualNetwork;
|
||||
}
|
||||
|
||||
public void setVlanId(Long vlanId) {
|
||||
this.vlanId.setValue(vlanId);
|
||||
public void setVlanId(String vlanId) {
|
||||
this.vlanId = vlanId;
|
||||
}
|
||||
|
||||
public void setVlanName(String vlanName) {
|
||||
@ -165,16 +164,16 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
this.staticNat = staticNat;
|
||||
}
|
||||
|
||||
public void setAssociatedNetworkId(Long networkId) {
|
||||
this.associatedNetworkId.setValue(networkId);
|
||||
public void setAssociatedNetworkId(String networkId) {
|
||||
this.associatedNetworkId = networkId;
|
||||
}
|
||||
|
||||
public void setNetworkId(Long networkId) {
|
||||
this.networkId.setValue(networkId);
|
||||
public void setNetworkId(String networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public void setVirtualMachineId(Long virtualMachineId) {
|
||||
this.virtualMachineId.setValue(virtualMachineId);
|
||||
public void setVirtualMachineId(String virtualMachineId) {
|
||||
this.virtualMachineId = virtualMachineId;
|
||||
}
|
||||
|
||||
public void setVirtualMachineName(String virtualMachineName) {
|
||||
@ -185,22 +184,18 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
this.virtualMachineDisplayName = virtualMachineDisplayName;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getObjectId() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectId(String projectId) {
|
||||
@ -212,8 +207,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setPhysicalNetworkId(long physicalNetworkId) {
|
||||
this.physicalNetworkId.setValue(physicalNetworkId);
|
||||
public void setPhysicalNetworkId(String physicalNetworkId) {
|
||||
this.physicalNetworkId = physicalNetworkId;
|
||||
}
|
||||
|
||||
public void setIsSystem(Boolean isSystem) {
|
||||
@ -224,8 +219,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
|
||||
this.purpose = purpose;
|
||||
}
|
||||
|
||||
public void setVpcId(Long vpcId) {
|
||||
this.vpcId.setValue(vpcId);
|
||||
public void setVpcId(String vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
|
||||
public void setTags(List<ResourceTagResponse> tags) {
|
||||
|
||||
@ -19,14 +19,13 @@ package org.apache.cloudstack.api.response;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
public class ServiceOfferingResponse extends BaseResponse {
|
||||
@SerializedName("id") @Param(description="the id of the service offering")
|
||||
private IdentityProxy id = new IdentityProxy("disk_offering");
|
||||
private String id;
|
||||
|
||||
@SerializedName("name") @Param(description="the name of the service offering")
|
||||
private String name;
|
||||
@ -59,7 +58,7 @@ public class ServiceOfferingResponse extends BaseResponse {
|
||||
private String tags;
|
||||
|
||||
@SerializedName("domainid") @Param(description="the domain id of the service offering")
|
||||
private IdentityProxy domainId = new IdentityProxy("domain");
|
||||
private String domainId;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN) @Param(description="Domain name for the offering")
|
||||
private String domain;
|
||||
@ -80,12 +79,12 @@ public class ServiceOfferingResponse extends BaseResponse {
|
||||
private Integer networkRate;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id.getValue();
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id.setValue(id);
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -195,12 +194,12 @@ public class ServiceOfferingResponse extends BaseResponse {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId.getValue();
|
||||
public String getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public void setDomainId(Long domainId) {
|
||||
this.domainId.setValue(domainId);
|
||||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
|
||||
@ -137,6 +137,7 @@ import com.cloud.network.security.dao.SecurityGroupDao;
|
||||
import com.cloud.network.vpc.StaticRouteVO;
|
||||
import com.cloud.network.vpc.VpcGatewayVO;
|
||||
import com.cloud.network.vpc.VpcManager;
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
import com.cloud.network.vpc.dao.StaticRouteDao;
|
||||
import com.cloud.network.vpc.dao.VpcGatewayDao;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
@ -218,6 +219,7 @@ import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
import com.cloud.network.vpc.dao.VpcDao;
|
||||
|
||||
public class ApiDBUtils {
|
||||
private static ManagementServer _ms;
|
||||
@ -302,6 +304,7 @@ public class ApiDBUtils {
|
||||
private static FirewallRulesDao _firewallRuleDao;
|
||||
private static StaticRouteDao _staticRouteDao;
|
||||
private static VpcGatewayDao _vpcGatewayDao;
|
||||
private static VpcDao _vpcDao;
|
||||
|
||||
static {
|
||||
_ms = (ManagementServer) ComponentLocator.getComponent(ManagementServer.Name);
|
||||
@ -385,6 +388,7 @@ public class ApiDBUtils {
|
||||
_vpcGatewayDao = locator.getDao(VpcGatewayDao.class);
|
||||
_asVmProfileDao = locator.getDao(AutoScaleVmProfileDao.class);
|
||||
_asVmGroupDao = locator.getDao(AutoScaleVmGroupDao.class);
|
||||
_vpcDao = locator.getDao(VpcDao.class);
|
||||
|
||||
// Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
|
||||
_statsCollector = StatsCollector.getInstance();
|
||||
@ -1020,6 +1024,10 @@ public class ApiDBUtils {
|
||||
public static GuestOSCategoryVO findGuestOsCategoryById(long catId){
|
||||
return _guestOSCategoryDao.findById(catId);
|
||||
}
|
||||
|
||||
public static VpcVO findVpcById(long vpcId){
|
||||
return _vpcDao.findById(vpcId);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Newly Added Utility Methods for List API refactoring //
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -156,6 +156,7 @@ import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.NetworkProfile;
|
||||
import com.cloud.network.NetworkVO;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||
@ -196,6 +197,7 @@ import com.cloud.network.vpc.StaticRouteVO;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.network.vpc.VpcGatewayVO;
|
||||
import com.cloud.network.vpc.VpcOffering;
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
@ -451,14 +453,17 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
@Override
|
||||
public DiskOfferingResponse createDiskOfferingResponse(DiskOffering offering) {
|
||||
DiskOfferingResponse diskOfferingResponse = new DiskOfferingResponse();
|
||||
diskOfferingResponse.setId(offering.getId());
|
||||
diskOfferingResponse.setId(offering.getUuid());
|
||||
diskOfferingResponse.setName(offering.getName());
|
||||
diskOfferingResponse.setDisplayText(offering.getDisplayText());
|
||||
diskOfferingResponse.setCreated(offering.getCreated());
|
||||
diskOfferingResponse.setDiskSize(offering.getDiskSize() / (1024 * 1024 * 1024));
|
||||
if (offering.getDomainId() != null) {
|
||||
diskOfferingResponse.setDomain(ApiDBUtils.findDomainById(offering.getDomainId()).getName());
|
||||
diskOfferingResponse.setDomainId(offering.getDomainId());
|
||||
Domain domain = ApiDBUtils.findDomainById(offering.getDomainId());
|
||||
if (domain != null) {
|
||||
diskOfferingResponse.setDomain(domain.getName());
|
||||
diskOfferingResponse.setDomainId(domain.getUuid());
|
||||
}
|
||||
}
|
||||
diskOfferingResponse.setTags(offering.getTags());
|
||||
diskOfferingResponse.setCustomized(offering.isCustomized());
|
||||
@ -507,7 +512,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
@Override
|
||||
public ServiceOfferingResponse createServiceOfferingResponse(ServiceOffering offering) {
|
||||
ServiceOfferingResponse offeringResponse = new ServiceOfferingResponse();
|
||||
offeringResponse.setId(offering.getId());
|
||||
offeringResponse.setId(offering.getUuid());
|
||||
offeringResponse.setName(offering.getName());
|
||||
offeringResponse.setIsSystemOffering(offering.getSystemUse());
|
||||
offeringResponse.setDefaultUse(offering.getDefaultUse());
|
||||
@ -522,8 +527,11 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
offeringResponse.setLimitCpuUse(offering.getLimitCpuUse());
|
||||
offeringResponse.setTags(offering.getTags());
|
||||
if (offering.getDomainId() != null) {
|
||||
offeringResponse.setDomain(ApiDBUtils.findDomainById(offering.getDomainId()).getName());
|
||||
offeringResponse.setDomainId(offering.getDomainId());
|
||||
Domain domain = ApiDBUtils.findDomainById(offering.getDomainId());
|
||||
if (domain != null) {
|
||||
offeringResponse.setDomain(domain.getName());
|
||||
offeringResponse.setDomainId(domain.getUuid());
|
||||
}
|
||||
}
|
||||
offeringResponse.setNetworkRate(offering.getRateMbps());
|
||||
offeringResponse.setHostTag(offering.getHostTag());
|
||||
@ -788,13 +796,16 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
long zoneId = ipAddr.getDataCenterId();
|
||||
|
||||
IPAddressResponse ipResponse = new IPAddressResponse();
|
||||
ipResponse.setId(ipAddr.getId());
|
||||
ipResponse.setId(ipAddr.getUuid());
|
||||
ipResponse.setIpAddress(ipAddr.getAddress().toString());
|
||||
if (ipAddr.getAllocatedTime() != null) {
|
||||
ipResponse.setAllocated(ipAddr.getAllocatedTime());
|
||||
}
|
||||
ipResponse.setZoneId(zoneId);
|
||||
ipResponse.setZoneName(ApiDBUtils.findZoneById(ipAddr.getDataCenterId()).getName());
|
||||
DataCenterVO zone = ApiDBUtils.findZoneById(ipAddr.getDataCenterId());
|
||||
if (zone != null) {
|
||||
ipResponse.setZoneId(zone.getUuid());
|
||||
ipResponse.setZoneName(zone.getName());
|
||||
}
|
||||
ipResponse.setSourceNat(ipAddr.isSourceNat());
|
||||
ipResponse.setIsSystem(ipAddr.getSystem());
|
||||
|
||||
@ -808,24 +819,34 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
|
||||
if (ipAddr.getAssociatedWithVmId() != null) {
|
||||
UserVm vm = ApiDBUtils.findUserVmById(ipAddr.getAssociatedWithVmId());
|
||||
ipResponse.setVirtualMachineId(vm.getId());
|
||||
ipResponse.setVirtualMachineName(vm.getHostName());
|
||||
if (vm.getDisplayName() != null) {
|
||||
ipResponse.setVirtualMachineDisplayName(vm.getDisplayName());
|
||||
} else {
|
||||
ipResponse.setVirtualMachineDisplayName(vm.getHostName());
|
||||
if (vm != null) {
|
||||
ipResponse.setVirtualMachineId(vm.getUuid());
|
||||
ipResponse.setVirtualMachineName(vm.getHostName());
|
||||
if (vm.getDisplayName() != null) {
|
||||
ipResponse.setVirtualMachineDisplayName(vm.getDisplayName());
|
||||
} else {
|
||||
ipResponse.setVirtualMachineDisplayName(vm.getHostName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ipAddr.getAssociatedWithNetworkId() != null) {
|
||||
Network ntwk = ApiDBUtils.findNetworkById(ipAddr.getAssociatedWithNetworkId());
|
||||
ipResponse.setAssociatedNetworkId(ipAddr.getAssociatedWithNetworkId());
|
||||
ipResponse.setAssociatedNetworkName(ntwk.getName());
|
||||
if (ntwk != null) {
|
||||
ipResponse.setAssociatedNetworkId(ntwk.getUuid());
|
||||
ipResponse.setAssociatedNetworkName(ntwk.getName());
|
||||
}
|
||||
}
|
||||
|
||||
ipResponse.setVpcId(ipAddr.getVpcId());
|
||||
if (ipAddr.getVpcId() != null) {
|
||||
VpcVO vpc = ApiDBUtils.findVpcById(ipAddr.getVpcId());
|
||||
if (vpc != null) {
|
||||
ipResponse.setVpcId(vpc.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
// Network id the ip is associated with (if associated networkId is null, try to get this information from vlan)
|
||||
// Network id the ip is associated with (if associated networkId is
|
||||
// null, try to get this information from vlan)
|
||||
Long vlanNetworkId = ApiDBUtils.getVlanNetworkId(ipAddr.getVlanId());
|
||||
|
||||
// Network id the ip belongs to
|
||||
@ -836,15 +857,29 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
networkId = ApiDBUtils.getPublicNetworkIdByZone(zoneId);
|
||||
}
|
||||
|
||||
ipResponse.setNetworkId(networkId);
|
||||
if (networkId != null) {
|
||||
NetworkVO nw = ApiDBUtils.findNetworkById(networkId);
|
||||
if (nw != null) {
|
||||
ipResponse.setNetworkId(nw.getUuid());
|
||||
}
|
||||
}
|
||||
ipResponse.setState(ipAddr.getState().toString());
|
||||
ipResponse.setPhysicalNetworkId(ipAddr.getPhysicalNetworkId());
|
||||
|
||||
if (ipAddr.getPhysicalNetworkId() != null) {
|
||||
PhysicalNetworkVO pnw = ApiDBUtils.findPhysicalNetworkById(ipAddr.getPhysicalNetworkId());
|
||||
if (pnw != null) {
|
||||
ipResponse.setPhysicalNetworkId(pnw.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
// show this info to admin only
|
||||
Account account = UserContext.current().getCaller();
|
||||
if (account.getType() == Account.ACCOUNT_TYPE_ADMIN) {
|
||||
ipResponse.setVlanId(ipAddr.getVlanId());
|
||||
ipResponse.setVlanName(ApiDBUtils.findVlanById(ipAddr.getVlanId()).getVlanTag());
|
||||
VlanVO vl = ApiDBUtils.findVlanById(ipAddr.getVlanId());
|
||||
if (vl != null) {
|
||||
ipResponse.setVlanId(vl.getUuid());
|
||||
ipResponse.setVlanName(vl.getVlanTag());
|
||||
}
|
||||
}
|
||||
|
||||
if (ipAddr.getSystem()) {
|
||||
@ -1297,7 +1332,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
@Override
|
||||
public FirewallRuleResponse createPortForwardingRuleResponse(PortForwardingRule fwRule) {
|
||||
FirewallRuleResponse response = new FirewallRuleResponse();
|
||||
response.setId(fwRule.getId());
|
||||
response.setId(fwRule.getUuid());
|
||||
response.setPrivateStartPort(Integer.toString(fwRule.getDestinationPortStart()));
|
||||
response.setPrivateEndPort(Integer.toString(fwRule.getDestinationPortEnd()));
|
||||
response.setProtocol(fwRule.getProtocol());
|
||||
@ -1307,13 +1342,13 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
response.setCidrList(StringUtils.join(cidrs, ","));
|
||||
|
||||
IpAddress ip = ApiDBUtils.findIpAddressById(fwRule.getSourceIpAddressId());
|
||||
response.setPublicIpAddressId(ip.getId());
|
||||
response.setPublicIpAddressId(ip.getUuid());
|
||||
response.setPublicIpAddress(ip.getAddress().addr());
|
||||
|
||||
if (ip != null && fwRule.getDestinationIpAddress() != null) {
|
||||
UserVm vm = ApiDBUtils.findUserVmById(fwRule.getVirtualMachineId());
|
||||
if (vm != null) {
|
||||
response.setVirtualMachineId(vm.getId());
|
||||
response.setVirtualMachineId(vm.getUuid());
|
||||
response.setVirtualMachineName(vm.getHostName());
|
||||
|
||||
if (vm.getDisplayName() != null) {
|
||||
@ -2758,7 +2793,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
public FirewallResponse createFirewallResponse(FirewallRule fwRule) {
|
||||
FirewallResponse response = new FirewallResponse();
|
||||
|
||||
response.setId(fwRule.getId());
|
||||
response.setId(fwRule.getUuid());
|
||||
response.setProtocol(fwRule.getProtocol());
|
||||
if (fwRule.getSourcePortStart() != null) {
|
||||
response.setStartPort(Integer.toString(fwRule.getSourcePortStart()));
|
||||
@ -2844,7 +2879,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
@Override
|
||||
public HypervisorCapabilitiesResponse createHypervisorCapabilitiesResponse(HypervisorCapabilities hpvCapabilities) {
|
||||
HypervisorCapabilitiesResponse hpvCapabilitiesResponse = new HypervisorCapabilitiesResponse();
|
||||
hpvCapabilitiesResponse.setId(hpvCapabilities.getId());
|
||||
hpvCapabilitiesResponse.setId(hpvCapabilities.getUuid());
|
||||
hpvCapabilitiesResponse.setHypervisor(hpvCapabilities.getHypervisorType());
|
||||
hpvCapabilitiesResponse.setHypervisorVersion(hpvCapabilities.getHypervisorVersion());
|
||||
hpvCapabilitiesResponse.setIsSecurityGroupEnabled(hpvCapabilities.isSecurityGroupEnabled());
|
||||
|
||||
@ -40,7 +40,7 @@ import com.cloud.utils.net.Ip;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name=("user_ip_address"))
|
||||
public class IPAddressVO implements IpAddress, Identity {
|
||||
public class IPAddressVO implements IpAddress {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
|
||||
@ -44,7 +44,7 @@ import com.cloud.utils.net.NetUtils;
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="networks")
|
||||
public class NetworkVO implements Network, Identity {
|
||||
public class NetworkVO implements Network {
|
||||
@Id
|
||||
@TableGenerator(name="networks_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="networks_seq", allocationSize=1)
|
||||
@Column(name="id")
|
||||
|
||||
@ -155,6 +155,12 @@ public class PublicIp implements PublicIpAddress {
|
||||
return _addr.getId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return _addr.getUuid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return _addr.getAddress().toString();
|
||||
|
||||
@ -44,7 +44,7 @@ import com.cloud.utils.net.NetUtils;
|
||||
@Table(name="firewall_rules")
|
||||
@Inheritance(strategy=InheritanceType.JOINED)
|
||||
@DiscriminatorColumn(name="purpose", discriminatorType=DiscriminatorType.STRING, length=32)
|
||||
public class FirewallRuleVO implements Identity, FirewallRule {
|
||||
public class FirewallRuleVO implements FirewallRule {
|
||||
protected final FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao = ComponentLocator.inject(FirewallRulesCidrsDaoImpl.class);
|
||||
|
||||
@Id
|
||||
|
||||
@ -22,6 +22,7 @@ import java.util.List;
|
||||
public class StaticNatRuleImpl implements StaticNatRule{
|
||||
long id;
|
||||
String xid;
|
||||
String uuid;
|
||||
String protocol;
|
||||
int portStart;
|
||||
int portEnd;
|
||||
@ -35,6 +36,7 @@ public class StaticNatRuleImpl implements StaticNatRule{
|
||||
public StaticNatRuleImpl(FirewallRuleVO rule, String dstIp) {
|
||||
this.id = rule.getId();
|
||||
this.xid = rule.getXid();
|
||||
this.uuid = rule.getUuid();
|
||||
this.protocol = rule.getProtocol();
|
||||
this.portStart = rule.getSourcePortStart();
|
||||
this.portEnd = rule.getSourcePortEnd();
|
||||
@ -106,6 +108,12 @@ public class StaticNatRuleImpl implements StaticNatRule{
|
||||
return xid;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getIcmpCode() {
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user