use of com.cloud.network.vpc.VpcServiceMapVO in project cloudstack by apache.
the class VpcServiceMapDaoImpl method getProviderForServiceInVpc.
@Override
public String getProviderForServiceInVpc(long vpcId, Service service) {
SearchCriteria<VpcServiceMapVO> sc = AllFieldsSearch.create();
sc.setParameters("vpcId", vpcId);
sc.setParameters("service", service.getName());
VpcServiceMapVO ntwkSvc = findOneBy(sc);
if (ntwkSvc == null) {
throw new UnsupportedServiceException("Service " + service.getName() + " is not supported in the vpc id=" + vpcId);
}
return ntwkSvc.getProvider();
}
use of com.cloud.network.vpc.VpcServiceMapVO in project cloudstack by apache.
the class VpcDaoImpl method persistVpcServiceProviders.
@Override
@DB
public void persistVpcServiceProviders(long vpcId, Map<String, List<String>> serviceProviderMap) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
for (String service : serviceProviderMap.keySet()) {
for (String provider : serviceProviderMap.get(service)) {
VpcServiceMapVO serviceMap = new VpcServiceMapVO(vpcId, Network.Service.getService(service), Network.Provider.getProvider(provider));
_vpcSvcMap.persist(serviceMap);
}
}
txn.commit();
}
Aggregations