本文整理汇总了Java中org.osc.sdk.manager.element.SecurityGroupInterfaceElement类的典型用法代码示例。如果您正苦于以下问题:Java SecurityGroupInterfaceElement类的具体用法?Java SecurityGroupInterfaceElement怎么用?Java SecurityGroupInterfaceElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SecurityGroupInterfaceElement类属于org.osc.sdk.manager.element包,在下文中一共展示了SecurityGroupInterfaceElement类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSecurityGroupInterface
import org.osc.sdk.manager.element.SecurityGroupInterfaceElement; //导入依赖的package包/类
@Override
public String createSecurityGroupInterface(SecurityGroupInterfaceElement sgiElement) throws Exception {
DeviceEntity device = this.validationUtil.getDeviceOrThrow(this.vs.getMgrId());
SecurityGroupInterfaceEntity existingSGI = findSecurityGroupInterfaceEntityByName(sgiElement.getName(), device);
if (existingSGI != null) {
throw new IllegalStateException(
String.format("Security Group interface with name %s already exists", sgiElement.getName()));
}
String mgrSecurityGroupId = sgiElement.getManagerSecurityGroupId();
@SuppressWarnings("resource")
SecurityGroupEntity sg = (SecurityGroupEntity) new IsmSecurityGroupApi(this.vs, this.txControl, this.em)
.getSecurityGroupById(mgrSecurityGroupId);
Set<PolicyEntity> policies = getPoliciesById(sgiElement);
return this.txControl.required(() -> {
SecurityGroupInterfaceEntity newSGI = new SecurityGroupInterfaceEntity(sgiElement.getName(), policies,
sgiElement.getTag(), sg, device);
IsmSecurityGroupInterfaceApi.this.em.persist(newSGI);
return newSGI.getSecurityGroupInterfaceId();
});
}
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:25,代码来源:IsmSecurityGroupInterfaceApi.java
示例2: updateSecurityGroupInterface
import org.osc.sdk.manager.element.SecurityGroupInterfaceElement; //导入依赖的package包/类
@Override
public void updateSecurityGroupInterface(SecurityGroupInterfaceElement sgiElement) throws Exception {
SecurityGroupInterfaceEntity existingSgi = (SecurityGroupInterfaceEntity) getSecurityGroupInterfaceById(
sgiElement.getManagerSecurityGroupInterfaceId());
if (existingSgi == null) {
throw new IllegalStateException(String.format("Security group interface with id %s was not found.",
sgiElement.getManagerSecurityGroupInterfaceId()));
}
existingSgi.setName(sgiElement.getName());
existingSgi.setPolicies(getPoliciesById(sgiElement));
@SuppressWarnings("resource")
SecurityGroupEntity sg = (SecurityGroupEntity) new IsmSecurityGroupApi(this.vs, this.txControl, this.em)
.getSecurityGroupById(sgiElement.getManagerSecurityGroupId());
existingSgi.setSecurityGroup(sg);
existingSgi.setTag(sgiElement.getTag());
this.txControl.required(() -> {
IsmSecurityGroupInterfaceApi.this.em.merge(existingSgi);
return null;
});
}
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:25,代码来源:IsmSecurityGroupInterfaceApi.java
示例3: getPoliciesById
import org.osc.sdk.manager.element.SecurityGroupInterfaceElement; //导入依赖的package包/类
private Set<PolicyEntity> getPoliciesById(SecurityGroupInterfaceElement sgiElement) throws Exception {
// TODO: Validate policies exist in the db
Set<PolicyEntity> policies = new HashSet<>();
IsmPolicyApi ismPolicyApi = IsmPolicyApi.create(this.mc, this.txControl, this.em);
for (ManagerPolicyElement mgrPolicyElement : sgiElement.getManagerPolicyElements()) {
policies.add(ismPolicyApi.getPolicy(mgrPolicyElement.getId(), mgrPolicyElement.getDomainId()));
}
if (policies.isEmpty()) {
throw new IllegalStateException("Cannot find policies");
}
return policies;
}
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:13,代码来源:IsmSecurityGroupInterfaceApi.java
示例4: createSecurityGroupInterface
import org.osc.sdk.manager.element.SecurityGroupInterfaceElement; //导入依赖的package包/类
/**
* Creates a security group interface within context of the current virtual system
*
* @param sgiElement the information needed to create a security group interface
* @return the identifier of the security group interface defined by the security manager
*
* @throws Exception upon failure
*/
String createSecurityGroupInterface(SecurityGroupInterfaceElement sgiElement) throws Exception;
开发者ID:opensecuritycontroller,项目名称:security-mgr-api,代码行数:10,代码来源:ManagerSecurityGroupInterfaceApi.java
示例5: updateSecurityGroupInterface
import org.osc.sdk.manager.element.SecurityGroupInterfaceElement; //导入依赖的package包/类
/**
* Updates a security group interface within context of the current virtual system
*
* @param sgiElement the information needed to update a security group interface
*
* @throws Exception upon failure
*/
void updateSecurityGroupInterface(SecurityGroupInterfaceElement sgiElement) throws Exception;
开发者ID:opensecuritycontroller,项目名称:security-mgr-api,代码行数:9,代码来源:ManagerSecurityGroupInterfaceApi.java