mirror of https://github.com/apache/jclouds.git
Merge branch 'develop' of github.com:jdaggett/jclouds
* 'develop' of github.com:jdaggett/jclouds: adding create and delete of security groups and security group rules fixing payload definitions to add and remove floating ips
This commit is contained in:
commit
d78cf5aa27
|
@ -101,9 +101,9 @@ public interface FloatingIPAsyncClient {
|
|||
@Path("/servers/{server}/action")
|
||||
@Consumes
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Payload("%7B\"addFloatingIp\":%7B\"server\":\"{server}\",\"address\":\"{address}\"%7D%7D")
|
||||
@Payload("%7B\"addFloatingIp\":%7B\"address\":\"{address}\"%7D%7D")
|
||||
ListenableFuture<Void> addFloatingIP(
|
||||
@PayloadParam("server") String serverId,
|
||||
@PathParam("server") String serverId,
|
||||
@PayloadParam("address") String address);
|
||||
|
||||
/**
|
||||
|
@ -113,9 +113,9 @@ public interface FloatingIPAsyncClient {
|
|||
@Path("/servers/{server}/action")
|
||||
@Consumes
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Payload("%7B\"removeFloatingIp\":%7B\"server\":\"{server}\",\"address\":\"{address}\"%7D%7D")
|
||||
@Payload("%7B\"removeFloatingIp\":%7B\"address\":\"{address}\"%7D%7D")
|
||||
ListenableFuture<Void> removeFloatingIP(
|
||||
@PayloadParam("server") String serverId,
|
||||
@PathParam("server") String serverId,
|
||||
@PayloadParam("address") String address);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.openstack.nova.v1_1.features;
|
|||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
@ -30,6 +31,7 @@ import javax.ws.rs.core.MediaType;
|
|||
|
||||
import org.jclouds.openstack.filters.AuthenticateRequest;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SecurityGroup;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SecurityGroupRule;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.Payload;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
|
@ -37,6 +39,7 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
@ -78,9 +81,55 @@ public interface SecurityGroupAsyncClient {
|
|||
*/
|
||||
@POST
|
||||
@Path("/os-security-groups")
|
||||
@SelectJson("security_group")
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@Payload("name {name}\n")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
ListenableFuture<SecurityGroup> createSecurityGroup(@PayloadParam("name") String name);
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Payload("%7B\"security_group\":%7B\"name\":\"{name}\",\"description\":\"{description}\"%7D%7D")
|
||||
ListenableFuture<SecurityGroup> createSecurityGroup(@PayloadParam("name") String name,
|
||||
@PayloadParam("description") String description);
|
||||
|
||||
|
||||
/**
|
||||
* @see SecurityGroupClient#deleteSecurityGroup
|
||||
*/
|
||||
@DELETE
|
||||
@Path("/os-security-groups/{id}")
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@Consumes
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Boolean> deleteSecurityGroup(@PathParam("id") String id);
|
||||
|
||||
|
||||
/**
|
||||
* @see SecurityGroupClient#createSecurityGroupRule
|
||||
*/
|
||||
@POST
|
||||
@Path("/os-security-group-rules")
|
||||
@SelectJson("security_group_rule")
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Payload("%7B\"security_group_rule\":%7B\"ip_protocol\":\"{ip_protocol}\"," +
|
||||
"\"from_port\":\"{from_port}\",\"to_port\":\"{to_port}\"," +
|
||||
"\"cidr\":\"{cidr}\",\"group_id\":\"{group_id}\",\"parent_group_id\":\"{parent_group_id}\"%7D%7D")
|
||||
ListenableFuture<SecurityGroupRule> createSecurityGroupRule(
|
||||
@PayloadParam("ip_protocol") String ip_protocol,
|
||||
@PayloadParam("from_port") String from_port,
|
||||
@PayloadParam("to_port") String to_port,
|
||||
@PayloadParam("cidr") String cidr,
|
||||
@PayloadParam("group_id") String group_id,
|
||||
@PayloadParam("parent_group_id") String parent_group_id);
|
||||
|
||||
|
||||
/**
|
||||
* @see SecurityGroupClient#deleteSecurityGroupRule
|
||||
*/
|
||||
@DELETE
|
||||
@Path("/os-security-group-rules/{security_group_rule_ID}")
|
||||
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
|
||||
@Consumes
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Boolean> deleteSecurityGroupRule(@PathParam("security_group_rule_ID") String security_group_rule_ID);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,20 +21,10 @@ package org.jclouds.openstack.nova.v1_1.features;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.FloatingIP;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SecurityGroup;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.Payload;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SecurityGroupRule;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Security Groups.
|
||||
|
@ -65,6 +55,28 @@ public interface SecurityGroupClient {
|
|||
*
|
||||
* @return a new Security Group
|
||||
*/
|
||||
SecurityGroup createSecurityGroup(String name);
|
||||
SecurityGroup createSecurityGroup(String name, String description);
|
||||
|
||||
/**
|
||||
* Delete a Security Group.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteSecurityGroup(String id);
|
||||
|
||||
/**
|
||||
* Create a Security Group Rule.
|
||||
*
|
||||
* @return a new Security Group Rule
|
||||
*/
|
||||
SecurityGroupRule createSecurityGroupRule(String ip_protocol, String from_port, String to_port, String cidr,
|
||||
String group_id, String parent_group_id);
|
||||
|
||||
/**
|
||||
* Delete a Security Group Rule.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteSecurityGroupRule(String id);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue