Skip to content

Commit 93fd323

Browse files
author
Alena Prokharchyk
committed
Resource metadata support for Site2SiteVpnGateway
1 parent a11730f commit 93fd323

8 files changed

Lines changed: 165 additions & 1 deletion

File tree

‎api/src/com/cloud/server/ResourceTag.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public enum ResourceObjectType {
4747
ServiceOffering(false, true),
4848
Storage(false, true),
4949
PrivateGateway(false, true),
50-
NetworkACLList(false, true);
50+
NetworkACLList(false, true),
51+
VpnGateway(false, true);
5152

5253
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
5354
this.resourceTagsSupport = resourceTagsSupport;

‎engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@
328328
<bean id="VpcGatewayDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.VpcGatewayDetailsDaoImpl" />
329329
<bean id="NetworkACLListDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.NetworkACLListDetailsDaoImpl" />
330330
<bean id="NetworkACLItemDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.NetworkACLItemDetailsDaoImpl" />
331+
<bean id="Site2SiteVpnGatewayDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.Site2SiteVpnGatewayDetailsDaoImpl" />
331332

332333
<bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />
333334

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.resourcedetail;
18+
19+
import javax.persistence.Column;
20+
import javax.persistence.Entity;
21+
import javax.persistence.GeneratedValue;
22+
import javax.persistence.GenerationType;
23+
import javax.persistence.Id;
24+
import javax.persistence.Table;
25+
26+
import org.apache.cloudstack.api.ResourceDetail;
27+
28+
@Entity
29+
@Table(name = "s2s_vpn_gateway_details")
30+
public class Site2SiteVpnGatewayDetailVO implements ResourceDetail {
31+
@Id
32+
@GeneratedValue(strategy = GenerationType.IDENTITY)
33+
@Column(name = "id")
34+
private long id;
35+
36+
@Column(name = "s2s_vpn_gateway_id")
37+
private long resourceId;
38+
39+
@Column(name = "name")
40+
private String name;
41+
42+
@Column(name = "value", length = 1024)
43+
private String value;
44+
45+
@Column(name = "display")
46+
private boolean display;
47+
48+
public Site2SiteVpnGatewayDetailVO() {
49+
}
50+
51+
public Site2SiteVpnGatewayDetailVO(long id, String name, String value) {
52+
this.resourceId = id;
53+
this.name = name;
54+
this.value = value;
55+
}
56+
57+
@Override
58+
public long getId() {
59+
return id;
60+
}
61+
62+
@Override
63+
public String getName() {
64+
return name;
65+
}
66+
67+
@Override
68+
public String getValue() {
69+
return value;
70+
}
71+
72+
@Override
73+
public long getResourceId() {
74+
return resourceId;
75+
}
76+
77+
@Override
78+
public boolean isDisplay() {
79+
return display;
80+
}
81+
}
82+
83+
84+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.resourcedetail.dao;
18+
19+
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
20+
import org.apache.cloudstack.resourcedetail.Site2SiteVpnGatewayDetailVO;
21+
22+
import com.cloud.utils.db.GenericDao;
23+
24+
public interface Site2SiteVpnGatewayDetailsDao extends GenericDao<Site2SiteVpnGatewayDetailVO, Long>, ResourceDetailsDao<Site2SiteVpnGatewayDetailVO> {
25+
26+
}
27+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.resourcedetail.dao;
18+
19+
import javax.ejb.Local;
20+
21+
import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
22+
import org.apache.cloudstack.resourcedetail.Site2SiteVpnGatewayDetailVO;
23+
import org.springframework.stereotype.Component;
24+
25+
@Component
26+
@Local(value = { Site2SiteVpnGatewayDetailsDao.class })
27+
public class Site2SiteVpnGatewayDetailsDaoImpl extends ResourceDetailsDaoBase<Site2SiteVpnGatewayDetailVO> implements Site2SiteVpnGatewayDetailsDao {
28+
29+
@Override
30+
public void addDetail(long resourceId, String key, String value) {
31+
super.addDetail(new Site2SiteVpnGatewayDetailVO(resourceId, key, value));
32+
}
33+
}

‎server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.cloudstack.resourcedetail.dao.NetworkACLItemDetailsDao;
3131
import org.apache.cloudstack.resourcedetail.dao.NetworkACLListDetailsDao;
3232
import org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDao;
33+
import org.apache.cloudstack.resourcedetail.dao.Site2SiteVpnGatewayDetailsDao;
3334
import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
3435
import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
3536
import org.apache.cloudstack.resourcedetail.dao.VpcGatewayDetailsDao;
@@ -93,6 +94,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
9394
NetworkACLListDetailsDao _networkACLListDetailsDao;
9495
@Inject
9596
NetworkACLItemDetailsDao _networkACLDetailsDao;
97+
@Inject
98+
Site2SiteVpnGatewayDetailsDao _vpnGatewayDetailsDao;
9699

97100

98101
private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> _daoMap =
@@ -117,6 +120,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
117120
_daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDetailsDao);
118121
_daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDetailsDao);
119122
_daoMap.put(ResourceObjectType.NetworkACL, _networkACLDetailsDao);
123+
_daoMap.put(ResourceObjectType.VpnGateway, _vpnGatewayDetailsDao);
120124

121125
return true;
122126
}

‎server/src/com/cloud/tags/TaggedResourceManagerImpl.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import com.cloud.network.dao.LoadBalancerDao;
4343
import com.cloud.network.dao.NetworkDao;
4444
import com.cloud.network.dao.RemoteAccessVpnDao;
45+
import com.cloud.network.dao.Site2SiteVpnGatewayDao;
4546
import com.cloud.network.rules.dao.PortForwardingRulesDao;
4647
import com.cloud.network.security.dao.SecurityGroupDao;
4748
import com.cloud.network.vpc.NetworkACLItemDao;
@@ -140,6 +141,8 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
140141
VpcGatewayDao _vpcGatewayDao;
141142
@Inject
142143
NetworkACLDao _networkACLListDao;
144+
@Inject
145+
Site2SiteVpnGatewayDao _vpnGatewayDao;
143146

144147

145148
@Override
@@ -167,6 +170,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
167170
_daoMap.put(ResourceObjectType.Storage, _storagePoolDao);
168171
_daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDao);
169172
_daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDao);
173+
_daoMap.put(ResourceObjectType.VpnGateway, _vpnGatewayDao);
170174

171175
return true;
172176
}

‎setup/db/db/schema-421to430.sql‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,3 +804,13 @@ CREATE TABLE `cloud`.`network_acl_item_details` (
804804
ALTER TABLE `cloud`.`alert` ADD COLUMN `name` varchar(255) DEFAULT NULL COMMENT 'name of the alert';
805805

806806
UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit`=13 WHERE `hypervisor_type`='Vmware';
807+
808+
CREATE TABLE `cloud`.`s2s_vpn_gateway_details` (
809+
`id` bigint unsigned NOT NULL auto_increment,
810+
`s2s_vpn_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
811+
`name` varchar(255) NOT NULL,
812+
`value` varchar(1024) NOT NULL,
813+
`display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user',
814+
PRIMARY KEY (`id`),
815+
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
816+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

0 commit comments

Comments
 (0)