http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java deleted file mode 100644 index 2130972..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.extensions; - -/** - * Extension Namespaces for OpenStack Networking (Neutron). - */ -public final class ExtensionNamespaces { - /** - * Neutron Layer-3 Router Extension - */ - public static final String L3_ROUTER = "http://docs.openstack.org/ext/neutron/router/api/v1.0"; - /** - * Neutron Security Groups Extension - */ - public static final String SECURITY_GROUPS = "http://docs.openstack.org/ext/securitygroups/api/v2.0"; - /** - * LBaaS Extension. - */ - public static final String LBAAS = "http://wiki.openstack.org/neutron/LBaaS/API_1.0"; - /** - * FWaaS Extension. - */ - public static final String FWAAS = "http://wiki.openstack.org/Neutron/FWaaS/API_1.0"; - - private ExtensionNamespaces() { - throw new AssertionError("intentionally unimplemented"); - } -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java deleted file mode 100644 index a4f45db..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest; -import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404; -import org.jclouds.openstack.neutron.v2.domain.CreateFirewall; -import org.jclouds.openstack.neutron.v2.domain.CreateFirewallPolicy; -import org.jclouds.openstack.neutron.v2.domain.CreateFirewallRule; -import org.jclouds.openstack.neutron.v2.domain.Firewall; -import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy; -import org.jclouds.openstack.neutron.v2.domain.FirewallRule; -import org.jclouds.openstack.neutron.v2.domain.UpdateFirewall; -import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallPolicy; -import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallRule; -import org.jclouds.openstack.neutron.v2.functions.FirewallPolicyToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.FirewallRuleToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.FirewallToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.ParseFirewallPolicies; -import org.jclouds.openstack.neutron.v2.functions.ParseFirewallRules; -import org.jclouds.openstack.neutron.v2.functions.ParseFirewalls; -import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; - -/** - * The FWaaS extension provides OpenStack users with the ability to deploy firewalls to protect their networks. - * <p/> - * - * @see <a href= - * "http://specs.openstack.org/openstack/neutron-specs/specs/api/firewall_as_a_service__fwaas_.html">api doc</a> - * @see <a href= - * "http://git.openstack.org/cgit/openstack/neutron-fwaas/tree/neutron_fwaas/extensions/firewall.py">extension info</a> - */ -@Beta -@Path("/fw") -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -@Extension(of = ServiceType.NETWORK, namespace = ExtensionNamespaces.FWAAS, name = "Firewall service", alias = "fwaas") -public interface FWaaSApi { - - /** - * Returns the list of all routers currently defined in Neutron for the current tenant. The list provides the unique - * identifier of each firewall configured for the tenant - * - * @return the list of all firewall references configured for the tenant. - */ - @Named("fw:list") - @GET - @Transform(FirewallToPagedIterable.class) - @ResponseParser(ParseFirewalls.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - @Path("/firewalls") - PagedIterable<Firewall> list(); - - /** - * @return the list of all firewall references configured for the tenant. - */ - @Named("firewall:list") - @GET - @ResponseParser(ParseFirewalls.class) - @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) - @Path("/firewalls") - PaginatedCollection<Firewall> list(PaginationOptions options); - - /** - * Returns the details for a specific firewall. - * - * @param id the id of the firewall to return - * @return firewall or empty if not found - */ - @Named("firewall:get") - @GET - @Path("/firewalls/{id}") - @SelectJson("firewall") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - Firewall get(@PathParam("id") String id); - - /** - * Create a new firewall - * - * @param firewall Options for creating a firewall - * @return the newly created firewall - */ - @Named("firewall:create") - @POST - @SelectJson("firewall") - @Path("/firewalls") - Firewall create(@WrapWith("firewall") CreateFirewall firewall); - - /** - * Update a firewall - * - * @param id the id of the firewall to update - * @param updateFirewall Contains only the attributes to update - * @return The modified firewall - */ - @Named("firewall:update") - @PUT - @Path("/firewalls/{id}") - @SelectJson("firewall") - Firewall update(@PathParam("id") String id, @WrapWith("firewall") UpdateFirewall updateFirewall); - - /** - * Deletes the specified firewall - * - * @param id the id of the firewall to delete - * @return true if delete successful, false if not - */ - @Named("firewall:delete") - @DELETE - @Path("/firewalls/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean delete(@PathParam("id") String id); - - @Named("firewall:createPolicy") - @POST - @SelectJson("firewall_policy") - @Path("/firewall_policies") - FirewallPolicy createFirewallPolicy(@WrapWith("firewall_policy") CreateFirewallPolicy firewallPolicy); - - @Named("firewall:listPolicies") - @GET - @Transform(FirewallPolicyToPagedIterable.class) - @ResponseParser(ParseFirewallPolicies.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - @Path("/firewall_policies") - PagedIterable<FirewallPolicy> listFirewallPolicies(); - - @Named("firewall:listPolicies") - @GET - @ResponseParser(ParseFirewallPolicies.class) - @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) - @Path("/firewall_policies") - PaginatedCollection<FirewallPolicy> listFirewallPolicies(PaginationOptions options); - - @Named("firewall:getPolicy") - @GET - @SelectJson("firewall_policy") - @Fallback(NullOnNotFoundOr404.class) - @Path("/firewall_policies/{id}") - FirewallPolicy getFirewallPolicy(@PathParam("id") String id); - - @Named("firewall:updatePolicy") - @PUT - @SelectJson("firewall_policy") - @Path("/firewall_policies/{id}") - FirewallPolicy updateFirewallPolicy(@PathParam("id") String id, @WrapWith("firewall_policy") UpdateFirewallPolicy updateFirewallPolicy); - - @Named("firewall:deletePolicy") - @DELETE - @Path("/firewall_policies/{id}") - boolean deleteFirewallPolicy(@PathParam("id") String id); - - @Named("firewall:createFirewallRule") - @POST - @SelectJson("firewall_rule") - @Path("/firewall_rules") - FirewallRule createFirewallRule(@WrapWith("firewall_rule") CreateFirewallRule firewallRule); - - @Named("firewall:listFirewallRules") - @GET - @Transform(FirewallRuleToPagedIterable.class) - @ResponseParser(ParseFirewallRules.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - @Path("/firewall_rules") - PagedIterable<FirewallRule> listFirewallRules(); - - @Named("firewall:listFirewallRules") - @GET - @ResponseParser(ParseFirewallRules.class) - @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) - @Path("/firewall_rules") - PaginatedCollection<FirewallRule> listFirewallRules(PaginationOptions options); - - @Named("firewall:getFirewallRule") - @GET - @Path("/firewall_rules/{id}") - @SelectJson("firewall_rule") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - FirewallRule getFirewallRule(@PathParam("id") String firewallRuleId); - - @Named("firewall:updateFirewallRule") - @PUT - @Path("/firewall_rules/{id}") - @SelectJson("firewall_rule") - FirewallRule updateFirewallRule(@PathParam("id") String id, @WrapWith("firewall_rule") UpdateFirewallRule updateFirewallRule); - - @Named("firewall:deleteFirewallRule") - @DELETE - @Path("/firewall_rules/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteFirewallRule(@PathParam("id") String id); - - @Named("firewall:insertFirewallRuleToPolicy") - @PUT - @Path("/firewall_policies/{id}/insert_rule") - FirewallPolicy insertFirewallRuleToPolicy(@PathParam("id") String policyId, @WrapWith("firewall_rule_id") String firewallRuleId); - - @Named("firewall:removeFirewallRuleFromPolicy") - @DELETE - @Path("/firewall_policies/{id}/remove_rule") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - FirewallPolicy removeFirewallRuleFromPolicy(@PathParam("id") String policyId, @WrapWith("firewall_rule_id") String firewallRuleId); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApi.java deleted file mode 100644 index a00bc04..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApi.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest; -import org.jclouds.openstack.neutron.v2.domain.FloatingIP; -import org.jclouds.openstack.neutron.v2.domain.FloatingIPs; -import org.jclouds.openstack.neutron.v2.fallbacks.EmptyFloatingIPsFallback; -import org.jclouds.openstack.neutron.v2.functions.FloatingIPsToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.ParseFloatingIPs; -import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; - -/** - * Provides access to Floating IP operations for the OpenStack Networking (Neutron) v2 API. - * <p/> - * A floating IP is an IP address on an external network, which is associated with a specific port, and optionally a - * specific IP address, on a private OpenStack Networking network. Therefore a floating IP allows access to an - * instance on a private network from an external network. Floating IPs can only be defined on networks for which the - * attribute floatingip:external (by the external network extension) has been set to True. - */ -@Beta -@Path("/floatingips") -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -@Extension(of = ServiceType.NETWORK, namespace = ExtensionNamespaces.L3_ROUTER, name = "Neutron L3 Router", alias = "router") -public interface FloatingIPApi { - - /** - * Returns a list of floating IPs to which the tenant has access. Default policy settings return only - * those floating IPs that are owned by the tenant who submits the request, unless the request is submitted by an - * user with administrative rights. - * - * @return the list of all floatingIP references configured for the tenant. - */ - @Named("floatingip:list") - @GET - @Transform(FloatingIPsToPagedIterable.class) - @ResponseParser(ParseFloatingIPs.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<FloatingIP> list(); - - /** - * @return the list of all floatingIP references configured for the tenant. - */ - @Named("floatingip:list") - @GET - @ResponseParser(ParseFloatingIPs.class) - @Fallback(EmptyFloatingIPsFallback.class) - FloatingIPs list(PaginationOptions options); - - /** - * Returns the details for a specific floating IP. - * - * @param id the id of the floatingIP to return - * @return FloatingIPs collection or empty if not found - */ - @Named("floatingip:get") - @GET - @Path("/{id}") - @SelectJson("floatingip") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - FloatingIP get(@PathParam("id") String id); - - /** - * Creates a floating IP. - * - * @param createFloatingIP Options for creating a Floating IP - * @return the newly created Floating IP - */ - @Named("floatingip:create") - @POST - @SelectJson("floatingip") - FloatingIP create(@WrapWith("floatingip") FloatingIP.CreateFloatingIP createFloatingIP); - - /** - * Update a Floating IP - * - * @param id the id of the Floating IP to update - * @param updateFloatingIP Contains only the attributes to update - * @return The modified Floating IP - */ - @Named("floatingip:update") - @PUT - @Path("/{id}") - @SelectJson("floatingip") - FloatingIP update(@PathParam("id") String id, @WrapWith("floatingip") FloatingIP.UpdateFloatingIP updateFloatingIP); - - /** - * Deletes the specified floatingIP - * - * @param id the id of the floatingIP to delete - * @return true if delete successful, false if not - */ - @Named("floatingip:delete") - @DELETE - @Path("/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean delete(@PathParam("id") String id); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java deleted file mode 100644 index 383c70e..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest; -import org.jclouds.openstack.neutron.v2.domain.Router; -import org.jclouds.openstack.neutron.v2.domain.RouterInterface; -import org.jclouds.openstack.neutron.v2.domain.Routers; -import org.jclouds.openstack.neutron.v2.fallbacks.EmptyRoutersFallback; -import org.jclouds.openstack.neutron.v2.functions.ParseRouters; -import org.jclouds.openstack.neutron.v2.functions.RouterToPagedIterable; -import org.jclouds.openstack.neutron.v2.options.EmptyOptions; -import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; - -/** - * Provides access to Router operations for the OpenStack Networking (Neutron) v2 API. - * <p/> - * A logical entity for forwarding packets across internal subnets and NATting them on external - * networks through an appropriate external gateway. - * - * @see <a href= - * "http://docs.openstack.org/api/openstack-network/2.0/content/router_ext.html">api doc</a> - * - * @see <a href= - * "https://github.com/openstack/neutron/tree/master/neutron/extensions">neutron extensions</a> - */ -@Beta -@Path("/routers") -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -@Extension(of = ServiceType.NETWORK, namespace = ExtensionNamespaces.L3_ROUTER, name = "Neutron L3 Router", alias = "router") -public interface RouterApi { - - /** - * Returns the list of all routers currently defined in Neutron for the current tenant. The list provides the unique - * identifier of each router configured for the tenant - * - * @return the list of all router references configured for the tenant. - */ - @Named("router:list") - @GET - @Transform(RouterToPagedIterable.class) - @ResponseParser(ParseRouters.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<Router> list(); - - /** - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a> - */ - @Named("router:list") - @GET - @ResponseParser(ParseRouters.class) - @Fallback(EmptyRoutersFallback.class) - Routers list(PaginationOptions options); - - /** - * Returns a Routers collection that should contain a single router with the id requested. - * - * @param id the id of the router to return - * @return Routers collection or empty if not found - */ - @Named("router:get") - @GET - @Path("/{id}") - @SelectJson("router") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - Router get(@PathParam("id") String id); - - /** - * Create a new router - * - * @param router Options for creating a router - * @return the newly created router - */ - @Named("router:create") - @POST - @SelectJson("router") - Router create(@WrapWith("router") Router.CreateRouter router); - - /** - * Update a router - * - * @param id the id of the router to update - * @param router Contains only the attributes to update - * @return The modified router - */ - @Named("router:update") - @PUT - @Path("/{id}") - @SelectJson("router") - Router update(@PathParam("id") String id, @WrapWith("router") Router.UpdateRouter router); - - /** - * Deletes the specified router - * - * @param id the id of the router to delete - * @return true if delete successful, false if not - */ - @Named("router:delete") - @DELETE - @Path("/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean delete(@PathParam("id") String id); - - /** - * Add a interface to a router to connect to the specified subnet - * - * @param routerId the id of the router to create the interface at - * @param subnetId the id of the subnet to connect with the interface - * @return the newly-created router interface - */ - @Named("router:addInterfaceForSubnet") - @PUT - @Path("/{id}/add_router_interface") - @MapBinder(EmptyOptions.class) - RouterInterface addInterfaceForSubnet(@PathParam("id") String routerId, @PayloadParam("subnet_id") String subnetId); - - /** - * Add a interface to a router to connect to the specified port - * - * @param routerId the id of the router to create the interface at - * @param portId the id of the port to connect with the interface - * @return the newly-created router interface - */ - @Named("router:addInterfaceForPort") - @PUT - @Path("/{id}/add_router_interface") - @MapBinder(EmptyOptions.class) - RouterInterface addInterfaceForPort(@PathParam("id") String routerId, @PayloadParam("port_id") String portId); - - /** - * Remove the interface where the specified subnet is connected to - * - * @param routerId the id of the router to remove the interface from - * @param subnetId the id of the subnet to disconnect from the interface - */ - @Named("router:removeInterfaceForSubnet") - @PUT - @Path("/{id}/remove_router_interface") - @MapBinder(EmptyOptions.class) - @Fallback(FalseOnNotFoundOr404.class) - boolean removeInterfaceForSubnet(@PathParam("id") String routerId, @PayloadParam("subnet_id") String subnetId); - - /** - * Remove the interface where the specified port is connected to - * - * @param routerId the id of the router to remove the interface from - * @param portId the id of the port to disconnect from the interface - */ - @Named("router:removeInterfaceForPort") - @PUT - @Path("/{id}/remove_router_interface") - @MapBinder(EmptyOptions.class) - @Fallback(FalseOnNotFoundOr404.class) - boolean removeInterfaceForPort(@PathParam("id") String routerId, @PayloadParam("port_id") String portId); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java deleted file mode 100644 index f67c6e3..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.extensions.lbaas.v1; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Member; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pool; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIP; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs; -import org.jclouds.openstack.neutron.v2.extensions.ExtensionNamespaces; -import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyHealthMonitorsFallback; -import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyMembersFallback; -import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyPoolsFallback; -import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyVIPsFallback; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.HealthMonitorsToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.MembersToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParseHealthMonitors; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParseMembers; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParsePools; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParseVIPs; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.PoolsToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.VIPsToPagedIterable; -import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.Payload; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; - -/** - * Provides access to load-balancing operations for the OpenStack Networking (Neutron) v2 API. - * <p/> - * LBaaS v1 is an extension to load-balance the traffic between instances and external networks. - */ -@Beta -@Extension(of = ServiceType.NETWORK, namespace = ExtensionNamespaces.LBAAS) -@Path("/lb") -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -public interface LBaaSApi { - - /** - * Returns a list of VIPs to which the tenant has access. Default policy settings return only - * those VIPs that are owned by the tenant who submits the request, unless the request is submitted by an - * user with administrative rights. - * - * @return the list of all VIP references configured for the tenant. - */ - @Named("vip:list") - @GET - @Path("/vips") - @Transform(VIPsToPagedIterable.class) - @ResponseParser(ParseVIPs.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<VIP> listVIPs(); - - /** - * @return the list of all VIP references configured for the tenant. - */ - @Named("vip:list") - @GET - @Path("/vips") - @ResponseParser(ParseVIPs.class) - @Fallback(EmptyVIPsFallback.class) - VIPs listVIPs(PaginationOptions options); - - /** - * Returns the details for a specific VIP. - * - * @param id the id of the VIP to return. - * @return VIP or null if not found. - */ - @Named("vip:get") - @GET - @Path("/vips/{id}") - @SelectJson("vip") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - VIP getVIP(@PathParam("id") String id); - - /** - * Creates a new VIP. - * - * @param vip describes the VIP to be created. - * @return a reference of the newly-created VIP. - */ - @Named("vip:create") - @POST - @Path("/vips") - @SelectJson("vip") - VIP createVIP(@WrapWith("vip") VIP.CreateVIP vip); - - /** - * Update a VIP. - * - * @param id the id of the VIP to update. - * @param vip the VIP's attributes to update. - * @return a reference of the updated VIP. - */ - @Named("vip:update") - @PUT - @Path("/vips/{id}") - @SelectJson("vip") - VIP updateVIP(@PathParam("id") String id, @WrapWith("vip") VIP.UpdateVIP vip); - - /** - * Deletes the specified VIP. - * - * @param id the id of the VIP to delete. - * @return true if delete successful, false if not. - */ - @Named("vip:delete") - @DELETE - @Path("/vips/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteVIP(@PathParam("id") String id); - - /** - * Returns a list of Pools to which the tenant has access. Default policy settings return only - * those Pools that are owned by the tenant who submits the request, unless the request is submitted by an - * user with administrative rights. - * - * @return the list of all Pool references configured for the tenant. - */ - @Named("pool:list") - @GET - @Path("/pools") - @Transform(PoolsToPagedIterable.class) - @ResponseParser(ParsePools.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<Pool> listPools(); - - /** - * @return the list of all Pool references configured for the tenant. - */ - @Named("pool:list") - @GET - @Path("/pools") - @ResponseParser(ParsePools.class) - @Fallback(EmptyPoolsFallback.class) - Pools listPools(PaginationOptions options); - - /** - * Returns the details for a specific Pool. - * - * @param id the id of the Pool to return. - * @return Pool or null if not found. - */ - @Named("pool:get") - @GET - @Path("/pools/{id}") - @SelectJson("pool") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - Pool getPool(@PathParam("id") String id); - - /** - * Creates a new Pool. - * - * @param pool describes the Pool to be created. - * @return a reference of the newly-created Pool. - */ - @Named("pool:create") - @POST - @Path("/pools") - @SelectJson("pool") - Pool createPool(@WrapWith("pool") Pool.CreatePool pool); - - /** - * Update a Pool. - * - * @param id the id of the Pool to update. - * @param pool the Pool's attributes to update. - * @return a reference of the updated Pool. - */ - @Named("pool:update") - @PUT - @Path("/pools/{id}") - @SelectJson("pool") - Pool updatePool(@PathParam("id") String id, @WrapWith("pool") Pool.UpdatePool pool); - - /** - * Deletes the specified Pool. - * - * @param id the id of the Pool to delete. - * @return true if delete successful, false if not. - */ - @Named("pool:delete") - @DELETE - @Path("/pools/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deletePool(@PathParam("id") String id); - - /** - * Returns a list of Members to which the tenant has access. Default policy settings return only - * those Members that are owned by the tenant who submits the request, unless the request is submitted by an - * user with administrative rights. - * - * @return the list of all Member references configured for the tenant. - */ - @Named("member:list") - @GET - @Path("/members") - @Transform(MembersToPagedIterable.class) - @ResponseParser(ParseMembers.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<Member> listMembers(); - - /** - * @return the list of all Member references configured for the tenant. - */ - @Named("member:list") - @GET - @Path("/members") - @ResponseParser(ParseMembers.class) - @Fallback(EmptyMembersFallback.class) - Members listMembers(PaginationOptions options); - - /** - * Returns the details for a specific Member. - * - * @param id the id of the Member to return. - * @return Member or null if not found. - */ - @Named("member:get") - @GET - @Path("/members/{id}") - @SelectJson("member") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - Member getMember(@PathParam("id") String id); - - /** - * Creates a new Member. - * - * @param member describes the Member to be created. - * @return a reference of the newly-created Member. - */ - @Named("member:create") - @POST - @Path("/members") - @SelectJson("member") - Member createMember(@WrapWith("member") Member.CreateMember member); - - /** - * Update a Member. - * - * @param id the id of the Member to update. - * @param member the Member's attributes to update. - * @return a reference of the updated Member. - */ - @Named("member:update") - @PUT - @Path("/members/{id}") - @SelectJson("member") - Member updateMember(@PathParam("id") String id, @WrapWith("member") Member.UpdateMember member); - - /** - * Deletes the specified Member. - * - * @param id the id of the Member to delete. - * @return true if delete successful, false if not. - */ - @Named("member:delete") - @DELETE - @Path("/members/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteMember(@PathParam("id") String id); - - /** - * Returns a list of HealthMonitors to which the tenant has access. Default policy settings return only - * those HealthMonitors that are owned by the tenant who submits the request, unless the request is submitted by an - * user with administrative rights. - * - * @return the list of all HealthMonitor references configured for the tenant. - */ - @Named("health_monitor:list") - @GET - @Path("/health_monitors") - @Transform(HealthMonitorsToPagedIterable.class) - @ResponseParser(ParseHealthMonitors.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<HealthMonitor> listHealthMonitors(); - - /** - * @return the list of all HealthMonitor references configured for the tenant. - */ - @Named("health_monitor:list") - @GET - @Path("/health_monitors") - @ResponseParser(ParseHealthMonitors.class) - @Fallback(EmptyHealthMonitorsFallback.class) - HealthMonitors listHealthMonitors(PaginationOptions options); - - /** - * Returns the details for a specific HealthMonitor. - * - * @param id the id of the HealthMonitor to return. - * @return Health Monitor or null if not found. - */ - @Named("health_monitor:get") - @GET - @Path("/health_monitors/{id}") - @SelectJson("health_monitor") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - HealthMonitor getHealthMonitor(@PathParam("id") String id); - - /** - * Creates a new HealthMonitor. - * - * @param healthMonitor describes the HealthMonitor to be created. - * @return a reference of the newly-created HealthMonitor. - */ - @Named("health_monitor:create") - @POST - @Path("/health_monitors") - @SelectJson("health_monitor") - HealthMonitor createHealthMonitor(@WrapWith("health_monitor") HealthMonitor.CreateHealthMonitor healthMonitor); - - /** - * Update a HealthMonitor. - * - * @param id the id of the HealthMonitor to update. - * @param healthMonitor the HealthMonitor's attributes to update. - * @return a reference of the updated HealthMonitor. - */ - @Named("health_monitor:update") - @PUT - @Path("/health_monitors/{id}") - @SelectJson("health_monitor") - HealthMonitor updateHealthMonitor(@PathParam("id") String id, - @WrapWith("health_monitor") HealthMonitor.UpdateHealthMonitor healthMonitor); - - /** - * Deletes the specified Health Monitor. - * - * @param id the id of the Health Monitor to delete. - * @return true if delete successful, false if not. - */ - @Named("health_monitor:delete") - @DELETE - @Path("/health_monitors/{id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteHealthMonitor(@PathParam("id") String id); - - /** - * Associate a HealthMonitor to a Pool. - * - * @param poolId the id of the Pool to associate. - * @param healthMonitorId the id of the HealthMonitor to associate. - * @return the newly associated HealthMonitor. - */ - @Named("pool:associate_health_monitor") - @POST - @Path("/pools/{pool-id}/health_monitors") - @SelectJson("health_monitor") - @Payload("%7B\"health_monitor\":%7B\"id\":\"{healthMonitorId}\"%7D%7D") - @Produces(MediaType.APPLICATION_JSON) - HealthMonitor associateHealthMonitor(@PathParam("pool-id") String poolId, - @PayloadParam("healthMonitorId") String healthMonitorId); - - /** - * Disassociate a HealthMonitor from a Pool. - * - * @param poolId the id of the Pool to disassociate. - * @param healthMonitorId the id of the HealthMonitor to disassociate. - * @return true if disassociate successful, false if not. - */ - @Named("pool:disassociate_health_monitor") - @DELETE - @Path("/pools/{pool-id}/health_monitors/{health-monitor-id}") - @Fallback(FalseOnNotFoundOr404.class) - boolean disassociateHealthMonitor(@PathParam("pool-id") String poolId, - @PathParam("health-monitor-id") String healthMonitorId); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java deleted file mode 100644 index ede9046..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.FloatingIPs; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyFloatingIPsFallback implements Fallback<FloatingIPs> { - @Override - public FloatingIPs createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return FloatingIPs.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java deleted file mode 100644 index 8410afb..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.Networks; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyNetworksFallback implements Fallback<Networks> { - @Override - public Networks createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return Networks.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java deleted file mode 100644 index ac2e0db..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.Ports; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyPortsFallback implements Fallback<Ports> { - @Override - public Ports createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return Ports.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java deleted file mode 100644 index 8b74be2..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.Routers; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyRoutersFallback implements Fallback<Routers> { - @Override - public Routers createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return Routers.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java deleted file mode 100644 index 4556f74..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.Rules; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyRulesFallback implements Fallback<Rules> { - @Override - public Rules createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return Rules.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java deleted file mode 100644 index 70a3e37..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.SecurityGroups; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptySecurityGroupsFallback implements Fallback<SecurityGroups> { - @Override - public SecurityGroups createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return SecurityGroups.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java deleted file mode 100644 index 8f7a94a..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.Subnets; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptySubnetsFallback implements Fallback<Subnets> { - @Override - public Subnets createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return Subnets.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java deleted file mode 100644 index 8364fba..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyHealthMonitorsFallback implements Fallback<HealthMonitors> { - @Override - public HealthMonitors createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return HealthMonitors.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java deleted file mode 100644 index 9cb8084..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyMembersFallback implements Fallback<Members> { - @Override - public Members createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return Members.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java deleted file mode 100644 index 0c2ce99..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyPoolsFallback implements Fallback<Pools> { - @Override - public Pools createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return Pools.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java deleted file mode 100644 index 4dfae2d..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - -import org.jclouds.Fallback; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs; -import org.jclouds.rest.ResourceNotFoundException; - -public class EmptyVIPsFallback implements Fallback<VIPs> { - @Override - public VIPs createOrPropagate(Throwable t) throws Exception { - if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) - || contains404(t)) { - return VIPs.EMPTY; - } - throw propagate(t); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/NetworkApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/NetworkApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/NetworkApi.java deleted file mode 100644 index af908fc..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/NetworkApi.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.features; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks; -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest; -import org.jclouds.openstack.neutron.v2.domain.Network; -import org.jclouds.openstack.neutron.v2.domain.Networks; -import org.jclouds.openstack.neutron.v2.fallbacks.EmptyNetworksFallback; -import org.jclouds.openstack.neutron.v2.functions.NetworksToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.ParseNetworks; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableList; - -/** - * Provides access to Network operations for the OpenStack Networking (Neutron) v2 API. - * <p/> - * Each tenant can define one or more networks. A network is a virtual isolated layer-2 broadcast domain reserved to the - * tenant. A tenant can create several ports for a network, and plug virtual interfaces into these ports. - * - * @see <a href= - * "http://docs.openstack.org/api/openstack-network/2.0/content/Networks.html">api doc</a> - */ -@Beta -@Path("/networks") -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -@Produces(MediaType.APPLICATION_JSON) -public interface NetworkApi { - - /** - * Returns all networks currently defined in Neutron for the current tenant. - * - * @return the list of all networks configured for the tenant - */ - @Named("network:list") - @GET - @ResponseParser(ParseNetworks.class) - @Transform(NetworksToPagedIterable.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<Network> list(); - - /** - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a> - */ - @Named("network:list") - @GET - @ResponseParser(ParseNetworks.class) - @Fallback(EmptyNetworksFallback.class) - Networks list(PaginationOptions options); - - /** - * Return a specific network - * - * @param id the id of the network to return - * @return Network or null if not found - */ - @Named("network:get") - @GET - @Path("/{id}") - @SelectJson("network") - @Fallback(Fallbacks.NullOnNotFoundOr404.class) - @Nullable - Network get(@PathParam("id") String id); - - /** - * Create a new network with the specified type - * - * @param network Describes the network to be created. - * @return a reference of the newly-created network - */ - @Named("network:create") - @POST - @SelectJson("network") - Network create(@WrapWith("network") Network.CreateNetwork network); - - /** - * Create multiple networks - * - * @param networks the bulk of networks to create - * @return list of references of the newly-created networks - */ - @Named("network:createBulk") - @POST - @SelectJson("networks") - FluentIterable<Network> createBulk(@WrapWith("networks") ImmutableList<Network.CreateNetwork> networks); - - /** - * Update a network - * - * @param id the id of the network to update - * @param network the network to update - * @return true if update successful, false if not - */ - @Named("network:update") - @PUT - @Path("/{id}") - @SelectJson("network") - Network update(@PathParam("id") String id, @WrapWith("network") Network.UpdateNetwork network); - - /** - * Deletes the specified network - * - * @param id the id of the network to delete - * @return true if delete was successful, false if not - */ - @Named("network:delete") - @DELETE - @Path("/{id}") - @Fallback(Fallbacks.FalseOnNotFoundOr404.class) - boolean delete(@PathParam("id") String id); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/PortApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/PortApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/PortApi.java deleted file mode 100644 index 3cd0e35..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/PortApi.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.features; - -import java.util.List; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks; -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest; -import org.jclouds.openstack.neutron.v2.domain.Port; -import org.jclouds.openstack.neutron.v2.domain.Ports; -import org.jclouds.openstack.neutron.v2.fallbacks.EmptyPortsFallback; -import org.jclouds.openstack.neutron.v2.functions.ParsePorts; -import org.jclouds.openstack.neutron.v2.functions.PortsToPagedIterable; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; -import com.google.common.collect.FluentIterable; - -/** - * Provides access to Port operations for the OpenStack Networking (Neutron) v2 API. - * <p/> - * A port represents a virtual switch port on a logical network switch where all the interfaces attached to a given network are connected. - * <p/> - * A port has an administrative state which is either 'DOWN' or 'ACTIVE'. Ports which are administratively down will not be able to receive/send traffic. - * @see <a href= - * "http://docs.openstack.org/api/openstack-network/2.0/content/Ports.html">api doc</a> - */ -@Beta -@Path("/ports") -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -public interface PortApi { - - /** - * Returns the list of all ports currently defined in Neutron for the current tenant. The list provides the unique - * identifier of each network configured for the tenant. - * - * @return the list of all port references configured for the tenant - */ - @Named("port:list") - @GET - @Transform(PortsToPagedIterable.class) - @ResponseParser(ParsePorts.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<Port> list(); - - /** - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a> - */ - @Named("port:list") - @GET - @ResponseParser(ParsePorts.class) - @Fallback(EmptyPortsFallback.class) - Ports list(PaginationOptions options); - - /** - * Returns the specific port - * - * @param id the id of the port to return - * @return Port or null if not found - */ - @Named("port:get") - @GET - @Path("/{id}") - @SelectJson("port") - @Fallback(Fallbacks.NullOnNotFoundOr404.class) - @Nullable - Port get(@PathParam("id") String id); - - /** - * Create a new port in the specified network - * - * @param port the port details - * @return a reference of the newly-created port - */ - @Named("port:create") - @POST - @SelectJson("port") - Port create(@WrapWith("port") Port.CreatePort port); - - /** - * Create multiple ports - * - * @param ports the bulk of ports to create - * @return list of references of the newly-created ports - */ - @Named("port:createBulk") - @POST - @SelectJson("ports") - FluentIterable<Port> createBulk(@WrapWith("ports") List<Port.CreatePort> ports); - - /** - * Update a port - * - * @param id the id of the port to update - * @param port CreatePort with just the attributes to update - * @return true if update successful, false if not - */ - @Named("port:update") - @PUT - @Path("/{id}") - @SelectJson("port") - Port update(@PathParam("id") String id, @WrapWith("port") Port.UpdatePort port); - - /** - * Delete a port - * - * @param id the id of the port to delete - * @return true if delete successful, false if not - */ - @Named("port:delete") - @DELETE - @Path("/{id}") - @Fallback(Fallbacks.FalseOnNotFoundOr404.class) - boolean delete(@PathParam("id") String id); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SecurityGroupApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SecurityGroupApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SecurityGroupApi.java deleted file mode 100644 index 3646c17..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SecurityGroupApi.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.features; - -import javax.inject.Named; -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; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks; -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest; -import org.jclouds.openstack.neutron.v2.domain.Rule; -import org.jclouds.openstack.neutron.v2.domain.Rules; -import org.jclouds.openstack.neutron.v2.domain.SecurityGroup; -import org.jclouds.openstack.neutron.v2.domain.SecurityGroups; -import org.jclouds.openstack.neutron.v2.fallbacks.EmptyRulesFallback; -import org.jclouds.openstack.neutron.v2.fallbacks.EmptySecurityGroupsFallback; -import org.jclouds.openstack.neutron.v2.functions.ParseRules; -import org.jclouds.openstack.neutron.v2.functions.ParseSecurityGroups; -import org.jclouds.openstack.neutron.v2.functions.RulesToPagedIterable; -import org.jclouds.openstack.neutron.v2.functions.SecurityGroupsToPagedIterable; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; - -/** - * Provides access to Security Group extension operations for the OpenStack Networking (Neutron) v2 API. - * <p/> - * Security groups and security group rules allows administrators and tenants the ability to specify the type of - * traffic and direction (ingress/egress) that is allowed to pass through a port. A security group is a container for - * security group rules. - */ -@Beta -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -@Produces(MediaType.APPLICATION_JSON) -public interface SecurityGroupApi { - - /** - * @return all security groups currently defined in Neutron for the current tenant. - */ - @Path("/security-groups") - @Named("security-group:list") - @GET - @ResponseParser(ParseSecurityGroups.class) - @Transform(SecurityGroupsToPagedIterable.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<SecurityGroup> listSecurityGroups(); - - /** - * @return all security groups currently defined in Neutron for the current tenant. - */ - @Path("/security-groups") - @Named("security-group:list") - @GET - @ResponseParser(ParseSecurityGroups.class) - @Fallback(EmptySecurityGroupsFallback.class) - SecurityGroups listSecurityGroups(PaginationOptions options); - - /** - * @param id the id of the security group to return - * @return SecurityGroup or null if not found. - */ - @Path("/security-groups/{id}") - @Named("security-group:get") - @GET - @SelectJson("security_group") - @Fallback(Fallbacks.NullOnNotFoundOr404.class) - @Nullable - SecurityGroup getSecurityGroup(@PathParam("id") String id); - - /** - * Creates a new SecurityGroup. - * - * @param securityGroup Describes the security group to be created. - * @return a reference of the newly-created security group - */ - @Path("/security-groups") - @Named("secuity-group:create") - @POST - @SelectJson("security_group") - SecurityGroup create(@WrapWith("security_group") SecurityGroup.CreateSecurityGroup securityGroup); - - /** - * Deletes the specified Security Group. - * - * @param id the id of the security group to delete - * @return true if delete was successful, false if not - */ - @Path("/security-groups/{id}") - @Named("security-group:delete") - @DELETE - @Fallback(Fallbacks.FalseOnNotFoundOr404.class) - boolean deleteSecurityGroup(@PathParam("id") String id); - - /** - * Rules - */ - - /** - * @return all security groups rules currently defined in Neutron for the current tenant. - */ - @Path("/security-group-rules") - @Named("security-group-rule:list") - @GET - @ResponseParser(ParseRules.class) - @Transform(RulesToPagedIterable.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<Rule> listRules(); - - /** - * @return all security groups rules currently defined in Neutron for the current tenant. - */ - @Path("/security-group-rules") - @Named("security-group-rule:list") - @GET - @ResponseParser(ParseRules.class) - @Fallback(EmptyRulesFallback.class) - Rules listRules(PaginationOptions options); - - /** - * @param id the id of the security group rule to return. - * @return SecurityGroupRule or null if not found. - */ - @Path("/security-group-rules/{id}") - @Named("security-group-rule:get") - @GET - @SelectJson("security_group_rule") - @Fallback(Fallbacks.NullOnNotFoundOr404.class) - @Nullable - Rule get(@PathParam("id") String id); - - /** - * Creates a new Security Group Rule. - * - * @param securityGroupRule Describes the security group rule to be created. - * @return a reference of the newly-created security group rule. - */ - @Path("/security-group-rules") - @Named("security-group-rule:create") - @POST - @SelectJson("security_group_rule") - Rule create(@WrapWith("security_group_rule") Rule.CreateRule securityGroupRule); - - /** - * Deletes the specified Security Group Rule. - * - * @param id the id of the security group rule to delete. - * @return true if delete was successful, false if not. - */ - @Path("/security-group-rules/{id}") - @Named("security-group-rule:delete") - @DELETE - @Fallback(Fallbacks.FalseOnNotFoundOr404.class) - boolean deleteRule(@PathParam("id") String id); -}
