use of com.cloud.network.vpc.NetworkACL in project cloudstack by apache.
the class UpdateNetworkACLListCmd method execute.
@Override
public void execute() throws ResourceUnavailableException {
NetworkACL acl = _networkACLService.updateNetworkACL(this);
NetworkACLResponse aclResponse = _responseGenerator.createNetworkACLResponse(acl);
setResponseObject(aclResponse);
aclResponse.setResponseName(getCommandName());
}
use of com.cloud.network.vpc.NetworkACL in project cloudstack by apache.
the class ApiResponseHelper method createNetworkACLItemResponse.
@Override
public NetworkACLItemResponse createNetworkACLItemResponse(NetworkACLItem aclItem) {
NetworkACLItemResponse response = new NetworkACLItemResponse();
response.setId(aclItem.getUuid());
response.setProtocol(aclItem.getProtocol());
if (aclItem.getSourcePortStart() != null) {
response.setStartPort(Integer.toString(aclItem.getSourcePortStart()));
}
if (aclItem.getSourcePortEnd() != null) {
response.setEndPort(Integer.toString(aclItem.getSourcePortEnd()));
}
response.setCidrList(StringUtils.join(aclItem.getSourceCidrList(), ","));
response.setTrafficType(aclItem.getTrafficType().toString());
NetworkACLItem.State state = aclItem.getState();
String stateToSet = state.toString();
if (state.equals(NetworkACLItem.State.Revoke)) {
stateToSet = "Deleting";
}
response.setIcmpCode(aclItem.getIcmpCode());
response.setIcmpType(aclItem.getIcmpType());
response.setState(stateToSet);
response.setNumber(aclItem.getNumber());
response.setAction(aclItem.getAction().toString());
response.setForDisplay(aclItem.isDisplay());
NetworkACL acl = ApiDBUtils.findByNetworkACLId(aclItem.getAclId());
if (acl != null) {
response.setAclId(acl.getUuid());
response.setAclName(acl.getName());
}
// set tag information
List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.NetworkACL, aclItem.getId());
List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
for (ResourceTag tag : tags) {
ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
CollectionUtils.addIgnoreNull(tagResponses, tagResponse);
}
response.setTags(tagResponses);
response.setReason(aclItem.getReason());
response.setObjectName("networkacl");
return response;
}
Aggregations