You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2014/10/02 22:08:21 UTC
[4/5] Support LBaaS v1
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java
new file mode 100644
index 0000000..d3539a9
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java
@@ -0,0 +1,493 @@
+/*
+ * 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.domain.lbaas.v1;
+
+import java.beans.ConstructorProperties;
+
+import javax.inject.Named;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * A Neutron LBaaS v1 VIP.
+ */
+public class VIP {
+
+ // Mandatory attributes when creating
+ @Named("tenant_id")
+ private String tenantId;
+ @Named("subnet_id")
+ private String subnetId;
+ private Protocol protocol;
+ @Named("protocol_port")
+ private Integer protocolPort;
+ // Mandatory attributes that can be updated
+ @Named("pool_id")
+ private String poolId;
+ // Optional attributes when creating
+ private String address;
+ // Optional attributes that can be updated
+ private String name;
+ private String description;
+ @Named("session_persistence")
+ private SessionPersistence sessionPersistence;
+ @Named("connection_limit")
+ private Integer connectionLimit;
+ @Named("admin_state_up")
+ private Boolean adminStateUp;
+ // Read-only attributes
+ private String id;
+ @Named("port_id")
+ private String portId;
+ private LBaaSStatus status;
+ @Named("status_description")
+ private String statusDescription;
+
+ /**
+ * Deserialization constructor.
+ */
+ @ConstructorProperties({ "id", "tenant_id", "name", "description", "subnet_id", "address", "port_id", "protocol",
+ "protocol_port", "pool_id", "session_persistence", "connection_limit", "admin_state_up", "status",
+ "status_description" })
+ private VIP(String id, String tenantId, String name, String description, String subnetId, String address,
+ String portId, Protocol protocol, Integer protocolPort, String poolId, SessionPersistence sessionPersistence,
+ Integer connectionLimit, Boolean adminStateUp, LBaaSStatus status, String statusDescription) {
+ this.id = id;
+ this.tenantId = tenantId;
+ this.name = name;
+ this.description = description;
+ this.subnetId = subnetId;
+ this.address = address;
+ this.portId = portId;
+ this.protocol = protocol;
+ this.protocolPort = protocolPort;
+ this.poolId = poolId;
+ this.sessionPersistence = sessionPersistence;
+ this.connectionLimit = connectionLimit;
+ this.adminStateUp = adminStateUp;
+ this.status = status;
+ this.statusDescription = statusDescription;
+ }
+
+ /**
+ * Default constructor.
+ */
+ private VIP() {
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param VIP the VIP to copy from.
+ */
+ private VIP(VIP vip) {
+ this(vip.id, vip.tenantId, vip.name, vip.description, vip.subnetId, vip.address, vip.portId, vip.protocol,
+ vip.protocolPort, vip.poolId, vip.sessionPersistence, vip.connectionLimit, vip.adminStateUp, vip.status,
+ vip.statusDescription);
+ }
+
+ /**
+ * @return the id of the VIP.
+ */
+ @Nullable
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return the tenant id of the VIP.
+ */
+ @Nullable
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * @return the name of the VIP.
+ */
+ @Nullable
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the description of the VIP.
+ */
+ @Nullable
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return the subnet id for this VIP.
+ */
+ @Nullable
+ public String getSubnetId() {
+ return subnetId;
+ }
+
+ /**
+ * @return the address for this VIP.
+ */
+ @Nullable
+ public String getAddress() {
+ return address;
+ }
+
+ /**
+ * @return the port id for this VIP.
+ */
+ @Nullable
+ public String getPortId() {
+ return portId;
+ }
+
+ /**
+ * @return the protocol for this VIP.
+ */
+ @Nullable
+ public Protocol getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * @return the protocol port for this VIP.
+ */
+ @Nullable
+ public Integer getProtocolPort() {
+ return protocolPort;
+ }
+
+ /**
+ * @return the pool id for this VIP.
+ */
+ @Nullable
+ public String getPoolId() {
+ return poolId;
+ }
+
+ /**
+ * @return the session persistence for this VIP.
+ */
+ @Nullable
+ public SessionPersistence getSessionPersistence() {
+ return sessionPersistence;
+ }
+
+ /**
+ * @return the connection limit for this VIP.
+ */
+ @Nullable
+ public Integer getConnectionLimit() {
+ return connectionLimit;
+ }
+
+ /**
+ * @return the administrative state for this VIP.
+ */
+ @Nullable
+ public Boolean getAdminStateUp() {
+ return adminStateUp;
+ }
+
+ /**
+ * @return the status for this VIP.
+ */
+ @Nullable
+ public LBaaSStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @return the status description for this VIP.
+ */
+ @Nullable
+ public String getStatusDescription() {
+ return statusDescription;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ VIP that = (VIP) o;
+
+ return Objects.equal(this.id, that.id) && Objects.equal(this.tenantId, that.tenantId)
+ && Objects.equal(this.name, that.name) && Objects.equal(this.description, that.description)
+ && Objects.equal(this.subnetId, that.subnetId) && Objects.equal(this.address, that.address)
+ && Objects.equal(this.portId, that.portId) && Objects.equal(this.protocol, that.protocol)
+ && Objects.equal(this.protocolPort, that.protocolPort) && Objects.equal(this.poolId, that.poolId)
+ && Objects.equal(this.sessionPersistence, that.sessionPersistence)
+ && Objects.equal(this.connectionLimit, that.connectionLimit)
+ && Objects.equal(this.adminStateUp, that.adminStateUp) && Objects.equal(this.status, that.status)
+ && Objects.equal(this.statusDescription, that.statusDescription);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, tenantId, name, description, subnetId, address, portId, protocol, protocolPort,
+ poolId, sessionPersistence, connectionLimit, adminStateUp, status, statusDescription);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this).add("id", id).add("tenantId", tenantId).add("name", name)
+ .add("description", description).add("subnetId", subnetId).add("address", address).add("portId", portId)
+ .add("protocol", protocol).add("protocolPort", protocolPort).add("poolId", poolId)
+ .add("sessionPersistence", sessionPersistence).add("connectionLimit", connectionLimit)
+ .add("adminStateUp", adminStateUp).add("status", status).add("statusDescription", statusDescription)
+ .toString();
+ }
+
+ /*
+ * Methods to get the Create and Update builders follow.
+ */
+
+ /**
+ * @return the Builder for creating a new VIP.
+ */
+ public static CreateBuilder createBuilder(String subnetId, Protocol protocol, Integer port, String poolId) {
+ return new CreateBuilder(subnetId, protocol, port, poolId);
+ }
+
+ /**
+ * @return the Builder for updating a VIP.
+ */
+ public static UpdateBuilder updateBuilder() {
+ return new UpdateBuilder();
+ }
+
+ private abstract static class Builder<ParameterizedBuilderType> {
+ protected VIP vip;
+
+ /**
+ * Default constructor.
+ */
+ private Builder() {
+ vip = new VIP();
+ }
+
+ protected abstract ParameterizedBuilderType self();
+
+ /**
+ * Provides the name for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getName()
+ */
+ public ParameterizedBuilderType name(String name) {
+ vip.name = name;
+ return self();
+ }
+
+ /**
+ * Provides the description for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getDescription()
+ */
+ public ParameterizedBuilderType description(String description) {
+ vip.description = description;
+ return self();
+ }
+
+ /**
+ * Provides the pool id for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getPoolId()
+ */
+ public ParameterizedBuilderType poolId(String poolId) {
+ vip.poolId = poolId;
+ return self();
+ }
+
+ /**
+ * Provides the session persistence for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getSessionPersistence()
+ */
+ public ParameterizedBuilderType sessionPersistence(SessionPersistence sessionPersistence) {
+ vip.sessionPersistence = sessionPersistence;
+ return self();
+ }
+
+ /**
+ * Provides the connection limit for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getConnectionLimit()
+ */
+ public ParameterizedBuilderType connectionLimit(Integer connectionLimit) {
+ vip.connectionLimit = connectionLimit;
+ return self();
+ }
+
+ /**
+ * Provides the administrative state for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getAdminStateUp()
+ */
+ public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) {
+ vip.adminStateUp = adminStateUp;
+ return self();
+ }
+ }
+
+ /**
+ * Create builder (inheriting from Builder).
+ */
+ public static class CreateBuilder extends Builder<CreateBuilder> {
+ /**
+ * Supply required properties for creating a VIP's CreateBuilder
+ */
+ private CreateBuilder(String subnetId, Protocol protocol, Integer port, String poolId) {
+ subnetId(subnetId).protocol(protocol).protocolPort(port).poolId(poolId);
+ }
+
+ /**
+ * Provides the tenantId for this VIP's Builder. Admin-only.
+ * When keystone is enabled, it is not mandatory to specify tenant_id for resources in create requests, as the
+ * tenant identifier will be derived from the Authentication token. Please note that the default authorization
+ * settings only allow administrative users to create resources on behalf of a different tenant.
+ *
+ * @return the Builder.
+ * @see VIP#getTenantId()
+ */
+ public CreateBuilder tenantId(String tenantId) {
+ vip.tenantId = tenantId;
+ return self();
+ }
+
+ /**
+ * Provides the subnet id for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getSubnetId()
+ */
+ public CreateBuilder subnetId(String subnetId) {
+ vip.subnetId = subnetId;
+ return self();
+ }
+
+ /**
+ * Provides the address for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getAddress()
+ */
+ public CreateBuilder address(String address) {
+ vip.address = address;
+ return self();
+ }
+
+ /**
+ * Provides the protocol for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getProtocol()
+ */
+ public CreateBuilder protocol(Protocol protocol) {
+ vip.protocol = protocol;
+ return self();
+ }
+
+ /**
+ * Provides the protocol port for this VIP's Builder.
+ *
+ * @return the Builder.
+ * @see VIP#getProtocolPort()
+ */
+ public CreateBuilder protocolPort(Integer protocolPort) {
+ vip.protocolPort = protocolPort;
+ return self();
+ }
+
+ /**
+ * @return a CreateVIP constructed with this Builder.
+ */
+ public CreateVIP build() {
+ return new CreateVIP(vip);
+ }
+
+ @Override
+ protected CreateBuilder self() {
+ return this;
+ }
+ }
+
+ /**
+ * Update builder (inheriting from Builder).
+ */
+ public static class UpdateBuilder extends Builder<UpdateBuilder> {
+ /**
+ * Supply required properties for creating a VIP's UpdateBuilder.
+ */
+ private UpdateBuilder() {
+ }
+
+ /**
+ * @return a UpdateVIP constructed with this Builder.
+ */
+ public UpdateVIP build() {
+ return new UpdateVIP(vip);
+ }
+
+ @Override
+ protected UpdateBuilder self() {
+ return this;
+ }
+ }
+
+ /**
+ * Create options - extend the domain class, passed to API create calls.
+ * Essentially the same as the domain class. Ensure validation and safe typing.
+ */
+ public static class CreateVIP extends VIP {
+ /**
+ * Copy constructor.
+ *
+ * @param vip the VIP to copy from.
+ */
+ private CreateVIP(VIP vip) {
+ super(vip);
+ }
+ }
+
+ /**
+ * Update options - extend the domain class, passed to API update calls.
+ * Essentially the same as the domain class. Ensure validation and safe typing.
+ */
+ public static class UpdateVIP extends VIP {
+ /**
+ * Copy constructor.
+ *
+ * @param vip the VIP to copy from.
+ */
+ private UpdateVIP(VIP vip) {
+ super(vip);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java
new file mode 100644
index 0000000..f53223d
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java
@@ -0,0 +1,36 @@
+/*
+ * 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.domain.lbaas.v1;
+
+import java.beans.ConstructorProperties;
+
+import org.jclouds.openstack.v2_0.domain.Link;
+import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * A collection of of Neutron LBaaS v1 VIPs.
+ */
+public class VIPs extends PaginatedCollection<VIP> {
+ public static final VIPs EMPTY = new VIPs(ImmutableSet.<VIP> of(), ImmutableSet.<Link> of());
+
+ @ConstructorProperties({ "vips", "vips_links" })
+ protected VIPs(Iterable<VIP> vips, Iterable<Link> vipsLinks) {
+ super(vips, vipsLinks);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java
index 00af74d..60d23a3 100644
--- a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java
@@ -28,6 +28,10 @@ public final class ExtensionNamespaces {
* Neutron Security Groups Extension
*/
public static final String SECURITY_GROUPS = "http://docs.openstack.org/ext/securitygroups/api/v2.0";
+ /**
+ * LBaaS Extension.
+ */
+ public static final String LBAAS = "http://wiki.openstack.org/neutron/LBaaS/API_1.0";
private ExtensionNamespaces() {
throw new AssertionError("intentionally unimplemented");
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java
new file mode 100644
index 0000000..dad80d8
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java
@@ -0,0 +1,426 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.neutron.v2.extensions.lbaas.v1;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Member;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pool;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIP;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs;
+import org.jclouds.openstack.neutron.v2.extensions.ExtensionNamespaces;
+import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyHealthMonitorsFallback;
+import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyMembersFallback;
+import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyPoolsFallback;
+import org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1.EmptyVIPsFallback;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.HealthMonitorsToPagedIterable;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.MembersToPagedIterable;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParseHealthMonitors;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParseMembers;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParsePools;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.ParseVIPs;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.PoolsToPagedIterable;
+import org.jclouds.openstack.neutron.v2.functions.lbaas.v1.VIPsToPagedIterable;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.options.PaginationOptions;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.annotations.WrapWith;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Provides access to load-balancing operations for the OpenStack Networking (Neutron) v2 API.
+ * <p/>
+ * LBaaS v1 is an extension to load-balance the traffic between instances and external networks.
+ */
+@Beta
+@Extension(of = ServiceType.NETWORK, namespace = ExtensionNamespaces.LBAAS)
+@Path("/lb")
+@RequestFilters(AuthenticateRequest.class)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface LBaaSApi {
+
+ /**
+ * Returns a list of VIPs to which the tenant has access. Default policy settings return only
+ * those VIPs that are owned by the tenant who submits the request, unless the request is submitted by an
+ * user with administrative rights.
+ *
+ * @return the list of all VIP references configured for the tenant.
+ */
+ @Named("vip:list")
+ @GET
+ @Path("/vips")
+ @Transform(VIPsToPagedIterable.class)
+ @ResponseParser(ParseVIPs.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<VIP> listVIPs();
+
+ /**
+ * @return the list of all VIP references configured for the tenant.
+ */
+ @Named("vip:list")
+ @GET
+ @Path("/vips")
+ @ResponseParser(ParseVIPs.class)
+ @Fallback(EmptyVIPsFallback.class)
+ VIPs listVIPs(PaginationOptions options);
+
+ /**
+ * Returns the details for a specific VIP.
+ *
+ * @param id the id of the VIP to return.
+ * @return VIP or null if not found.
+ */
+ @Named("vip:get")
+ @GET
+ @Path("/vips/{id}")
+ @SelectJson("vip")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ VIP getVIP(@PathParam("id") String id);
+
+ /**
+ * Creates a new VIP.
+ *
+ * @param vip describes the VIP to be created.
+ * @return a reference of the newly-created VIP.
+ */
+ @Named("vip:create")
+ @POST
+ @Path("/vips")
+ @SelectJson("vip")
+ VIP createVIP(@WrapWith("vip") VIP.CreateVIP vip);
+
+ /**
+ * Update a VIP.
+ *
+ * @param id the id of the VIP to update.
+ * @param vip the VIP's attributes to update.
+ * @return a reference of the updated VIP.
+ */
+ @Named("vip:update")
+ @PUT
+ @Path("/vips/{id}")
+ @SelectJson("vip")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ VIP updateVIP(@PathParam("id") String id, @WrapWith("vip") VIP.UpdateVIP vip);
+
+ /**
+ * Deletes the specified VIP.
+ *
+ * @param id the id of the VIP to delete.
+ * @return true if delete successful, false if not.
+ */
+ @Named("vip:delete")
+ @DELETE
+ @Path("/vips/{id}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ boolean deleteVIP(@PathParam("id") String id);
+
+ /**
+ * Returns a list of Pools to which the tenant has access. Default policy settings return only
+ * those Pools that are owned by the tenant who submits the request, unless the request is submitted by an
+ * user with administrative rights.
+ *
+ * @return the list of all Pool references configured for the tenant.
+ */
+ @Named("pool:list")
+ @GET
+ @Path("/pools")
+ @Transform(PoolsToPagedIterable.class)
+ @ResponseParser(ParsePools.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<Pool> listPools();
+
+ /**
+ * @return the list of all Pool references configured for the tenant.
+ */
+ @Named("pool:list")
+ @GET
+ @Path("/pools")
+ @ResponseParser(ParsePools.class)
+ @Fallback(EmptyPoolsFallback.class)
+ Pools listPools(PaginationOptions options);
+
+ /**
+ * Returns the details for a specific Pool.
+ *
+ * @param id the id of the Pool to return.
+ * @return Pool or null if not found.
+ */
+ @Named("pool:get")
+ @GET
+ @Path("/pools/{id}")
+ @SelectJson("pool")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ Pool getPool(@PathParam("id") String id);
+
+ /**
+ * Creates a new Pool.
+ *
+ * @param pool describes the Pool to be created.
+ * @return a reference of the newly-created Pool.
+ */
+ @Named("pool:create")
+ @POST
+ @Path("/pools")
+ @SelectJson("pool")
+ Pool createPool(@WrapWith("pool") Pool.CreatePool pool);
+
+ /**
+ * Update a Pool.
+ *
+ * @param id the id of the Pool to update.
+ * @param pool the Pool's attributes to update.
+ * @return a reference of the updated Pool.
+ */
+ @Named("pool:update")
+ @PUT
+ @Path("/pools/{id}")
+ @SelectJson("pool")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ Pool updatePool(@PathParam("id") String id, @WrapWith("pool") Pool.UpdatePool pool);
+
+ /**
+ * Deletes the specified Pool.
+ *
+ * @param id the id of the Pool to delete.
+ * @return true if delete successful, false if not.
+ */
+ @Named("pool:delete")
+ @DELETE
+ @Path("/pools/{id}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ boolean deletePool(@PathParam("id") String id);
+
+ /**
+ * Returns a list of Members to which the tenant has access. Default policy settings return only
+ * those Members that are owned by the tenant who submits the request, unless the request is submitted by an
+ * user with administrative rights.
+ *
+ * @return the list of all Member references configured for the tenant.
+ */
+ @Named("member:list")
+ @GET
+ @Path("/members")
+ @Transform(MembersToPagedIterable.class)
+ @ResponseParser(ParseMembers.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<Member> listMembers();
+
+ /**
+ * @return the list of all Member references configured for the tenant.
+ */
+ @Named("member:list")
+ @GET
+ @Path("/members")
+ @ResponseParser(ParseMembers.class)
+ @Fallback(EmptyMembersFallback.class)
+ Members listMembers(PaginationOptions options);
+
+ /**
+ * Returns the details for a specific Member.
+ *
+ * @param id the id of the Member to return.
+ * @return Member or null if not found.
+ */
+ @Named("member:get")
+ @GET
+ @Path("/members/{id}")
+ @SelectJson("member")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ Member getMember(@PathParam("id") String id);
+
+ /**
+ * Creates a new Member.
+ *
+ * @param member describes the Member to be created.
+ * @return a reference of the newly-created Member.
+ */
+ @Named("member:create")
+ @POST
+ @Path("/members")
+ @SelectJson("member")
+ Member createMember(@WrapWith("member") Member.CreateMember member);
+
+ /**
+ * Update a Member.
+ *
+ * @param id the id of the Member to update.
+ * @param member the Member's attributes to update.
+ * @return a reference of the updated Member.
+ */
+ @Named("member:update")
+ @PUT
+ @Path("/members/{id}")
+ @SelectJson("member")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ Member updateMember(@PathParam("id") String id, @WrapWith("member") Member.UpdateMember member);
+
+ /**
+ * Deletes the specified Member.
+ *
+ * @param id the id of the Member to delete.
+ * @return true if delete successful, false if not.
+ */
+ @Named("member:delete")
+ @DELETE
+ @Path("/members/{id}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ boolean deleteMember(@PathParam("id") String id);
+
+ /**
+ * Returns a list of HealthMonitors to which the tenant has access. Default policy settings return only
+ * those HealthMonitors that are owned by the tenant who submits the request, unless the request is submitted by an
+ * user with administrative rights.
+ *
+ * @return the list of all HealthMonitor references configured for the tenant.
+ */
+ @Named("health_monitor:list")
+ @GET
+ @Path("/health_monitors")
+ @Transform(HealthMonitorsToPagedIterable.class)
+ @ResponseParser(ParseHealthMonitors.class)
+ @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
+ PagedIterable<HealthMonitor> listHealthMonitors();
+
+ /**
+ * @return the list of all HealthMonitor references configured for the tenant.
+ */
+ @Named("health_monitor:list")
+ @GET
+ @Path("/health_monitors")
+ @ResponseParser(ParseHealthMonitors.class)
+ @Fallback(EmptyHealthMonitorsFallback.class)
+ HealthMonitors listHealthMonitors(PaginationOptions options);
+
+ /**
+ * Returns the details for a specific HealthMonitor.
+ *
+ * @param id the id of the HealthMonitor to return.
+ * @return Health Monitor or null if not found.
+ */
+ @Named("health_monitor:get")
+ @GET
+ @Path("/health_monitors/{id}")
+ @SelectJson("health_monitor")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ HealthMonitor getHealthMonitor(@PathParam("id") String id);
+
+ /**
+ * Creates a new HealthMonitor.
+ *
+ * @param healthMonitor describes the HealthMonitor to be created.
+ * @return a reference of the newly-created HealthMonitor.
+ */
+ @Named("health_monitor:create")
+ @POST
+ @Path("/health_monitors")
+ @SelectJson("health_monitor")
+ HealthMonitor createHealthMonitor(@WrapWith("health_monitor") HealthMonitor.CreateHealthMonitor healthMonitor);
+
+ /**
+ * Update a HealthMonitor.
+ *
+ * @param id the id of the HealthMonitor to update.
+ * @param healthMonitor the HealthMonitor's attributes to update.
+ * @return a reference of the updated HealthMonitor.
+ */
+ @Named("health_monitor:update")
+ @PUT
+ @Path("/health_monitors/{id}")
+ @SelectJson("health_monitor")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ HealthMonitor updateHealthMonitor(@PathParam("id") String id,
+ @WrapWith("health_monitor") HealthMonitor.UpdateHealthMonitor healthMonitor);
+
+ /**
+ * Deletes the specified Health Monitor.
+ *
+ * @param id the id of the Health Monitor to delete.
+ * @return true if delete successful, false if not.
+ */
+ @Named("health_monitor:delete")
+ @DELETE
+ @Path("/health_monitors/{id}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ boolean deleteHealthMonitor(@PathParam("id") String id);
+
+ /**
+ * Associate a HealthMonitor to a Pool.
+ *
+ * @param poolId the id of the Pool to associate.
+ * @param healthMonitorId the id of the HealthMonitor to associate.
+ * @return the newly associated HealthMonitor.
+ */
+ @Named("pool:associate_health_monitor")
+ @POST
+ @Path("/pools/{pool-id}/health_monitors")
+ @SelectJson("health_monitor")
+ @Payload("%7B\"health_monitor\":%7B\"id\":\"{healthMonitorId}\"%7D%7D")
+ @Produces(MediaType.APPLICATION_JSON)
+ HealthMonitor associateHealthMonitor(@PathParam("pool-id") String poolId,
+ @PayloadParam("healthMonitorId") String healthMonitorId);
+
+ /**
+ * Disassociate a HealthMonitor from a Pool.
+ *
+ * @param poolId the id of the Pool to disassociate.
+ * @param healthMonitorId the id of the HealthMonitor to disassociate.
+ * @return true if disassociate successful, false if not.
+ */
+ @Named("pool:disassociate_health_monitor")
+ @DELETE
+ @Path("/pools/{pool-id}/health_monitors/{health-monitor-id}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ boolean disassociateHealthMonitor(@PathParam("pool-id") String poolId,
+ @PathParam("health-monitor-id") String healthMonitorId);
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java
new file mode 100644
index 0000000..f298a9c
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Throwables.propagate;
+import static com.google.common.util.concurrent.Futures.immediateFuture;
+import static org.jclouds.http.HttpUtils.contains404;
+import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
+
+import org.jclouds.Fallback;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors;
+import org.jclouds.rest.ResourceNotFoundException;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class EmptyHealthMonitorsFallback implements Fallback<HealthMonitors> {
+
+ public ListenableFuture<HealthMonitors> create(Throwable t) throws Exception {
+ return immediateFuture(createOrPropagate(t));
+ }
+
+ @Override
+ public HealthMonitors createOrPropagate(Throwable t) throws Exception {
+ if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
+ || contains404(t)) {
+ return HealthMonitors.EMPTY;
+ }
+ throw propagate(t);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java
new file mode 100644
index 0000000..1cbc38f
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Throwables.propagate;
+import static com.google.common.util.concurrent.Futures.immediateFuture;
+import static org.jclouds.http.HttpUtils.contains404;
+import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
+
+import org.jclouds.Fallback;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members;
+import org.jclouds.rest.ResourceNotFoundException;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class EmptyMembersFallback implements Fallback<Members> {
+
+ public ListenableFuture<Members> create(Throwable t) throws Exception {
+ return immediateFuture(createOrPropagate(t));
+ }
+
+ @Override
+ public Members createOrPropagate(Throwable t) throws Exception {
+ if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
+ || contains404(t)) {
+ return Members.EMPTY;
+ }
+ throw propagate(t);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java
new file mode 100644
index 0000000..8035c6f
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Throwables.propagate;
+import static com.google.common.util.concurrent.Futures.immediateFuture;
+import static org.jclouds.http.HttpUtils.contains404;
+import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
+
+import org.jclouds.Fallback;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools;
+import org.jclouds.rest.ResourceNotFoundException;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class EmptyPoolsFallback implements Fallback<Pools> {
+
+ public ListenableFuture<Pools> create(Throwable t) throws Exception {
+ return immediateFuture(createOrPropagate(t));
+ }
+
+ @Override
+ public Pools createOrPropagate(Throwable t) throws Exception {
+ if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
+ || contains404(t)) {
+ return Pools.EMPTY;
+ }
+ throw propagate(t);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java
new file mode 100644
index 0000000..df3aa90
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Throwables.propagate;
+import static com.google.common.util.concurrent.Futures.immediateFuture;
+import static org.jclouds.http.HttpUtils.contains404;
+import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
+
+import org.jclouds.Fallback;
+import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs;
+import org.jclouds.rest.ResourceNotFoundException;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+public class EmptyVIPsFallback implements Fallback<VIPs> {
+
+ public ListenableFuture<VIPs> create(Throwable t) throws Exception {
+ return immediateFuture(createOrPropagate(t));
+ }
+
+ @Override
+ public VIPs createOrPropagate(Throwable t) throws Exception {
+ if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)
+ || contains404(t)) {
+ return VIPs.EMPTY;
+ }
+ throw propagate(t);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/0675d2ea/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
new file mode 100644
index 0000000..e925b81
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java
@@ -0,0 +1,66 @@
+/*
+ * 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/0675d2ea/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
new file mode 100644
index 0000000..23b1719
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java
@@ -0,0 +1,65 @@
+/*
+ * 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/0675d2ea/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
new file mode 100644
index 0000000..d74ceaf
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java
@@ -0,0 +1,38 @@
+/*
+ * 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/0675d2ea/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
new file mode 100644
index 0000000..252a5b0
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java
@@ -0,0 +1,38 @@
+/*
+ * 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/0675d2ea/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
new file mode 100644
index 0000000..adf81da
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java
@@ -0,0 +1,38 @@
+/*
+ * 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/0675d2ea/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
new file mode 100644
index 0000000..d97710c
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java
@@ -0,0 +1,38 @@
+/*
+ * 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/0675d2ea/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
new file mode 100644
index 0000000..c59b966
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java
@@ -0,0 +1,65 @@
+/*
+ * 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/0675d2ea/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
new file mode 100644
index 0000000..5731b2f
--- /dev/null
+++ b/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java
@@ -0,0 +1,65 @@
+/*
+ * 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()";
+ }
+ };
+ }
+
+}