diff options
author | 2018-07-25 18:26:18 +0800 | |
---|---|---|
committer | 2018-07-25 18:26:18 +0800 | |
commit | 740b4d010990734eced5ca97938bc6b6d5124721 (patch) | |
tree | f51bc977d9a3753d3a45e130ee2fe77e946c801b /nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java | |
parent | ce3d8addd91c0828fefbcd13544b148351cbb59d (diff) |
Issues of nova CLIENT
Issue-ID: SO-729
Change-Id: I3e3c79cf8431605755472b4ece51430c3d772814
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java')
-rw-r--r-- | nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java | 348 |
1 files changed, 174 insertions, 174 deletions
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java index ebfea43..bcfc96c 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java @@ -27,179 +27,179 @@ import com.woorea.openstack.nova.model.SecurityGroupRuleForCreate; import com.woorea.openstack.nova.model.SecurityGroups; public class SecurityGroupsExtension { - - private final OpenStackClient CLIENT; - - public SecurityGroupsExtension(OpenStackClient client) { - CLIENT = client; - } - - public class List extends OpenStackRequest<SecurityGroups> { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-security-groups", null, SecurityGroups.class); - } - - } - - public class Create extends OpenStackRequest<SecurityGroup> { - - private SecurityGroupForCreate securityGroupForCreate; - - public Create(SecurityGroupForCreate securityGroupForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class); - this.securityGroupForCreate = securityGroupForCreate; - } - - } - - public class Show extends OpenStackRequest<SecurityGroup> { - - /** - * @deprecated - * @param id - */ - @Deprecated - public Show(Integer id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); - } - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); - } - - } - - public class Delete extends OpenStackRequest<Void> { - - /** - * - * @param id - * @deprecated - */ - @Deprecated - public Delete(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); - } - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class); - } - - } - - public class CreateRule extends OpenStackRequest<SecurityGroup.Rule> { - - private SecurityGroupRuleForCreate securityGroupRuleForCreate; - - public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class); - this.securityGroupRuleForCreate = securityGroupRuleForCreate; - } - } - - public class DeleteRule extends OpenStackRequest<Void> { - - /** - * - * @param id - * @deprecated - */ - @Deprecated - public DeleteRule(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); - } - - public DeleteRule(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); - } - } - - public List listSecurityGroups() { - return new List(); - } - - public Create createSecurityGroup(String name, - String description) { - return new Create(new SecurityGroupForCreate(name, description)); - } - - public Create createSecurityGroup(String name) { - return createSecurityGroup(name, null); - } - - public Show showSecurityGroup(Integer id) { - return new Show(String.valueOf(id)); - } - - public Show showSecurityGroup(String id) { - return new Show(id); - } - public Delete deleteSecurityGroup(Integer id) { - return new Delete(String.valueOf(id)); - } - - public Delete deleteSecurityGroup(String id) { - return new Delete(id); - } - - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @return - * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)} - */ - @Deprecated - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); - return new CreateRule(securityGroupRuleForCreate); - } - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @return - * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)} - */ - @Deprecated - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, Integer sourceGroupId) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, - sourceGroupId); - return new CreateRule(securityGroupRuleForCreate); - } - - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); - return new CreateRule(securityGroupRuleForCreate); - } - - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort, - Integer toPort) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort - ); - return new CreateRule(securityGroupRuleForCreate); - } - public DeleteRule deleteSecurityGroupRule(String id) { - return new DeleteRule(id); - } - public DeleteRule deleteSecurityGroupRule(Integer id) { - return new DeleteRule(String.valueOf(id)); - } + + private final OpenStackClient CLIENT; + + public SecurityGroupsExtension(OpenStackClient client) { + CLIENT = client; + } + + public class List extends OpenStackRequest<SecurityGroups> { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-security-groups", null, SecurityGroups.class); + } + + } + + public class Create extends OpenStackRequest<SecurityGroup> { + + private SecurityGroupForCreate securityGroupForCreate; + + public Create(SecurityGroupForCreate securityGroupForCreate) { + super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class); + this.securityGroupForCreate = securityGroupForCreate; + } + + } + + public class Show extends OpenStackRequest<SecurityGroup> { + + /** + * @deprecated + * @param id + */ + @Deprecated + public Show(Integer id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + } + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + } + + } + + public class Delete extends OpenStackRequest<Void> { + + /** + * + * @param id + * @deprecated + */ + @Deprecated + public Delete(Integer id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); + } + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class); + } + + } + + public class CreateRule extends OpenStackRequest<SecurityGroup.Rule> { + + private SecurityGroupRuleForCreate securityGroupRuleForCreate; + + public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) { + super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class); + this.securityGroupRuleForCreate = securityGroupRuleForCreate; + } + } + + public class DeleteRule extends OpenStackRequest<Void> { + + /** + * + * @param id + * @deprecated + */ + @Deprecated + public DeleteRule(Integer id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + } + + public DeleteRule(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + } + } + + public List listSecurityGroups() { + return new List(); + } + + public Create createSecurityGroup(String name, + String description) { + return new Create(new SecurityGroupForCreate(name, description)); + } + + public Create createSecurityGroup(String name) { + return createSecurityGroup(name, null); + } + + public Show showSecurityGroup(Integer id) { + return new Show(String.valueOf(id)); + } + + public Show showSecurityGroup(String id) { + return new Show(id); + } + public Delete deleteSecurityGroup(Integer id) { + return new Delete(String.valueOf(id)); + } + + public Delete deleteSecurityGroup(String id) { + return new Delete(id); + } + + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @return + * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)} + */ + @Deprecated + public CreateRule createSecurityGroupRule( + Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + return new CreateRule(securityGroupRuleForCreate); + } + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @return + * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)} + */ + @Deprecated + public CreateRule createSecurityGroupRule( + Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, Integer sourceGroupId) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, + sourceGroupId); + return new CreateRule(securityGroupRuleForCreate); + } + + public CreateRule createSecurityGroupRule( + String parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + return new CreateRule(securityGroupRuleForCreate); + } + + public CreateRule createSecurityGroupRule( + String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort, + Integer toPort) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort + ); + return new CreateRule(securityGroupRuleForCreate); + } + public DeleteRule deleteSecurityGroupRule(String id) { + return new DeleteRule(id); + } + public DeleteRule deleteSecurityGroupRule(Integer id) { + return new DeleteRule(String.valueOf(id)); + } } |