http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SubnetApi.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SubnetApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SubnetApi.java deleted file mode 100644 index 62fa7bb..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/features/SubnetApi.java +++ /dev/null @@ -1,145 +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.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.Subnet; -import org.jclouds.openstack.neutron.v2.domain.Subnets; -import org.jclouds.openstack.neutron.v2.fallbacks.EmptySubnetsFallback; -import org.jclouds.openstack.neutron.v2.functions.ParseSubnets; -import org.jclouds.openstack.neutron.v2.functions.SubnetsToPagedIterable; -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.collect.FluentIterable; - -/** - * Provides access to Subnet operations for the OpenStack Networking (Neutron) v2 API. - * - * @see <a href= - * "http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api doc</a> - */ -@Path("/subnets") -@RequestFilters(AuthenticateRequest.class) -@Consumes(MediaType.APPLICATION_JSON) -@Produces(MediaType.APPLICATION_JSON) -public interface SubnetApi { - - /** - * Returns the list of all subnets currently defined in Neutron for the current tenant. The list provides the unique - * identifier of each subnet configured for the tenant. - * - * @return the list of all subnet references configured for the tenant - */ - @Named("subnet:list") - @GET - @ResponseParser(ParseSubnets.class) - @Transform(SubnetsToPagedIterable.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - PagedIterable<Subnet> list(); - - /** - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a> - */ - @Named("subnet:list") - @GET - @ResponseParser(ParseSubnets.class) - @Fallback(EmptySubnetsFallback.class) - Subnets list(PaginationOptions options); - - /** - * Returns the specific Subnet. - * - * @param id the id of the subnet to return - * @return Subnet or null if not found - */ - @Named("subnet:get") - @GET - @Path("/{id}") - @SelectJson("subnet") - @Fallback(Fallbacks.NullOnNotFoundOr404.class) - @Nullable - Subnet get(@PathParam("id") String id); - - /** - * Create a subnet within a specified network - * - * @param subnet the subnet to be created - * @return a reference of the newly-created subnet - */ - @Named("subnet:create") - @POST - @SelectJson("subnet") - Subnet create(@WrapWith("subnet") Subnet.CreateSubnet subnet); - - /** - * Create multiple subnets - * - * @param subnets the bulk of subnets to create - * @return list of references of the newly-created subnets - */ - @Named("subnet:createBulk") - @POST - @SelectJson("subnets") - FluentIterable<Subnet> createBulk(@WrapWith("subnets") List<Subnet.CreateSubnet> subnets); - - /** - * Update a subnet - * - * @param id the id of the subnet to update - * @return true if update was successful, false if not - */ - @Named("subnet:update") - @PUT - @Path("/{id}") - @SelectJson("subnet") - Subnet update(@PathParam("id") String id, @WrapWith("subnet") Subnet.UpdateSubnet subnet); - - /** - * Delete a subnet - * - * @param id the id of the subnet to delete - * @return true if delete successful, false if not - */ - @Named("subnet: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/functions/FirewallPolicyToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallPolicyToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallPolicyToPagedIterable.java deleted file mode 100644 index f70a83d..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallPolicyToPagedIterable.java +++ /dev/null @@ -1,63 +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.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy; -import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures FirewallRule works as PagedIterable. - */ -public class FirewallPolicyToPagedIterable extends Arg0ToPagedIterable.FromCaller<FirewallPolicy, FirewallPolicyToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected FirewallPolicyToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final FWaaSApi firewallApi = api.getFWaaSApi(region).get(); - return new Function<Object, IterableWithMarker<FirewallPolicy>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<FirewallPolicy> apply(Object input) { - return IterableWithMarker.class.cast(firewallApi.listFirewallPolicies()); - } - - @Override - public String toString() { - return "listFirewallPolicies()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java deleted file mode 100644 index eff4dc1..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java +++ /dev/null @@ -1,63 +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.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.FirewallRule; -import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures FirewallRule works as PagedIterable. - */ -public class FirewallRuleToPagedIterable extends Arg0ToPagedIterable.FromCaller<FirewallRule, FirewallRuleToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected FirewallRuleToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<FirewallRule>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final FWaaSApi firewallApi = api.getFWaaSApi(region).get(); - return new Function<Object, IterableWithMarker<FirewallRule>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<FirewallRule> apply(Object input) { - return IterableWithMarker.class.cast(firewallApi.listFirewallRules()); - } - - @Override - public String toString() { - return "listFirewallRules()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java deleted file mode 100644 index 5d6892a..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java +++ /dev/null @@ -1,63 +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.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Firewall; -import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures Firewall works as PagedIterable. - */ -public class FirewallToPagedIterable extends Arg0ToPagedIterable.FromCaller<Firewall, FirewallToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected FirewallToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Firewall>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final FWaaSApi firewallApi = api.getFWaaSApi(region).get(); - return new Function<Object, IterableWithMarker<Firewall>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Firewall> apply(Object input) { - return IterableWithMarker.class.cast(firewallApi.list()); - } - - @Override - public String toString() { - return "listFirewalls()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FloatingIPsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FloatingIPsToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FloatingIPsToPagedIterable.java deleted file mode 100644 index 4d54d1f..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FloatingIPsToPagedIterable.java +++ /dev/null @@ -1,64 +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.functions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.FloatingIP; -import org.jclouds.openstack.neutron.v2.extensions.FloatingIPApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import javax.inject.Inject; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Ensures Floating IPs works as PagedIterable. - */ -public class FloatingIPsToPagedIterable extends Arg0ToPagedIterable.FromCaller<FloatingIP, FloatingIPsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected FloatingIPsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<FloatingIP>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final FloatingIPApi floatingIPApi = api.getFloatingIPApi(region).get(); - return new Function<Object, IterableWithMarker<FloatingIP>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<FloatingIP> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(floatingIPApi.list(paginationOptions)); - } - - @Override - public String toString() { - return "listfloatingIPs()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/NetworksToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/NetworksToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/NetworksToPagedIterable.java deleted file mode 100644 index c898381..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/NetworksToPagedIterable.java +++ /dev/null @@ -1,64 +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.functions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Network; -import org.jclouds.openstack.neutron.v2.features.NetworkApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import javax.inject.Inject; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Makes Networks work as a PagedIterable. - */ -public class NetworksToPagedIterable extends Arg0ToPagedIterable.FromCaller<Network, NetworksToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected NetworksToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Network>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final NetworkApi networkApi = api.getNetworkApi(region); - return new Function<Object, IterableWithMarker<Network>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Network> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(networkApi.list(paginationOptions)); - } - - @Override - public String toString() { - return "listNetworks()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.java deleted file mode 100644 index 4773e2b..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.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.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.FirewallPolicies; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseFirewallPolicies extends ParseJson<FirewallPolicies> { - - @Inject - public ParseFirewallPolicies(Json json) { - super(json, TypeLiteral.get(FirewallPolicies.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.java deleted file mode 100644 index 126a2ce..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.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.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.FirewallRules; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseFirewallRules extends ParseJson<FirewallRules> { - - @Inject - public ParseFirewallRules(Json json) { - super(json, TypeLiteral.get(FirewallRules.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.java deleted file mode 100644 index 89208cd..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.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.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.Firewalls; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseFirewalls extends ParseJson<Firewalls> { - - @Inject - public ParseFirewalls(Json json) { - super(json, TypeLiteral.get(Firewalls.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFloatingIPs.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFloatingIPs.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFloatingIPs.java deleted file mode 100644 index 6529627..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFloatingIPs.java +++ /dev/null @@ -1,37 +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.functions; - -import com.google.inject.TypeLiteral; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.FloatingIPs; - -import javax.inject.Inject; -import javax.inject.Singleton; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseFloatingIPs extends ParseJson<FloatingIPs> { - - @Inject - public ParseFloatingIPs(Json json) { - super(json, TypeLiteral.get(FloatingIPs.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseNetworks.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseNetworks.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseNetworks.java deleted file mode 100644 index 0f9b8aa..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseNetworks.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.functions; - - -import com.google.inject.TypeLiteral; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.Networks; - -import javax.inject.Inject; -import javax.inject.Singleton; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseNetworks extends ParseJson<Networks> { - - @Inject - public ParseNetworks(Json json) { - super(json, TypeLiteral.get(Networks.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParsePorts.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParsePorts.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParsePorts.java deleted file mode 100644 index ab169dd..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParsePorts.java +++ /dev/null @@ -1,37 +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.functions; - -import com.google.inject.TypeLiteral; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.Ports; - -import javax.inject.Inject; -import javax.inject.Singleton; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParsePorts extends ParseJson<Ports> { - - @Inject - public ParsePorts(Json json) { - super(json, TypeLiteral.get(Ports.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRouters.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRouters.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRouters.java deleted file mode 100644 index f0acde7..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRouters.java +++ /dev/null @@ -1,37 +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.functions; - -import com.google.inject.TypeLiteral; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.Routers; - -import javax.inject.Inject; -import javax.inject.Singleton; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseRouters extends ParseJson<Routers> { - - @Inject - public ParseRouters(Json json) { - super(json, TypeLiteral.get(Routers.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRules.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRules.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRules.java deleted file mode 100644 index 954180b..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseRules.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.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.Rules; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseRules extends ParseJson<Rules> { - - @Inject - public ParseRules(Json json) { - super(json, TypeLiteral.get(Rules.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSecurityGroups.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSecurityGroups.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSecurityGroups.java deleted file mode 100644 index 3864781..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSecurityGroups.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.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.SecurityGroups; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseSecurityGroups extends ParseJson<SecurityGroups> { - - @Inject - public ParseSecurityGroups(Json json) { - super(json, TypeLiteral.get(SecurityGroups.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSubnets.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSubnets.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSubnets.java deleted file mode 100644 index 0c985ee..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseSubnets.java +++ /dev/null @@ -1,37 +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.functions; - -import com.google.inject.TypeLiteral; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.Subnets; - -import javax.inject.Inject; -import javax.inject.Singleton; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseSubnets extends ParseJson<Subnets> { - - @Inject - public ParseSubnets(Json json) { - super(json, TypeLiteral.get(Subnets.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/PortsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/PortsToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/PortsToPagedIterable.java deleted file mode 100644 index cad5517..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/PortsToPagedIterable.java +++ /dev/null @@ -1,64 +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.functions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Port; -import org.jclouds.openstack.neutron.v2.features.PortApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import javax.inject.Inject; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Ensures Ports works as a paged iterable. - */ -public class PortsToPagedIterable extends Arg0ToPagedIterable.FromCaller<Port, PortsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected PortsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Port>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final PortApi portApi = api.getPortApi(region); - return new Function<Object, IterableWithMarker<Port>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Port> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(portApi.list(paginationOptions)); - } - - @Override - public String toString() { - return "listPortsInDetail()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RouterToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RouterToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RouterToPagedIterable.java deleted file mode 100644 index 5ce4def..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RouterToPagedIterable.java +++ /dev/null @@ -1,65 +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.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Router; -import org.jclouds.openstack.neutron.v2.extensions.RouterApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures Routers works as PagedIterable. - */ -public class RouterToPagedIterable extends Arg0ToPagedIterable.FromCaller<Router, RouterToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected RouterToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Router>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final RouterApi routerApi = api.getRouterApi(region).get(); - return new Function<Object, IterableWithMarker<Router>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Router> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(routerApi.list(paginationOptions)); - } - - @Override - public String toString() { - return "listRouters()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java deleted file mode 100644 index e4283c2..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java +++ /dev/null @@ -1,66 +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.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Rule; -import org.jclouds.openstack.neutron.v2.features.SecurityGroupApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures Routers works as PagedIterable. - */ -public class RulesToPagedIterable extends - Arg0ToPagedIterable.FromCaller<Rule, RulesToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected RulesToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Rule>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final SecurityGroupApi securityGroupApi = api.getSecurityGroupApi(region); - return new Function<Object, IterableWithMarker<Rule>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Rule> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(securityGroupApi.listRules(paginationOptions)); - } - - @Override - public String toString() { - return "listRules()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java deleted file mode 100644 index ddb4240..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java +++ /dev/null @@ -1,66 +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.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.SecurityGroup; -import org.jclouds.openstack.neutron.v2.features.SecurityGroupApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures Routers works as PagedIterable. - */ -public class SecurityGroupsToPagedIterable extends - Arg0ToPagedIterable.FromCaller<SecurityGroup, SecurityGroupsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected SecurityGroupsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<SecurityGroup>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final SecurityGroupApi securityGroupApi = api.getSecurityGroupApi(region); - return new Function<Object, IterableWithMarker<SecurityGroup>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<SecurityGroup> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(securityGroupApi.listSecurityGroups(paginationOptions)); - } - - @Override - public String toString() { - return "listSecurityGroups()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java deleted file mode 100644 index a5e6abe..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java +++ /dev/null @@ -1,64 +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.functions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Subnet; -import org.jclouds.openstack.neutron.v2.features.SubnetApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import javax.inject.Inject; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Ensures Subnets works as a PagedIterable. - */ -public class SubnetsToPagedIterable extends Arg0ToPagedIterable.FromCaller<Subnet, SubnetsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected SubnetsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Subnet>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final SubnetApi subnetApi = api.getSubnetApi(region); - return new Function<Object, IterableWithMarker<Subnet>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Subnet> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(subnetApi.list(paginationOptions)); - } - - @Override - public String toString() { - return "listSubnets()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/VersionAwareRegionToEndpoint.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/VersionAwareRegionToEndpoint.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/VersionAwareRegionToEndpoint.java deleted file mode 100644 index 36c93b9..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/VersionAwareRegionToEndpoint.java +++ /dev/null @@ -1,67 +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.functions; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -import java.net.URI; -import java.util.Map; - -import javax.inject.Inject; - -import org.jclouds.location.Region; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; - -public class VersionAwareRegionToEndpoint implements Function<Object, URI> { - - private final Supplier<Map<String, Supplier<URI>>> regionToEndpointSupplier; - - @Inject - public VersionAwareRegionToEndpoint(@Region Supplier<Map<String, Supplier<URI>>> regionToEndpointSupplier) { - this.regionToEndpointSupplier = checkNotNull(regionToEndpointSupplier, "regionToEndpointSupplier"); - } - - /** - * A quick fix to ensure Neutron works with endpoint definitions that are not version-agnostic. - * The service-side API will always have a v2.0 in the path. - * However, the endpoint will sometimes contain a v2.0 and sometimes it will not. - * The VersionAwareRegionToEndpoint ensures that the endpoint will always look the same - * before /v2.0 is added to it. - * - * Cannot leave labs until fixed: - * TODO: https://issues.apache.org/jira/browse/JCLOUDS-773 - * This code will be unnecessary once this is supported. - */ - @Override - public URI apply(Object from) { - Map<String, Supplier<URI>> regionToEndpoint = regionToEndpointSupplier.get(); - checkState(!regionToEndpoint.isEmpty(), "no region name to endpoint mappings configured!"); - checkArgument(regionToEndpoint.containsKey(from), - "requested location %s, which is not in the configured locations: %s", from, regionToEndpoint); - String uri = regionToEndpoint.get(from).get().toString(); - - if (uri.endsWith("/v2.0")) { - return URI.create(uri.substring(0, uri.length() - 5)); - } - - return regionToEndpoint.get(from).get(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java deleted file mode 100644 index e925b81..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java +++ /dev/null @@ -1,66 +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.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes HealthMonitors work as a PagedIterable. - */ -public class HealthMonitorsToPagedIterable extends - Arg0ToPagedIterable.FromCaller<HealthMonitor, HealthMonitorsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected HealthMonitorsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<HealthMonitor>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<HealthMonitor>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<HealthMonitor> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listHealthMonitors(paginationOptions)); - } - - @Override - public String toString() { - return "listHealthMonitors()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java deleted file mode 100644 index 23b1719..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java +++ /dev/null @@ -1,65 +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.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Member; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes Members work as a PagedIterable. - */ -public class MembersToPagedIterable extends Arg0ToPagedIterable.FromCaller<Member, MembersToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected MembersToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Member>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<Member>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Member> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listMembers(paginationOptions)); - } - - @Override - public String toString() { - return "listMembers()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java deleted file mode 100644 index d74ceaf..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.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.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseHealthMonitors extends ParseJson<HealthMonitors> { - - @Inject - public ParseHealthMonitors(Json json) { - super(json, TypeLiteral.get(HealthMonitors.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java deleted file mode 100644 index 252a5b0..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.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.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseMembers extends ParseJson<Members> { - - @Inject - public ParseMembers(Json json) { - super(json, TypeLiteral.get(Members.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java deleted file mode 100644 index adf81da..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.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.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParsePools extends ParseJson<Pools> { - - @Inject - public ParsePools(Json json) { - super(json, TypeLiteral.get(Pools.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java deleted file mode 100644 index d97710c..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.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.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseVIPs extends ParseJson<VIPs> { - - @Inject - public ParseVIPs(Json json) { - super(json, TypeLiteral.get(VIPs.class)); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java deleted file mode 100644 index c59b966..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java +++ /dev/null @@ -1,65 +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.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pool; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes Pools work as a PagedIterable. - */ -public class PoolsToPagedIterable extends Arg0ToPagedIterable.FromCaller<Pool, PoolsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected PoolsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Pool>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<Pool>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Pool> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listPools(paginationOptions)); - } - - @Override - public String toString() { - return "listPools()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java deleted file mode 100644 index 5731b2f..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java +++ /dev/null @@ -1,65 +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.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIP; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes VIPs work as a PagedIterable. - */ -public class VIPsToPagedIterable extends Arg0ToPagedIterable.FromCaller<VIP, VIPsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected VIPsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<VIP>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<VIP>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<VIP> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listVIPs(paginationOptions)); - } - - @Override - public String toString() { - return "listVIPs()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java deleted file mode 100644 index 5aaaae5..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java +++ /dev/null @@ -1,62 +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.handlers; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.HttpResponseException; -import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ResourceNotFoundException; - -import javax.inject.Singleton; - -import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream; - -/** - * This will parse and set an appropriate exception on the command object. - */ -@Singleton -public class NeutronErrorHandler implements HttpErrorHandler { - public void handleError(HttpCommand command, HttpResponse response) { - // it is important to always read fully and close streams - byte[] data = closeClientButKeepContentStream(response); - String message = data != null ? new String(data) : null; - - Exception exception = message != null ? new HttpResponseException(command, response, message) - : new HttpResponseException(command, response); - message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), - response.getStatusLine()); - switch (response.getStatusCode()) { - case 400: - break; - case 401: - case 403: - exception = new AuthorizationException(message, exception); - break; - case 404: - if (!command.getCurrentRequest().getMethod().equals("DELETE")) { - exception = new ResourceNotFoundException(message, exception); - } - break; - case 409: - exception = new IllegalStateException(exception.getMessage(), exception); - break; - } - command.setException(exception); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java deleted file mode 100644 index 98205fc..0000000 --- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java +++ /dev/null @@ -1,45 +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.options; - -import com.google.inject.Inject; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; -import org.jclouds.rest.binders.BindToJsonPayload; - -import java.util.Map; - -/** - * This class is used for methods who don't need a wrapper around their JSON body - * - */ -public class EmptyOptions implements MapBinder { - - @Inject - private BindToJsonPayload jsonBinder; - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - return bindToRequest(request, (Object) postParams); - } - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - return jsonBinder.bindToRequest(request, input); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/35142182/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java ---------------------------------------------------------------------- diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java deleted file mode 100644 index f38136a..0000000 --- a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2/NeutronApiMetadataTest.java +++ /dev/null @@ -1,33 +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; - -import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; -import org.jclouds.View; -import org.jclouds.apis.internal.BaseApiMetadataTest; -import org.testng.annotations.Test; - -/** - * The Neutron metadata test. - */ -@Test(groups = "unit", testName = "NeutronApiMetadataTest") -public class NeutronApiMetadataTest extends BaseApiMetadataTest { - public NeutronApiMetadataTest() { - super(new NeutronApiMetadata(), ImmutableSet.<TypeToken<? extends View>>of()); - } -}
