use of com.cloud.api.response.SecurityGroupResponse in project CloudStack-archive by CloudStack-extras.
the class CreateSecurityGroupCmd method execute.
@Override
public void execute() {
SecurityGroup group = _securityGroupService.createSecurityGroup(this);
if (group != null) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponse(group);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create security group");
}
}
use of com.cloud.api.response.SecurityGroupResponse in project CloudStack-archive by CloudStack-extras.
the class AuthorizeSecurityGroupIngressCmd method execute.
@Override
public void execute() {
if (cidrList != null) {
for (String cidr : cidrList) {
if (!NetUtils.isValidCIDR(cidr)) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, cidr + " is an Invalid CIDR ");
}
}
}
List<? extends SecurityRule> ingressRules = _securityGroupService.authorizeSecurityGroupIngress(this);
if (ingressRules != null && !ingressRules.isEmpty()) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(ingressRules);
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)");
}
}
use of com.cloud.api.response.SecurityGroupResponse in project CloudStack-archive by CloudStack-extras.
the class AuthorizeSecurityGroupEgressCmd method execute.
@Override
public void execute() {
List<? extends SecurityRule> egressRules = _securityGroupService.authorizeSecurityGroupEgress(this);
if (egressRules != null && !egressRules.isEmpty()) {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(egressRules);
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)");
}
}
Aggregations