You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/08/20 11:36:13 UTC
[27/51] [abbrv] [partial] stratos git commit: Revert "Upgrading to
jclouds 1.9.1"
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/Subnet.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/Subnet.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/Subnet.java
new file mode 100644
index 0000000..d8be96c
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/Subnet.java
@@ -0,0 +1,264 @@
+/*
+ * 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_0.domain;
+
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableSet;
+
+import java.beans.ConstructorProperties;
+import java.util.Collection;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * A Neutron subnet
+ *
+ * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api doc</a>
+ */
+public class Subnet extends ReferenceWithName {
+
+ private final String networkId;
+ private final String gatewayIp;
+ private final Integer ipVersion;
+ private final String cidr;
+ private final Set<AllocationPool> allocationPools;
+ private final Boolean enableDhcp;
+ private final Set<String> dnsNameServers;
+ private final Set<HostRoute> hostRoutes;
+
+ @ConstructorProperties({
+ "id", "tenant_id", "name", "network_id", "gateway_ip", "ip_version", "cidr", "allocation_pools", "enable_dhcp", "dns_nameservers", "host_routes"
+ })
+ protected Subnet(String id, String tenantId, String name, String networkId,
+ String gatewayIp, Integer ipVersion, String cidr, Set<AllocationPool> allocationPools,
+ Boolean enableDhcp, Set<String> dnsNameServers, Set<HostRoute> hostRoutes) {
+ super(id, tenantId, name);
+ this.networkId = checkNotNull(networkId, "networkId");
+ this.gatewayIp = gatewayIp;
+ this.ipVersion = checkNotNull(ipVersion, "ipVersion");
+ this.cidr = checkNotNull(cidr, "cidr");
+ this.allocationPools = allocationPools != null ? ImmutableSet.copyOf(allocationPools) : ImmutableSet.<AllocationPool>of();
+ this.enableDhcp = enableDhcp;
+ this.dnsNameServers = dnsNameServers != null ? ImmutableSet.copyOf(dnsNameServers) : ImmutableSet.<String>of();
+ this.hostRoutes = hostRoutes != null ? ImmutableSet.copyOf(hostRoutes) : ImmutableSet.<HostRoute>of();
+ }
+
+ /**
+ * @return the id of the network this subnet is associated with
+ */
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ /**
+ * @return the default gateway used by devices in this subnet
+ */
+ public String getGatewayIp() {
+ return gatewayIp;
+ }
+
+ /**
+ * @return the ip version used by this subnet
+ */
+ public Integer getIpVersion() {
+ return ipVersion;
+ }
+
+ /**
+ * @return the cidr representing the IP range for this subnet, based on IP version
+ */
+ public String getCidr() {
+ return cidr;
+ }
+
+ /**
+ * @return the sub-ranges of cidr available for dynamic allocation to ports
+ */
+ public Set<AllocationPool> getAllocationPools() {
+ return allocationPools;
+ }
+
+ /**
+ * @return true if DHCP is enabled for this subnet, false if not.
+ */
+ public Boolean getEnableDhcp() {
+ return enableDhcp;
+ }
+
+ /**
+ * @return the set of DNS name servers used by hosts in this subnet.
+ */
+ public Set<String> getDnsNameServers() {
+ return dnsNameServers;
+ }
+
+ /**
+ * @return the set of routes that should be used by devices with IPs from this subnet
+ */
+ public Set<HostRoute> getHostRoutes() {
+ return hostRoutes;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), networkId, gatewayIp, ipVersion, cidr,
+ allocationPools, enableDhcp, dnsNameServers, hostRoutes);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Subnet that = Subnet.class.cast(obj);
+ return super.equals(obj)
+ && Objects.equal(this.networkId, that.networkId)
+ && Objects.equal(this.gatewayIp, that.gatewayIp)
+ && Objects.equal(this.ipVersion, that.ipVersion)
+ && Objects.equal(this.cidr, that.cidr)
+ && Objects.equal(this.allocationPools, that.allocationPools)
+ && Objects.equal(this.enableDhcp, that.enableDhcp)
+ && Objects.equal(this.dnsNameServers, that.dnsNameServers)
+ && Objects.equal(this.hostRoutes, that.hostRoutes);
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("networkId", networkId)
+ .add("gatewayIp", gatewayIp)
+ .add("ipVersion", ipVersion)
+ .add("cidr", cidr)
+ .add("enableDHCP", enableDhcp)
+ .add("allocationPools", allocationPools)
+ .add("dnsNameServers", dnsNameServers)
+ .add("hostRoutes", hostRoutes);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromSubnet(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> extends ReferenceWithName.Builder<T> {
+ protected String networkId;
+ protected String gatewayIp;
+ protected Integer ipVersion;
+ protected String cidr;
+ protected Set<AllocationPool> allocationPools;
+ protected Boolean enableDhcp;
+ protected Set<String> dnsNameServers;
+ protected Set<HostRoute> hostRoutes;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getNetworkId()
+ */
+ public T networkId(String networkId) {
+ this.networkId = networkId;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getGatewayIp()
+ */
+ public T gatewayIp(String gatewayIp) {
+ this.gatewayIp = gatewayIp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getIpVersion()
+ */
+ public T ipVersion(Integer ipVersion) {
+ this.ipVersion = ipVersion;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getCidr()
+ */
+ public T cidr(String cidr) {
+ this.cidr = cidr;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getAllocationPools()
+ */
+ public T allocationPools(Collection<AllocationPool> allocationPools) {
+ this.allocationPools = ImmutableSet.copyOf(allocationPools);
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getEnableDhcp()
+ */
+ public T enableDhcp(Boolean enableDhcp) {
+ this.enableDhcp = enableDhcp;
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getDnsNameServers()
+ */
+ public T dnsNameServers(Collection<String> dnsNameServers) {
+ this.dnsNameServers = ImmutableSet.copyOf(dnsNameServers);
+ return self();
+ }
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.domain.Subnet#getHostRoutes()
+ */
+ public T hostRoutes(Collection<HostRoute> hostRoutes) {
+ this.hostRoutes = ImmutableSet.copyOf(hostRoutes);
+ return self();
+ }
+
+ public Subnet build() {
+ return new Subnet(id, tenantId, name, networkId, gatewayIp, ipVersion, cidr, allocationPools, enableDhcp, dnsNameServers, hostRoutes);
+ }
+
+ public T fromSubnet(Subnet in) {
+ return super.fromReference(in)
+ .networkId(in.getNetworkId())
+ .gatewayIp(in.getGatewayIp())
+ .ipVersion(in.getIpVersion())
+ .cidr(in.getCidr())
+ .allocationPools(in.getAllocationPools())
+ .enableDhcp(in.getEnableDhcp())
+ .dnsNameServers(in.getDnsNameServers())
+ .hostRoutes(in.getHostRoutes());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/extensions/RouterApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/extensions/RouterApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/extensions/RouterApi.java
new file mode 100644
index 0000000..dca4427
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/extensions/RouterApi.java
@@ -0,0 +1,215 @@
+/*
+ * 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_0.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;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.domain.Router;
+import org.jclouds.openstack.neutron.v2_0.domain.RouterInterface;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseRouterDetails;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseRouters;
+import org.jclouds.openstack.neutron.v2_0.options.CreateRouterOptions;
+import org.jclouds.openstack.neutron.v2_0.options.EmptyOptions;
+import org.jclouds.openstack.neutron.v2_0.options.UpdateRouterOptions;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Transform;
+
+/**
+ * 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.
+ *
+ * @deprecated Please use {@link org.jclouds.openstack.neutron.v2.extensions.RouterApi} as this
+ * interface will be removed in jclouds 3.0.
+ */
+@Deprecated
+@Path("/v2.0/routers")
+@RequestFilters(AuthenticateRequest.class)
+@Consumes(MediaType.APPLICATION_JSON)
+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
+ @ResponseParser(ParseRouters.class)
+ @Transform(ParseRouters.ToPagedIterable.class)
+ @Fallback(Fallbacks.EmptyPagedIterableOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> 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(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> list(PaginationOptions options);
+
+ /**
+ * Returns all routers currently defined in Neutron for the current tenant.
+ *
+ * @return the list of all routers configured for the tenant
+ */
+ @Named("router:list")
+ @GET
+ @ResponseParser(ParseRouterDetails.class)
+ @Transform(ParseRouterDetails.ToPagedIterable.class)
+ @Fallback(Fallbacks.EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<? extends Router> listInDetail();
+
+ /**
+ * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a>
+ */
+ @Named("router:list")
+ @GET
+ @ResponseParser(ParseRouterDetails.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ PagedIterable<? extends Router> listInDetail(PaginationOptions options);
+
+ /**
+ * Returns the specific router.
+ *
+ * @param id the id of the router to return
+ * @return Router or null if not found
+ */
+ @Named("router:get")
+ @GET
+ @Path("/{id}")
+ @SelectJson("router")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Nullable
+ Router get(@PathParam("id") String id);
+
+ /**
+ * Create a new router
+ *
+ * @param options optional arguments
+ * @return the newly created router
+ */
+ @Named("router:create")
+ @POST
+ @SelectJson("router")
+ @MapBinder(CreateRouterOptions.class)
+ Router create(CreateRouterOptions... options);
+
+ /**
+ * Update a router
+ *
+ * @param id the id of the router to update
+ * @param options the attributes to update
+ * @return true if update successful, false if not
+ */
+ @Named("router:update")
+ @PUT
+ @Path("/{id}")
+ @MapBinder(UpdateRouterOptions.class)
+ @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
+ boolean update(@PathParam("id") String id, UpdateRouterOptions... options);
+
+ /**
+ * 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(Fallbacks.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)
+ 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)
+ boolean removeInterfaceForPort(@PathParam("id") String routerId, @PayloadParam("port_id") String portId);
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/NetworkApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/NetworkApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/NetworkApi.java
new file mode 100644
index 0000000..c2b4aa5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/NetworkApi.java
@@ -0,0 +1,178 @@
+/*
+ * 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_0.features;
+
+import com.google.common.collect.FluentIterable;
+import org.jclouds.Fallbacks;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.Network;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseNetworkDetails;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseNetworks;
+import org.jclouds.openstack.neutron.v2_0.options.CreateNetworkBulkOptions;
+import org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions;
+import org.jclouds.openstack.neutron.v2_0.options.UpdateNetworkOptions;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.QueryParams;
+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 javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.core.MediaType;
+
+import static org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import static org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
+
+/**
+ * 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>
+ * @deprecated Use v2 instead of v2_0
+ */
+@Deprecated
+@Path("/v2.0/networks")
+@RequestFilters(AuthenticateRequest.class)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface NetworkApi {
+
+ /**
+ * Returns the list of all networks 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 network references configured for the tenant
+ */
+ @Named("network:list")
+ @GET
+ @ResponseParser(ParseNetworks.class)
+ @Transform(ParseNetworks.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> 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(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> list(PaginationOptions options);
+
+ /**
+ * 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(ParseNetworkDetails.class)
+ @Transform(ParseNetworkDetails.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<? extends Network> listInDetail();
+
+ /**
+ * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a>
+ */
+ @Named("network:list")
+ @GET
+ @ResponseParser(ParseNetworkDetails.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ PagedIterable<? extends Network> listInDetail(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 options optional arguments
+ * @return a reference of the newly-created network
+ */
+ @Named("network:create")
+ @POST
+ @SelectJson("network")
+ @MapBinder(CreateNetworkOptions.class)
+ Network create(CreateNetworkOptions... options);
+
+ /**
+ * 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")
+ @MapBinder(CreateNetworkBulkOptions.class)
+ FluentIterable<? extends Network> createBulk(CreateNetworkBulkOptions networks);
+
+ /**
+ * Update a network
+ *
+ * @param id the id of the network to update
+ * @param options the attributes to update
+ * @return true if update successful, false if not
+ */
+ @Named("network:update")
+ @PUT
+ @Path("/{id}")
+ @MapBinder(UpdateNetworkOptions.class)
+ @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
+ boolean update(@PathParam("id") String id, UpdateNetworkOptions... options);
+
+ /**
+ * 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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/PortApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/PortApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/PortApi.java
new file mode 100644
index 0000000..7390131
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/PortApi.java
@@ -0,0 +1,182 @@
+/*
+ * 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_0.features;
+
+import com.google.common.collect.FluentIterable;
+import org.jclouds.Fallbacks;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.Port;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.functions.ParsePortDetails;
+import org.jclouds.openstack.neutron.v2_0.functions.ParsePorts;
+import org.jclouds.openstack.neutron.v2_0.options.CreatePortBulkOptions;
+import org.jclouds.openstack.neutron.v2_0.options.CreatePortOptions;
+import org.jclouds.openstack.neutron.v2_0.options.UpdatePortOptions;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.QueryParams;
+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 javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.core.MediaType;
+
+import static org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import static org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
+
+/**
+ * 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>
+ * @deprecated Use v2 instead of v2_0
+ */
+@Deprecated
+@Path("/v2.0/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
+ @ResponseParser(ParsePorts.class)
+ @Transform(ParsePorts.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> 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(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> list(PaginationOptions options);
+
+ /**
+ * Returns the set of ports currently defined in Neutron for the requested network.
+ *
+ * @return the list of all ports configured for the tenant
+ */
+ @Named("port:list")
+ @GET
+ @ResponseParser(ParsePortDetails.class)
+ @Transform(ParsePortDetails.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<? extends Port> listInDetail();
+
+ /**
+ * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a>
+ */
+ @Named("port:list")
+ @GET
+ @ResponseParser(ParsePortDetails.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ PagedIterable<? extends Port> listInDetail(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 networkId the id of the network to associate this port with
+ * @param options optional arguments
+ * @return a reference of the newly-created port
+ */
+ @Named("port:create")
+ @POST
+ @SelectJson("port")
+ @MapBinder(CreatePortOptions.class)
+ Port create(@PayloadParam("network_id") String networkId, CreatePortOptions... options);
+
+ /**
+ * 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")
+ @MapBinder(CreatePortBulkOptions.class)
+ FluentIterable<? extends Port> createBulk(CreatePortBulkOptions ports);
+
+ /**
+ * Update a port
+ *
+ * @param id the id of the port to update
+ * @param options the attributes to update
+ * @return true if update successful, false if not
+ */
+ @Named("port:update")
+ @PUT
+ @Path("/{id}")
+ @MapBinder(UpdatePortOptions.class)
+ @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
+ boolean update(@PathParam("id") String id, UpdatePortOptions... options);
+
+ /**
+ * 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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApi.java
new file mode 100644
index 0000000..5c2acc5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApi.java
@@ -0,0 +1,181 @@
+/*
+ * 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_0.features;
+
+import com.google.common.collect.FluentIterable;
+import org.jclouds.Fallbacks;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.domain.Subnet;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseSubnetDetails;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseSubnets;
+import org.jclouds.openstack.neutron.v2_0.options.CreateSubnetBulkOptions;
+import org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions;
+import org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.QueryParams;
+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 javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.core.MediaType;
+
+import static org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import static org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
+
+/**
+ * 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>
+ * @deprecated Use v2 instead of v2_0
+ */
+@Deprecated
+@Path("/v2.0/subnets")
+@RequestFilters(AuthenticateRequest.class)
+@Consumes(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(ParseSubnets.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> 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(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ @QueryParams(keys = {"fields", "fields", "fields"}, values = {"id", "tenant_id", "name"})
+ PagedIterable<? extends ReferenceWithName> list(PaginationOptions options);
+
+ /**
+ * Returns all subnets currently defined in Neutron for the current tenant.
+ *
+ * @return the list of all subnets configured for the tenant
+ */
+ @Named("subnet:list")
+ @GET
+ @ResponseParser(ParseSubnetDetails.class)
+ @Transform(ParseSubnetDetails.ToPagedIterable.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<? extends Subnet> listInDetail();
+
+ /**
+ * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a>
+ */
+ @Named("subnet:list")
+ @GET
+ @ResponseParser(ParseSubnetDetails.class)
+ @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
+ PagedIterable<? extends Subnet> listInDetail(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 networkId the id of the network to associate the subnet with
+ * @param ipVersion the ip version of this subnet
+ * @param cidr the cidr for this subnet
+ * @param options optional arugments
+ * @return a reference of the newly-created subnet
+ */
+ @Named("subnet:create")
+ @POST
+ @SelectJson("subnet")
+ @MapBinder(CreateSubnetOptions.class)
+ Subnet create(@PayloadParam("network_id") String networkId, @PayloadParam("ip_version") Integer ipVersion,
+ @PayloadParam("cidr") String cidr, CreateSubnetOptions... options);
+
+ /**
+ * 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")
+ @MapBinder(CreateSubnetBulkOptions.class)
+ FluentIterable<? extends Subnet> createBulk(CreateSubnetBulkOptions subnets);
+
+ /**
+ * Update a subnet
+ *
+ * @param id the id of the subnet to update
+ * @param options the attributes to update
+ * @return true if update was successful, false if not
+ */
+ @Named("subnet:update")
+ @PUT
+ @Path("/{id}")
+ @MapBinder(UpdateSubnetOptions.class)
+ @Fallback(Fallbacks.FalseOnNotFoundOr404.class)
+ boolean update(@PathParam("id") String id, UpdateSubnetOptions... options);
+
+ /**
+ * 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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworkDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworkDetails.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworkDetails.java
new file mode 100644
index 0000000..421bf71
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworkDetails.java
@@ -0,0 +1,93 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.Network;
+import org.jclouds.openstack.neutron.v2_0.features.NetworkApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseNetworkDetails.Networks;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParseNetworkDetails extends ParseJson<Networks> {
+ static class Networks extends PaginatedCollection<Network> {
+
+ @ConstructorProperties({ "networks", "networks_links" })
+ protected Networks(Iterable<Network> networks, Iterable<Link> networksLinks) {
+ super(networks, networksLinks);
+ }
+
+ }
+
+ @Inject
+ public ParseNetworkDetails(Json json) {
+ super(json, TypeLiteral.get(Networks.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Network, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Network>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final NetworkApi networkApi = api.getNetworkApiForZone(zone);
+ 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.listInDetail(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listNetworksInDetail()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworks.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworks.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworks.java
new file mode 100644
index 0000000..a1c1448
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseNetworks.java
@@ -0,0 +1,93 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.features.NetworkApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseNetworks.Networks;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParseNetworks extends ParseJson<Networks> {
+ static class Networks extends PaginatedCollection<ReferenceWithName> {
+
+ @ConstructorProperties({ "networks", "networks_links" })
+ protected Networks(Iterable<ReferenceWithName> networks, Iterable<Link> networksLinks) {
+ super(networks, networksLinks);
+ }
+
+ }
+
+ @Inject
+ public ParseNetworks(Json json) {
+ super(json, TypeLiteral.get(Networks.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<ReferenceWithName, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final NetworkApi networkApi = api.getNetworkApiForZone(zone);
+ return new Function<Object, IterableWithMarker<ReferenceWithName>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<ReferenceWithName> 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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePortDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePortDetails.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePortDetails.java
new file mode 100644
index 0000000..a4e461e
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePortDetails.java
@@ -0,0 +1,94 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.Port;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.features.PortApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParsePortDetails.Ports;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParsePortDetails extends ParseJson<Ports> {
+ static class Ports extends PaginatedCollection<Port> {
+
+ @ConstructorProperties({ "ports", "ports_links" })
+ protected Ports(Iterable<Port> ports, Iterable<Link> portsLinks) {
+ super(ports, portsLinks);
+ }
+
+ }
+
+ @Inject
+ public ParsePortDetails(Json json) {
+ super(json, TypeLiteral.get(Ports.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<ReferenceWithName, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final PortApi portApi = api.getPortApiForZone(zone);
+ return new Function<Object, IterableWithMarker<ReferenceWithName>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<ReferenceWithName> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(portApi.listInDetail(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listPortsInDetail()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePorts.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePorts.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePorts.java
new file mode 100644
index 0000000..1a11231
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParsePorts.java
@@ -0,0 +1,93 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.features.PortApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParsePorts.Ports;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParsePorts extends ParseJson<Ports> {
+ static class Ports extends PaginatedCollection<ReferenceWithName> {
+
+ @ConstructorProperties({ "ports", "ports_links" })
+ protected Ports(Iterable<ReferenceWithName> ports, Iterable<Link> portsLinks) {
+ super(ports, portsLinks);
+ }
+
+ }
+
+ @Inject
+ public ParsePorts(Json json) {
+ super(json, TypeLiteral.get(Ports.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<ReferenceWithName, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final PortApi portApi = api.getPortApiForZone(zone);
+ return new Function<Object, IterableWithMarker<ReferenceWithName>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<ReferenceWithName> apply(Object input) {
+ PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
+ return IterableWithMarker.class.cast(portApi.list(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listPorts()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouterDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouterDetails.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouterDetails.java
new file mode 100644
index 0000000..537cc97
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouterDetails.java
@@ -0,0 +1,93 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.openstack.v2_0.options.PaginationOptions.Builder.marker;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.Router;
+import org.jclouds.openstack.neutron.v2_0.extensions.RouterApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseRouterDetails.Routers;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParseRouterDetails extends ParseJson<Routers> {
+ static class Routers extends PaginatedCollection<Router> {
+
+ @ConstructorProperties({ "routers", "routers_links" })
+ protected Routers(Iterable<Router> routers, Iterable<Link> routersLinks) {
+ super(routers, routersLinks);
+ }
+
+ }
+
+ @Inject
+ public ParseRouterDetails(Json json) {
+ super(json, TypeLiteral.get(Routers.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Router, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Router>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
+ return new Function<Object, IterableWithMarker<Router>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<Router> apply(Object input) {
+ return IterableWithMarker.class.cast(routerApi.listInDetail(marker(input.toString())));
+ }
+
+ @Override
+ public String toString() {
+ return "listRoutersInDetail()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouters.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouters.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouters.java
new file mode 100644
index 0000000..eb612f4
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseRouters.java
@@ -0,0 +1,93 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.openstack.v2_0.options.PaginationOptions.Builder.marker;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.extensions.RouterApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseRouters.Routers;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParseRouters extends ParseJson<Routers> {
+ static class Routers extends PaginatedCollection<ReferenceWithName> {
+
+ @ConstructorProperties({ "routers", "routers_links" })
+ protected Routers(Iterable<ReferenceWithName> routers, Iterable<Link> routersLinks) {
+ super(routers, routersLinks);
+ }
+
+ }
+
+ @Inject
+ public ParseRouters(Json json) {
+ super(json, TypeLiteral.get(Routers.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<ReferenceWithName, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
+ return new Function<Object, IterableWithMarker<ReferenceWithName>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<ReferenceWithName> apply(Object input) {
+ return IterableWithMarker.class.cast(routerApi.list(marker(input.toString())));
+ }
+
+ @Override
+ public String toString() {
+ return "listRouters()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnetDetails.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnetDetails.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnetDetails.java
new file mode 100644
index 0000000..17201f2
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnetDetails.java
@@ -0,0 +1,93 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.Subnet;
+import org.jclouds.openstack.neutron.v2_0.features.SubnetApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseSubnetDetails.Subnets;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParseSubnetDetails extends ParseJson<Subnets> {
+ static class Subnets extends PaginatedCollection<Subnet> {
+
+ @ConstructorProperties({ "subnets", "subnets_links" })
+ protected Subnets(Iterable<Subnet> subnets, Iterable<Link> subnetsLinks) {
+ super(subnets, subnetsLinks);
+ }
+
+ }
+
+ @Inject
+ public ParseSubnetDetails(Json json) {
+ super(json, TypeLiteral.get(Subnets.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Subnet, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<Subnet>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final SubnetApi subnetApi = api.getSubnetApiForZone(zone);
+ 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.listInDetail(paginationOptions));
+ }
+
+ @Override
+ public String toString() {
+ return "listSubnetsInDetail()";
+ }
+ };
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnets.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnets.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnets.java
new file mode 100644
index 0000000..bc7ef13
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/functions/ParseSubnets.java
@@ -0,0 +1,93 @@
+/*
+ * 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_0.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.internal.Arg0ToPagedIterable;
+import org.jclouds.http.functions.ParseJson;
+import org.jclouds.json.Json;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.features.SubnetApi;
+import org.jclouds.openstack.neutron.v2_0.functions.ParseSubnets.Subnets;
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.inject.TypeLiteral;
+
+/**
+ */
+@Beta
+@Singleton
+public class ParseSubnets extends ParseJson<Subnets> {
+ static class Subnets extends PaginatedCollection<ReferenceWithName> {
+
+ @ConstructorProperties({ "subnets", "subnets_links" })
+ protected Subnets(Iterable<ReferenceWithName> subnets, Iterable<Link> subnetsLinks) {
+ super(subnets, subnetsLinks);
+ }
+
+ }
+
+ @Inject
+ public ParseSubnets(Json json) {
+ super(json, TypeLiteral.get(Subnets.class));
+ }
+
+ public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<ReferenceWithName, ToPagedIterable> {
+
+ private final NeutronApi api;
+
+ @Inject
+ protected ToPagedIterable(NeutronApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
+ String zone = arg0.isPresent() ? arg0.get().toString() : null;
+ final SubnetApi subnetApi = api.getSubnetApiForZone(zone);
+ return new Function<Object, IterableWithMarker<ReferenceWithName>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IterableWithMarker<ReferenceWithName> 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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/handlers/NeutronErrorHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/handlers/NeutronErrorHandler.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/handlers/NeutronErrorHandler.java
new file mode 100644
index 0000000..87c28c5
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/handlers/NeutronErrorHandler.java
@@ -0,0 +1,59 @@
+/*
+ * 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_0.handlers;
+
+import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
+
+import javax.inject.Singleton;
+
+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;
+
+/**
+ * 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;
+ }
+ command.setException(exception);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkBulkOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkBulkOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkBulkOptions.java
new file mode 100644
index 0000000..7410839
--- /dev/null
+++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/options/CreateNetworkBulkOptions.java
@@ -0,0 +1,138 @@
+/*
+ * 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_0.options;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.neutron.v2_0.domain.BulkNetwork;
+import org.jclouds.openstack.neutron.v2_0.domain.NetworkType;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import javax.inject.Inject;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions.CreateNetworkRequest;
+
+public class CreateNetworkBulkOptions implements MapBinder {
+
+ @Inject
+ private BindToJsonPayload jsonBinder;
+
+ public static Builder<?> builder() {
+ return new ConcreteBuilder();
+ }
+
+ public Builder<?> toBuilder() {
+ return new ConcreteBuilder().fromCreateNetworkOptions(this);
+ }
+
+ public abstract static class Builder<T extends Builder<T>> {
+ protected abstract T self();
+
+ protected List<BulkNetwork> networks;
+
+ /**
+ * @see org.jclouds.openstack.neutron.v2_0.options.CreateNetworkBulkOptions#getNetworks()
+ */
+ public T networks(Collection<BulkNetwork> networks) {
+ this.networks = ImmutableList.copyOf(networks);
+ return self();
+ }
+
+ public CreateNetworkBulkOptions build() {
+ return new CreateNetworkBulkOptions(networks);
+ }
+
+ public T fromCreateNetworkOptions(CreateNetworkBulkOptions in) {
+ return this.networks(in.getNetworks());
+ }
+ }
+
+ private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
+ @Override
+ protected ConcreteBuilder self() {
+ return this;
+ }
+ }
+
+ private final List<BulkNetwork> networks;
+
+ protected CreateNetworkBulkOptions() {
+ this.networks = Lists.newArrayList();
+ }
+
+ public CreateNetworkBulkOptions(List<BulkNetwork> networks) {
+ this.networks = networks != null ? ImmutableList.copyOf(networks) : Lists.<BulkNetwork>newArrayList();
+ }
+
+ /**
+ * @return the list of networks to create
+ */
+ public List<BulkNetwork> getNetworks() {
+ return networks;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ List<CreateNetworkRequest> createNetworkRequests = Lists.newArrayList();
+
+ for (BulkNetwork network : this.networks) {
+ if (network.getNetworkType() != null) {
+ //Validations for each NetworkType
+ if (network.getNetworkType() == NetworkType.FLAT) {
+ checkNotNull(network.getPhysicalNetworkName(), "physicalNetworkName must be present when networkType=FLAT");
+ } else if (network.getNetworkType() == NetworkType.VLAN) {
+ checkNotNull(network.getPhysicalNetworkName(), "physicalNetworkName must be present when networkType=VLAN");
+ checkNotNull(network.getSegmentationId(), "segmentationId must be present when networkType=VLAN");
+ } else if (network.getNetworkType() == NetworkType.GRE) {
+ checkNotNull(network.getSegmentationId(), "segmentationId must be present when NetworkType=GRE");
+ }
+ }
+
+ CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
+ if (network.getName() != null)
+ createNetworkRequest.name = network.getName();
+ if (network.getAdminStateUp() != null)
+ createNetworkRequest.admin_state_up = network.getAdminStateUp();
+ if (network.getExternal() != null)
+ createNetworkRequest.external = network.getExternal();
+ if (network.getNetworkType() != null)
+ createNetworkRequest.networkType = network.getNetworkType().getValue();
+ if (network.getPhysicalNetworkName() != null && (network.getNetworkType() == NetworkType.FLAT || network.getNetworkType() == NetworkType.VLAN))
+ createNetworkRequest.physicalNetworkName = network.getPhysicalNetworkName();
+ if (network.getSegmentationId() != null && (network.getNetworkType() == NetworkType.VLAN || network.getNetworkType() == NetworkType.GRE))
+ createNetworkRequest.segmentationId = network.getSegmentationId();
+
+ createNetworkRequests.add(createNetworkRequest);
+ }
+
+ return bindToRequest(request, ImmutableMap.of("networks", createNetworkRequests));
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return jsonBinder.bindToRequest(request, input);
+ }
+
+}