use of com.cloud.legacymodel.user.Account in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createExtractResponse.
// TODO: we need to deprecate uploadVO, since extract is done in a synchronous fashion
@Override
public ExtractResponse createExtractResponse(final Long id, final Long zoneId, final Long accountId, final String mode, final String url) {
final ExtractResponse response = new ExtractResponse();
response.setObjectName("template");
final VMTemplateVO template = ApiDBUtils.findTemplateById(id);
response.setId(template.getUuid());
response.setName(template.getName());
if (zoneId != null) {
final DataCenter zone = ApiDBUtils.findZoneById(zoneId);
response.setZoneId(zone.getUuid());
response.setZoneName(zone.getName());
}
response.setMode(mode);
response.setUrl(url);
response.setState(UploadStatus.DOWNLOAD_URL_CREATED.toString());
final Account account = ApiDBUtils.findAccountById(accountId);
response.setAccountId(account.getUuid());
return response;
}
use of com.cloud.legacymodel.user.Account in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createAffinityGroupResponse.
@Override
public AffinityGroupResponse createAffinityGroupResponse(final AffinityGroup group) {
final AffinityGroupResponse response = new AffinityGroupResponse();
final Account account = ApiDBUtils.findAccountById(group.getAccountId());
response.setId(group.getUuid());
response.setAccountName(account.getAccountName());
response.setName(group.getName());
response.setType(group.getType());
response.setDescription(group.getDescription());
final Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
if (domain != null) {
response.setDomainId(domain.getUuid());
response.setDomainName(domain.getName());
}
response.setObjectName("affinitygroup");
return response;
}
use of com.cloud.legacymodel.user.Account in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createResourceCountResponse.
@Override
public ResourceCountResponse createResourceCountResponse(final ResourceCount resourceCount) {
final ResourceCountResponse resourceCountResponse = new ResourceCountResponse();
if (resourceCount.getResourceOwnerType() == ResourceOwnerType.Account) {
final Account accountTemp = ApiDBUtils.findAccountById(resourceCount.getOwnerId());
if (accountTemp != null) {
populateAccount(resourceCountResponse, accountTemp.getId());
populateDomain(resourceCountResponse, accountTemp.getDomainId());
}
} else if (resourceCount.getResourceOwnerType() == ResourceOwnerType.Domain) {
populateDomain(resourceCountResponse, resourceCount.getOwnerId());
}
resourceCountResponse.setResourceType(Integer.toString(resourceCount.getType().getOrdinal()));
resourceCountResponse.setResourceCount(resourceCount.getCount());
resourceCountResponse.setObjectName("resourcecount");
return resourceCountResponse;
}
use of com.cloud.legacymodel.user.Account in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createSSHKeyPairResponse.
@Override
public SSHKeyPairResponse createSSHKeyPairResponse(final SSHKeyPair sshkeyPair, final boolean privatekey) {
SSHKeyPairResponse response = new SSHKeyPairResponse(sshkeyPair.getName(), sshkeyPair.getFingerprint());
if (privatekey) {
response = new CreateSSHKeyPairResponse(sshkeyPair.getName(), sshkeyPair.getFingerprint(), sshkeyPair.getPrivateKey());
}
final Account account = ApiDBUtils.findAccountById(sshkeyPair.getAccountId());
response.setAccountName(account.getAccountName());
final Domain domain = ApiDBUtils.findDomainById(sshkeyPair.getDomainId());
response.setDomainId(domain.getUuid());
response.setDomainName(domain.getName());
return response;
}
use of com.cloud.legacymodel.user.Account in project cosmic by MissionCriticalCloud.
the class ApiResponseHelper method createDedicatedGuestVlanRangeResponse.
@Override
public GuestVlanRangeResponse createDedicatedGuestVlanRangeResponse(final GuestVlan vlan) {
final GuestVlanRangeResponse guestVlanRangeResponse = new GuestVlanRangeResponse();
guestVlanRangeResponse.setId(vlan.getUuid());
final Long accountId = ApiDBUtils.getAccountIdForGuestVlan(vlan.getId());
final Account owner = ApiDBUtils.findAccountById(accountId);
if (owner != null) {
populateAccount(guestVlanRangeResponse, owner.getId());
populateDomain(guestVlanRangeResponse, owner.getDomainId());
}
guestVlanRangeResponse.setGuestVlanRange(vlan.getGuestVlanRange());
guestVlanRangeResponse.setPhysicalNetworkId(vlan.getPhysicalNetworkId());
final PhysicalNetworkVO physicalNetwork = ApiDBUtils.findPhysicalNetworkById(vlan.getPhysicalNetworkId());
guestVlanRangeResponse.setZoneId(physicalNetwork.getDataCenterId());
return guestVlanRangeResponse;
}
Aggregations