diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java index 6d18834c6b5..7ed6db54002 100644 --- a/api/src/com/cloud/server/ResourceTag.java +++ b/api/src/com/cloud/server/ResourceTag.java @@ -46,7 +46,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit ServiceOffering(false, true), Storage(false, true), PrivateGateway(false, true), - NetworkACLList(false, true); + NetworkACLList(false, true), + VpnGateway(false, true); ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) { this.resourceTagsSupport = resourceTagsSupport; diff --git a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml index e7caa203cc6..d9da3bd50c0 100644 --- a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml +++ b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml @@ -327,6 +327,7 @@ + diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnGatewayDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnGatewayDetailVO.java new file mode 100644 index 00000000000..244e218218a --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/Site2SiteVpnGatewayDetailVO.java @@ -0,0 +1,84 @@ +// 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.resourcedetail; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.ResourceDetail; + +@Entity +@Table(name = "s2s_vpn_gateway_details") +public class Site2SiteVpnGatewayDetailVO implements ResourceDetail { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "s2s_vpn_gateway_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value", length = 1024) + private String value; + + @Column(name = "display") + private boolean display; + + public Site2SiteVpnGatewayDetailVO() { + } + + public Site2SiteVpnGatewayDetailVO(long id, String name, String value) { + this.resourceId = id; + this.name = name; + this.value = value; + } + + @Override + public long getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getValue() { + return value; + } + + @Override + public long getResourceId() { + return resourceId; + } + + @Override + public boolean isDisplay() { + return display; + } +} + + + diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDao.java new file mode 100644 index 00000000000..12c181f9352 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDao.java @@ -0,0 +1,27 @@ +// 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.resourcedetail.dao; + +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; +import org.apache.cloudstack.resourcedetail.Site2SiteVpnGatewayDetailVO; + +import com.cloud.utils.db.GenericDao; + +public interface Site2SiteVpnGatewayDetailsDao extends GenericDao, ResourceDetailsDao { + +} + diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDaoImpl.java new file mode 100644 index 00000000000..8349ea8bd2a --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/Site2SiteVpnGatewayDetailsDaoImpl.java @@ -0,0 +1,33 @@ +// 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.resourcedetail.dao; + +import javax.ejb.Local; + +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.apache.cloudstack.resourcedetail.Site2SiteVpnGatewayDetailVO; +import org.springframework.stereotype.Component; + +@Component +@Local(value = { Site2SiteVpnGatewayDetailsDao.class }) +public class Site2SiteVpnGatewayDetailsDaoImpl extends ResourceDetailsDaoBase implements Site2SiteVpnGatewayDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value) { + super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value)); + } +} diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java index e1fc37fa2f7..c17f6d0555d 100644 --- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java +++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java @@ -30,6 +30,7 @@ import org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDao; import org.apache.cloudstack.resourcedetail.dao.NetworkACLItemDetailsDao; import org.apache.cloudstack.resourcedetail.dao.NetworkACLListDetailsDao; import org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDao; +import org.apache.cloudstack.resourcedetail.dao.Site2SiteVpnGatewayDetailsDao; import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao; import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao; import org.apache.cloudstack.resourcedetail.dao.VpcGatewayDetailsDao; @@ -92,6 +93,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource NetworkACLListDetailsDao _networkACLListDetailsDao; @Inject NetworkACLItemDetailsDao _networkACLDetailsDao; + @Inject + Site2SiteVpnGatewayDetailsDao _vpnGatewayDetailsDao; private static Map> _daoMap = @@ -116,6 +119,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource _daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDetailsDao); _daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDetailsDao); _daoMap.put(ResourceObjectType.NetworkACL, _networkACLDetailsDao); + _daoMap.put(ResourceObjectType.VpnGateway, _vpnGatewayDetailsDao); return true; } diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java index 6b52a97c07c..f178fc32fb8 100644 --- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java +++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java @@ -42,6 +42,7 @@ import com.cloud.network.dao.IPAddressDao; import com.cloud.network.dao.LoadBalancerDao; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.RemoteAccessVpnDao; +import com.cloud.network.dao.Site2SiteVpnGatewayDao; import com.cloud.network.rules.dao.PortForwardingRulesDao; import com.cloud.network.security.dao.SecurityGroupDao; import com.cloud.network.vpc.NetworkACLItemDao; @@ -138,6 +139,8 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso VpcGatewayDao _vpcGatewayDao; @Inject NetworkACLDao _networkACLListDao; + @Inject + Site2SiteVpnGatewayDao _vpnGatewayDao; @Override public boolean configure(String name, Map params) throws ConfigurationException { @@ -164,6 +167,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso _daoMap.put(ResourceObjectType.Storage, _storagePoolDao); _daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDao); _daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDao); + _daoMap.put(ResourceObjectType.VpnGateway, _vpnGatewayDao); return true; } diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql index ad80bfedd5f..6fbe309e6a4 100644 --- a/setup/db/db/schema-421to430.sql +++ b/setup/db/db/schema-421to430.sql @@ -837,3 +837,14 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSna INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.max", "10", "Maximum vm snapshots for a vm", NULL, NULL,NULL,0); UPDATE `cloud`.`configuration` SET `component` = 'VMSnapshotManager' WHERE `name` IN ("vmsnapshot.create.wait", "vmsnapshot.max"); + +CREATE TABLE `cloud`.`s2s_vpn_gateway_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `s2s_vpn_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_s2s_vpn_gateway_details__s2s_vpn_gateway_id` FOREIGN KEY `fk_s2s_vpn_gateway_details__s2s_vpn_gateway_id`(`s2s_vpn_gateway_id`) REFERENCES `s2s_vpn_gateway`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +