mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
ResourceMetaData: added support for userIpAddress (publicIp) metadata
This commit is contained in:
parent
31b439eab6
commit
8bd1eaa210
@ -35,7 +35,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
||||
PortForwardingRule (true, false),
|
||||
FirewallRule (true, true),
|
||||
SecurityGroup (true, false),
|
||||
PublicIpAddress (true, false),
|
||||
PublicIpAddress (true, true),
|
||||
Project (true, false),
|
||||
Vpc (true, false),
|
||||
NetworkACL (true, false),
|
||||
|
||||
@ -321,6 +321,8 @@
|
||||
<bean id="AffinityGroupVMMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDaoImpl" />
|
||||
<bean id="AffinityGroupDomainMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupDomainMapDaoImpl" />
|
||||
<bean id="FirewallRuleDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDaoImpl" />
|
||||
<bean id="UserIpAddressDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDaoImpl" />
|
||||
|
||||
|
||||
<bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />
|
||||
|
||||
|
||||
@ -28,53 +28,53 @@ import org.apache.cloudstack.api.ResourceDetail;
|
||||
@Entity
|
||||
@Table(name="firewall_rule_details")
|
||||
public class FirewallRuleDetailVO implements ResourceDetail{
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private long id;
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private long id;
|
||||
|
||||
@Column(name="firewall_rule_id")
|
||||
private long resourceId;
|
||||
@Column(name="firewall_rule_id")
|
||||
private long resourceId;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
|
||||
@Column(name="value", length=1024)
|
||||
private String value;
|
||||
|
||||
@Column(name="display")
|
||||
private boolean display;
|
||||
@Column(name="value", length=1024)
|
||||
private String value;
|
||||
|
||||
@Column(name="display")
|
||||
private boolean display;
|
||||
|
||||
public FirewallRuleDetailVO() {}
|
||||
public FirewallRuleDetailVO() {}
|
||||
|
||||
public FirewallRuleDetailVO(long networkId, String name, String value) {
|
||||
this.resourceId = networkId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
public FirewallRuleDetailVO(long networkId, String name, String value) {
|
||||
this.resourceId = networkId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
@Override
|
||||
public long getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplay() {
|
||||
return display;
|
||||
}
|
||||
@Override
|
||||
public boolean isDisplay() {
|
||||
return display;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
// 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="user_ip_address_details")
|
||||
public class UserIpAddressDetailVO implements ResourceDetail{
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private long id;
|
||||
|
||||
@Column(name="user_ip_address_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 UserIpAddressDetailVO() {}
|
||||
|
||||
public UserIpAddressDetailVO(long networkId, String name, String value) {
|
||||
this.resourceId = networkId;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -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.resourcedetail.dao;
|
||||
|
||||
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
|
||||
import org.apache.cloudstack.resourcedetail.UserIpAddressDetailVO;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface UserIpAddressDetailsDao extends GenericDao<UserIpAddressDetailVO, Long>, ResourceDetailsDao<UserIpAddressDetailVO>{
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
// 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.UserIpAddressDetailVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
@Local (value={UserIpAddressDetailsDao.class})
|
||||
public class UserIpAddressDetailsDaoImpl extends ResourceDetailsDaoBase<UserIpAddressDetailVO> implements UserIpAddressDetailsDao {
|
||||
|
||||
@Override
|
||||
public void addDetail(long resourceId, String key, String value) {
|
||||
super.addDetail(new UserIpAddressDetailVO(resourceId, key, value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.cloudstack.api.ResourceDetail;
|
||||
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
|
||||
import org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDao;
|
||||
import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -75,6 +76,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
||||
StoragePoolDetailsDao _storageDetailsDao;
|
||||
@Inject
|
||||
FirewallRuleDetailsDao _firewallRuleDetailsDao;
|
||||
@Inject
|
||||
UserIpAddressDetailsDao _userIpAddressDetailsDao;
|
||||
|
||||
private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> _daoMap=
|
||||
new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
|
||||
@ -91,7 +94,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
||||
_daoMap.put(ResourceObjectType.Zone, _dcDetailsDao);
|
||||
_daoMap.put(ResourceObjectType.Storage, _storageDetailsDao);
|
||||
_daoMap.put(ResourceObjectType.FirewallRule, _firewallRuleDetailsDao);
|
||||
|
||||
_daoMap.put(ResourceObjectType.PublicIpAddress, _userIpAddressDetailsDao);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -619,3 +619,13 @@ CREATE TABLE `cloud`.`usage_event_details` (
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_usage_event_details__usage_event_id` FOREIGN KEY `fk_usage_event_details__usage_event_id`(`usage_event_id`) REFERENCES `usage_event`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`user_ip_address_details` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`user_ip_address_id` bigint unsigned NOT NULL COMMENT 'User ip address 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_user_ip_address_details__user_ip_address_id` FOREIGN KEY `fk_user_ip_address_details__user_ip_address_id`(`user_ip_address_id`) REFERENCES `user_ip_address`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user