mirror of https://github.com/apache/cloudstack.git
add views for dns_server and dns_zone
This commit is contained in:
parent
1fe79bdfb6
commit
6ca9d5ace8
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
import org.apache.cloudstack.dns.DnsProviderType;
|
||||
import org.apache.cloudstack.dns.DnsServer;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
|
|
@ -49,7 +48,7 @@ public class DnsServerResponse extends BaseResponse {
|
|||
|
||||
@SerializedName(ApiConstants.PROVIDER)
|
||||
@Param(description = "The provider type of the DNS server")
|
||||
private DnsProviderType provider;
|
||||
private String provider;
|
||||
|
||||
@SerializedName(ApiConstants.IS_PUBLIC)
|
||||
@Param(description = "Is the DNS server publicly available")
|
||||
|
|
@ -63,6 +62,18 @@ public class DnsServerResponse extends BaseResponse {
|
|||
@Param(description = "Name servers entries associated to DNS server")
|
||||
private List<String> nameServers;
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT)
|
||||
@Param(description = "the account associated with the DNS server")
|
||||
private String accountName;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||
@Param(description = "the ID of the domain associated with the DNS server")
|
||||
private String domainId;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN)
|
||||
@Param(description = "the name of the domain associated with the DNS server")
|
||||
private String domainName;
|
||||
|
||||
public DnsServerResponse() {
|
||||
super();
|
||||
|
||||
|
|
@ -80,7 +91,7 @@ public class DnsServerResponse extends BaseResponse {
|
|||
this.url = url;
|
||||
}
|
||||
|
||||
public void setProvider(DnsProviderType provider) {
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
|
|
@ -99,4 +110,16 @@ public class DnsServerResponse extends BaseResponse {
|
|||
public void setNameServers(List<String> nameServers) {
|
||||
this.nameServers = nameServers;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public void setDomainName(String domainName) {
|
||||
this.domainName = domainName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,27 @@ public class DnsZoneResponse extends BaseResponse {
|
|||
|
||||
@SerializedName("dnsserverid")
|
||||
@Param(description = "ID of the DNS server this zone belongs to")
|
||||
private Long dnsServerId;
|
||||
private String dnsServerId;
|
||||
|
||||
@SerializedName("dnsservername")
|
||||
@Param(description = "the name of the DNS server hosting this zone")
|
||||
private String dnsServerName;
|
||||
|
||||
@SerializedName("dnsserveraccount")
|
||||
@Param(description = "the account name of the DNS server owner")
|
||||
private String dnsServerAccountName;
|
||||
|
||||
@SerializedName(ApiConstants.ACCOUNT)
|
||||
@Param(description = "the account associated with the DNS zone")
|
||||
private String accountName;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN)
|
||||
@Param(description = "the name of the domain associated with the DNS zone")
|
||||
private String domainName;
|
||||
|
||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||
@Param(description = "the ID of the domain associated with the DNS server")
|
||||
private String domainId;
|
||||
|
||||
@SerializedName(ApiConstants.NETWORK_ID)
|
||||
@Param(description = "ID of the network this zone is associated with")
|
||||
|
|
@ -68,7 +88,7 @@ public class DnsZoneResponse extends BaseResponse {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDnsServerId(Long dnsServerId) {
|
||||
public void setDnsServerId(String dnsServerId) {
|
||||
this.dnsServerId = dnsServerId;
|
||||
}
|
||||
|
||||
|
|
@ -95,4 +115,25 @@ public class DnsZoneResponse extends BaseResponse {
|
|||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setDnsServerName(String dnsServerName) {
|
||||
this.dnsServerName = dnsServerName;
|
||||
}
|
||||
|
||||
public void setDnsServerAccountName(String dnsServerAccountName) {
|
||||
this.dnsServerAccountName = dnsServerAccountName;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public void setDomainName(String domainName) {
|
||||
this.domainName = domainName;
|
||||
}
|
||||
|
||||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,4 +310,10 @@
|
|||
<bean id="gpuDeviceDaoImpl" class="com.cloud.gpu.dao.GpuDeviceDaoImpl" />
|
||||
<bean id="vgpuProfileDaoImpl" class="com.cloud.gpu.dao.VgpuProfileDaoImpl" />
|
||||
<bean id="importVMTaskDaoImpl" class="com.cloud.vm.dao.ImportVMTaskDaoImpl" />
|
||||
<bean id="dnsServerDao" class="org.apache.cloudstack.dns.dao.DnsServerDaoImpl" />
|
||||
<bean id="dnsZoneDao" class="org.apache.cloudstack.dns.dao.DnsZoneDaoImpl" />
|
||||
<bean id="dnsZoneNetworkMapDao" class="org.apache.cloudstack.dns.dao.DnsZoneNetworkMapDaoImpl" />
|
||||
<bean id="dnsServerJoinDao" class="org.apache.cloudstack.dns.dao.DnsServerJoinDaoImpl" />
|
||||
<bean id="dnsZoneJoinDao" class="org.apache.cloudstack.dns.dao.DnsZoneJoinDaoImpl" />
|
||||
|
||||
</beans>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
-- Licensed to the Apache Software Foundation (ASF) under one
|
||||
-- or more contributor license agreements. See the NOTICE file
|
||||
-- distributed with this work for additional information
|
||||
-- regarding copyright ownership. The ASF licenses this file
|
||||
-- to you under the Apache License, Version 2.0 (the
|
||||
-- "License"); you may not use this file except in compliance
|
||||
-- with the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing,
|
||||
-- software distributed under the License is distributed on an
|
||||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
-- KIND, either express or implied. See the License for the
|
||||
-- specific language governing permissions and limitations
|
||||
-- under the License.
|
||||
|
||||
-- VIEW `cloud`.`dns_server_view`;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`dns_server_view`;
|
||||
CREATE VIEW `cloud`.`dns_server_view` AS
|
||||
SELECT
|
||||
dns.id,
|
||||
dns.uuid,
|
||||
dns.name,
|
||||
dns.provider_type,
|
||||
dns.url,
|
||||
dns.port,
|
||||
dns.name_servers,
|
||||
dns.is_public,
|
||||
dns.public_domain_suffix,
|
||||
dns.state,
|
||||
dns.created,
|
||||
dns.removed,
|
||||
account.account_name account_name,
|
||||
domain.name domain_name,
|
||||
domain.uuid domain_uuid,
|
||||
domain.path domain_path
|
||||
FROM
|
||||
`cloud`.`dns_server` dns
|
||||
INNER JOIN
|
||||
`cloud`.`account` account ON dns.account_id = account.id
|
||||
INNER JOIN
|
||||
`cloud`.`domain` domain ON dns.domain_id = domain.id;
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
-- Licensed to the Apache Software Foundation (ASF) under one
|
||||
-- or more contributor license agreements. See the NOTICE file
|
||||
-- distributed with this work for additional information
|
||||
-- regarding copyright ownership. The ASF licenses this file
|
||||
-- to you under the Apache License, Version 2.0 (the
|
||||
-- "License"); you may not use this file except in compliance
|
||||
-- with the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing,
|
||||
-- software distributed under the License is distributed on an
|
||||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
-- KIND, either express or implied. See the License for the
|
||||
-- specific language governing permissions and limitations
|
||||
-- under the License.
|
||||
|
||||
-- VIEW `cloud`.`dns_zone_view`;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`dns_zone_view`;
|
||||
CREATE VIEW `cloud`.`dns_zone_view` AS
|
||||
SELECT
|
||||
zone.id,
|
||||
zone.uuid,
|
||||
zone.name,
|
||||
zone.dns_server_id,
|
||||
zone.state,
|
||||
zone.description,
|
||||
server.uuid dns_server_uuid,
|
||||
server.name dns_server_name,
|
||||
server_account.account_name dns_server_account_name,
|
||||
account.account_name account_name,
|
||||
domain.name domain_name,
|
||||
domain.uuid domain_uuid,
|
||||
domain.path domain_path
|
||||
FROM
|
||||
`cloud`.`dns_zone` zone
|
||||
INNER JOIN
|
||||
`cloud`.`dns_server` server ON zone.dns_server_id = server.id
|
||||
INNER JOIN
|
||||
`cloud`.`account` server_account ON server.account_id = server_account.id
|
||||
INNER JOIN
|
||||
`cloud`.`account` account ON zone.account_id = account.id
|
||||
INNER JOIN
|
||||
`cloud`.`domain` domain ON zone.domain_id = domain.id;
|
||||
|
|
@ -47,9 +47,14 @@ import org.apache.cloudstack.api.response.DnsZoneResponse;
|
|||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.dns.dao.DnsServerDao;
|
||||
import org.apache.cloudstack.dns.dao.DnsServerJoinDao;
|
||||
import org.apache.cloudstack.dns.dao.DnsZoneDao;
|
||||
import org.apache.cloudstack.dns.dao.DnsZoneJoinDao;
|
||||
import org.apache.cloudstack.dns.dao.DnsZoneNetworkMapDao;
|
||||
import org.apache.cloudstack.dns.exception.DnsNotFoundException;
|
||||
import org.apache.cloudstack.dns.vo.DnsServerJoinVO;
|
||||
import org.apache.cloudstack.dns.vo.DnsServerVO;
|
||||
import org.apache.cloudstack.dns.vo.DnsZoneJoinVO;
|
||||
import org.apache.cloudstack.dns.vo.DnsZoneNetworkMapVO;
|
||||
import org.apache.cloudstack.dns.vo.DnsZoneVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -95,6 +100,10 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
NicDao nicDao;
|
||||
@Inject
|
||||
DomainDao domainDao;
|
||||
@Inject
|
||||
DnsZoneJoinDao dnsZoneJoinDao;
|
||||
@Inject
|
||||
DnsServerJoinDao dnsServerJoinDao;
|
||||
|
||||
private DnsProvider getProviderByType(DnsProviderType type) {
|
||||
if (type == null) {
|
||||
|
|
@ -149,9 +158,14 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
@Override
|
||||
public ListResponse<DnsServerResponse> listDnsServers(ListDnsServersCmd cmd) {
|
||||
Pair<List<DnsServerVO>, Integer> result = searchForDnsServerInternal(cmd);
|
||||
List<String> serverIds = new ArrayList<>();
|
||||
for (DnsServer server : result.first()) {
|
||||
serverIds.add(server.getUuid());
|
||||
}
|
||||
List<DnsServerJoinVO> joinResult = dnsServerJoinDao.listByUuids(serverIds);
|
||||
ListResponse<DnsServerResponse> response = new ListResponse<>();
|
||||
List<DnsServerResponse> serverResponses = new ArrayList<>();
|
||||
for (DnsServerVO server : result.first()) {
|
||||
for (DnsServerJoinVO server : joinResult) {
|
||||
serverResponses.add(createDnsServerResponse(server));
|
||||
}
|
||||
response.setResponses(serverResponses, result.second());
|
||||
|
|
@ -186,9 +200,7 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
SearchCriteria<DnsServerVO> sc = sb.create();
|
||||
accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccountIds, listProjectResourcesCriteria);
|
||||
sc.setParameters(ApiConstants.STATE, DnsServer.State.Enabled);
|
||||
if (cmd.getProviderType() != null) {
|
||||
sc.setParameters(ApiConstants.PROVIDER_TYPE, cmd.getProviderType());
|
||||
}
|
||||
sc.setParameters(ApiConstants.PROVIDER_TYPE, cmd.getProviderType());
|
||||
|
||||
Pair<List<DnsServerVO>, Integer> ownServersPair = dnsServerDao.searchAndCount(sc, searchFilter);
|
||||
List<DnsServerVO> dnsServers = new ArrayList<>(ownServersPair.first());
|
||||
|
|
@ -206,9 +218,7 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
publicSc.setParameters(ApiConstants.IS_PUBLIC, 1);
|
||||
publicSc.setParameters(ApiConstants.DOMAIN_IDS, parentDomainIds.toArray());
|
||||
publicSc.setParameters(ApiConstants.STATE, DnsServer.State.Enabled);
|
||||
if (cmd.getProviderType() != null) {
|
||||
publicSc.setParameters(ApiConstants.PROVIDER_TYPE, cmd.getProviderType());
|
||||
}
|
||||
publicSc.setParameters(ApiConstants.PROVIDER_TYPE, cmd.getProviderType());
|
||||
List<DnsServerVO> publicServers = dnsServerDao.search(publicSc, null);
|
||||
List<Long> ownServerIds = dnsServers.stream().map(DnsServerVO::getId).collect(Collectors.toList());
|
||||
for (DnsServerVO publicServer : publicServers) {
|
||||
|
|
@ -305,21 +315,6 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
return dnsServerDao.remove(dnsServerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DnsServerResponse createDnsServerResponse(DnsServer server) {
|
||||
DnsServerResponse response = new DnsServerResponse();
|
||||
response.setId(server.getUuid());
|
||||
response.setName(server.getName());
|
||||
response.setUrl(server.getUrl());
|
||||
response.setPort(server.getPort());
|
||||
response.setProvider(server.getProviderType());
|
||||
response.setPublic(server.isPublicServer());
|
||||
response.setNameServers(server.getNameServers());
|
||||
response.setPublicDomainSuffix(server.getPublicDomainSuffix());
|
||||
response.setObjectName("dnsserver");
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteDnsZone(Long zoneId) {
|
||||
DnsZoneVO zone = dnsZoneDao.findById(zoneId);
|
||||
|
|
@ -376,10 +371,14 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
@Override
|
||||
public ListResponse<DnsZoneResponse> listDnsZones(ListDnsZonesCmd cmd) {
|
||||
Pair<List<DnsZoneVO>, Integer> result = searchForDnsZonesInternal(cmd);
|
||||
|
||||
List<DnsZoneResponse> zoneResponses = new ArrayList<>();
|
||||
List<String> zoneIds = new ArrayList<>();
|
||||
for (DnsZoneVO zone : result.first()) {
|
||||
zoneResponses.add(createDnsZoneResponse(zone));
|
||||
zoneIds.add(zone.getUuid());
|
||||
}
|
||||
List<DnsZoneJoinVO> zoneJoinVos = dnsZoneJoinDao.listByUuids(zoneIds);
|
||||
List<DnsZoneResponse> zoneResponses = new ArrayList<>();
|
||||
for (DnsZoneJoinVO zoneJoin: zoneJoinVos) {
|
||||
zoneResponses.add(createDnsZoneResponse(zoneJoin));
|
||||
}
|
||||
ListResponse<DnsZoneResponse> response = new ListResponse<>();
|
||||
response.setResponses(zoneResponses, result.second());
|
||||
|
|
@ -484,6 +483,9 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
ListResponse<DnsRecordResponse> listResponse = new ListResponse<>();
|
||||
listResponse.setResponses(responses, responses.size());
|
||||
return listResponse;
|
||||
} catch (DnsNotFoundException ex) {
|
||||
logger.error("DNS zone is not found", ex);
|
||||
throw new CloudRuntimeException("DNS zone is not found, please register it first");
|
||||
} catch (Exception ex) {
|
||||
logger.error("Failed to list DNS records from provider", ex);
|
||||
throw new CloudRuntimeException("Failed to fetch DNS records");
|
||||
|
|
@ -551,16 +553,48 @@ public class DnsProviderManagerImpl extends ManagerBase implements DnsProviderMa
|
|||
return dnsZone;
|
||||
}
|
||||
|
||||
|
||||
public DnsServerResponse createDnsServerResponse(DnsServer dnsServer) {
|
||||
DnsServerJoinVO serverJoin = dnsServerJoinDao.findById(dnsServer.getId());
|
||||
return createDnsServerResponse(serverJoin);
|
||||
}
|
||||
|
||||
DnsServerResponse createDnsServerResponse(DnsServerJoinVO server) {
|
||||
DnsServerResponse response = new DnsServerResponse();
|
||||
response.setId(server.getUuid());
|
||||
response.setName(server.getName());
|
||||
response.setUrl(server.getUrl());
|
||||
response.setPort(server.getPort());
|
||||
response.setProvider(server.getProviderType());
|
||||
response.setPublic(server.isPublicServer());
|
||||
response.setNameServers(server.getNameServers());
|
||||
response.setPublicDomainSuffix(server.getPublicDomainSuffix());
|
||||
response.setAccountName(server.getAccountName());
|
||||
response.setDomainId(server.getDomainUuid()); // Note: APIs always return UUIDs, not internal DB IDs!
|
||||
response.setDomainName(server.getDomainName());
|
||||
response.setObjectName("dnsserver");
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DnsZoneResponse createDnsZoneResponse(DnsZone zone) {
|
||||
DnsZoneResponse res = new DnsZoneResponse();
|
||||
res.setName(zone.getName());
|
||||
res.setDnsServerId(zone.getDnsServerId());
|
||||
res.setType(zone.getType());
|
||||
res.setState(zone.getState());
|
||||
res.setId(zone.getUuid());
|
||||
res.setDescription(zone.getDescription());
|
||||
return res;
|
||||
public DnsZoneResponse createDnsZoneResponse(DnsZone dnsZone) {
|
||||
DnsZoneJoinVO zoneJoinVO = dnsZoneJoinDao.findById(dnsZone.getId());
|
||||
return createDnsZoneResponse(zoneJoinVO);
|
||||
}
|
||||
|
||||
DnsZoneResponse createDnsZoneResponse(DnsZoneJoinVO zone) {
|
||||
DnsZoneResponse response = new DnsZoneResponse();
|
||||
response.setId(zone.getUuid());
|
||||
response.setName(zone.getName());
|
||||
response.setDnsServerId(zone.getDnsServerUuid());
|
||||
response.setAccountName(zone.getAccountName());
|
||||
response.setDomainId(zone.getDomainUuid());
|
||||
response.setDomainName(zone.getDomainName());
|
||||
response.setDnsServerName(zone.getDnsServerName());
|
||||
response.setDnsServerAccountName(zone.getDnsServerAccountName());
|
||||
response.setState(zone.getState());
|
||||
response.setDescription(zone.getDescription());
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.dns.dao;
|
||||
|
||||
import org.apache.cloudstack.dns.vo.DnsServerJoinVO;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface DnsServerJoinDao extends GenericDao<DnsServerJoinVO, Long> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.dns.dao;
|
||||
|
||||
import org.apache.cloudstack.dns.vo.DnsServerJoinVO;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
|
||||
public class DnsServerJoinDaoImpl extends GenericDaoBase<DnsServerJoinVO, Long> implements DnsServerJoinDao {
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.dns.dao;
|
||||
|
||||
import org.apache.cloudstack.dns.vo.DnsZoneJoinVO;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface DnsZoneJoinDao extends GenericDao<DnsZoneJoinVO, Long> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.dns.dao;
|
||||
|
||||
import org.apache.cloudstack.dns.vo.DnsZoneJoinVO;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
|
||||
public class DnsZoneJoinDaoImpl extends GenericDaoBase<DnsZoneJoinVO, Long> implements DnsZoneJoinDao {
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cloudstack.dns.vo;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
import org.apache.cloudstack.dns.DnsServer;
|
||||
|
||||
import com.cloud.api.query.vo.BaseViewVO;
|
||||
import com.cloud.utils.StringUtils;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dns_server_view")
|
||||
public class DnsServerJoinVO extends BaseViewVO implements InternalIdentity, Identity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private long id;
|
||||
|
||||
@Column(name = "uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "provider_type")
|
||||
private String providerType;
|
||||
|
||||
@Column(name = "url")
|
||||
private String url;
|
||||
|
||||
@Column(name = "port")
|
||||
private Integer port;
|
||||
|
||||
@Column(name = "name_servers")
|
||||
private String nameServers;
|
||||
|
||||
@Column(name = "is_public")
|
||||
private boolean isPublic;
|
||||
|
||||
@Column(name = "public_domain_suffix")
|
||||
private String publicDomainSuffix;
|
||||
|
||||
@Column(name = "state")
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
private DnsServer.State state;
|
||||
|
||||
@Column(name = "account_name")
|
||||
private String accountName;
|
||||
|
||||
@Column(name = "domain_name")
|
||||
private String domainName;
|
||||
|
||||
@Column(name = "domain_uuid")
|
||||
private String domainUuid;
|
||||
|
||||
@Column(name = "domain_path")
|
||||
private String domainPath;
|
||||
|
||||
public DnsServerJoinVO() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getProviderType() {
|
||||
return providerType;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public List<String> getNameServers() {
|
||||
if (StringUtils.isBlank(nameServers)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return Arrays.asList(nameServers.split(","));
|
||||
}
|
||||
|
||||
public boolean isPublicServer() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public String getPublicDomainSuffix() {
|
||||
return publicDomainSuffix;
|
||||
}
|
||||
|
||||
public DnsServer.State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public String getDomainName() {
|
||||
return domainName;
|
||||
}
|
||||
|
||||
public String getDomainPath() {
|
||||
return domainPath;
|
||||
}
|
||||
|
||||
public String getDomainUuid() {
|
||||
return domainUuid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cloudstack.dns.vo;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
import org.apache.cloudstack.dns.DnsZone;
|
||||
|
||||
import com.cloud.api.query.vo.BaseViewVO;
|
||||
|
||||
@Entity
|
||||
@Table(name = "dns_zone_view")
|
||||
public class DnsZoneJoinVO extends BaseViewVO implements InternalIdentity, Identity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private long id;
|
||||
|
||||
@Column(name = "uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "state")
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
private DnsZone.State state;
|
||||
|
||||
@Column(name = "dns_server_uuid")
|
||||
private String dnsServerUuid;
|
||||
|
||||
@Column(name = "dns_server_name")
|
||||
private String dnsServerName;
|
||||
|
||||
@Column(name = "dns_server_account_name")
|
||||
private String dnsServerAccountName;
|
||||
|
||||
@Column(name = "account_name")
|
||||
private String accountName;
|
||||
|
||||
@Column(name = "domain_name")
|
||||
private String domainName;
|
||||
|
||||
@Column(name = "domain_uuid")
|
||||
private String domainUuid;
|
||||
|
||||
@Column(name = "domain_path")
|
||||
private String domainPath;
|
||||
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public DnsZone.State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public String getDnsServerUuid() {
|
||||
return dnsServerUuid;
|
||||
}
|
||||
|
||||
public String getDnsServerName() {
|
||||
return dnsServerName;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public String getDomainName() {
|
||||
return domainName;
|
||||
}
|
||||
|
||||
public String getDomainPath() {
|
||||
return domainPath;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDnsServerAccountName() {
|
||||
return dnsServerAccountName;
|
||||
}
|
||||
|
||||
public String getDomainUuid() {
|
||||
return domainUuid;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -399,10 +399,6 @@
|
|||
<bean id="ExtensionResourceMapDaoImpl" class="org.apache.cloudstack.hypervisor.external.provisioner.dao.ExtensionResourceMapDaoImpl" />
|
||||
<bean id="ExtensionResourceMapDetailsDaoImpl" class="org.apache.cloudstack.hypervisor.external.provisioner.dao.ExtensionResourceMapDetailsDaoImpl" />
|
||||
|
||||
<bean id="dnsServerDao" class="org.apache.cloudstack.dns.dao.DnsServerDaoImpl" />
|
||||
<bean id="dnsZoneDao" class="org.apache.cloudstack.dns.dao.DnsZoneDaoImpl" />
|
||||
<bean id="dnsZoneNetworkMapDao" class="org.apache.cloudstack.dns.dao.DnsZoneNetworkMapDaoImpl" />
|
||||
|
||||
<bean id="dnsProviderManager" class="org.apache.cloudstack.dns.DnsProviderManagerImpl" >
|
||||
<property name="dnsProviders" value="#{dnsProvidersRegistry.registered}" />
|
||||
</bean>
|
||||
|
|
|
|||
Loading…
Reference in New Issue