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/domain/lbaas/v1/VIP.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java new file mode 100644 index 0000000..ae62625 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIP.java @@ -0,0 +1,492 @@ +/* + * 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.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 Objects.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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/VIPs.java new file mode 100644 index 0000000..f53223d --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java new file mode 100644 index 0000000..60d23a3 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.openstack.neutron.v2.extensions; + +/** + * Extension Namespaces for OpenStack Networking (Neutron). + */ +public final class ExtensionNamespaces { + /** + * Neutron Layer-3 Router Extension + */ + public static final String L3_ROUTER = "http://docs.openstack.org/ext/neutron/router/api/v1.0"; + /** + * Neutron Security Groups Extension + */ + public static final String SECURITY_GROUPS = "http://docs.openstack.org/ext/securitygroups/api/v2.0"; + /** + * LBaaS Extension. + */ + public static final String LBAAS = "http://wiki.openstack.org/neutron/LBaaS/API_1.0"; + + private ExtensionNamespaces() { + throw new AssertionError("intentionally unimplemented"); + } +} 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/extensions/FloatingIPApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApi.java new file mode 100644 index 0000000..9a65543 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FloatingIPApi.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.extensions; + +import javax.inject.Named; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.MediaType; + +import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; +import org.jclouds.Fallbacks.FalseOnNotFoundOr404; +import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.collect.PagedIterable; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; +import org.jclouds.openstack.neutron.v2.domain.FloatingIP; +import org.jclouds.openstack.neutron.v2.domain.FloatingIPs; +import org.jclouds.openstack.neutron.v2.fallbacks.EmptyFloatingIPsFallback; +import org.jclouds.openstack.neutron.v2.functions.FloatingIPsToPagedIterable; +import org.jclouds.openstack.neutron.v2.functions.ParseFloatingIPs; +import org.jclouds.openstack.v2_0.options.PaginationOptions; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.annotations.Transform; +import org.jclouds.rest.annotations.WrapWith; + +import com.google.common.annotations.Beta; + +/** + * Provides access to Floating IP operations for the OpenStack Networking (Neutron) v2 API. + * <p/> + * A floating IP is an IP address on an external network, which is associated with a specific port, and optionally a + * specific IP address, on a private OpenStack Networking network. Therefore a floating IP allows access to an + * instance on a private network from an external network. Floating IPs can only be defined on networks for which the + * attribute floatingip:external (by the external network extension) has been set to True. + */ +@Beta +@Path("/floatingips") +@RequestFilters(AuthenticateRequest.class) +@Consumes(MediaType.APPLICATION_JSON) +public interface FloatingIPApi { + + /** + * Returns a list of floating IPs to which the tenant has access. Default policy settings return only + * those floating IPs that are owned by the tenant who submits the request, unless the request is submitted by an + * user with administrative rights. + * + * @return the list of all floatingIP references configured for the tenant. + */ + @Named("floatingip:list") + @GET + @Transform(FloatingIPsToPagedIterable.class) + @ResponseParser(ParseFloatingIPs.class) + @Fallback(EmptyPagedIterableOnNotFoundOr404.class) + PagedIterable<FloatingIP> list(); + + /** + * @return the list of all floatingIP references configured for the tenant. + */ + @Named("floatingip:list") + @GET + @ResponseParser(ParseFloatingIPs.class) + @Fallback(EmptyFloatingIPsFallback.class) + FloatingIPs list(PaginationOptions options); + + /** + * Returns the details for a specific floating IP. + * + * @param id the id of the floatingIP to return + * @return FloatingIPs collection or empty if not found + */ + @Named("floatingip:get") + @GET + @Path("/{id}") + @SelectJson("floatingip") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + FloatingIP get(@PathParam("id") String id); + + /** + * Creates a floating IP. + * + * @param createFloatingIP Options for creating a Floating IP + * @return the newly created Floating IP + */ + @Named("floatingip:create") + @POST + @SelectJson("floatingip") + FloatingIP create(@WrapWith("floatingip") FloatingIP.CreateFloatingIP createFloatingIP); + + /** + * Update a Floating IP + * + * @param id the id of the Floating IP to update + * @param updateFloatingIP Contains only the attributes to update + * @return The modified Floating IP + */ + @Named("floatingip:update") + @PUT + @Path("/{id}") + @SelectJson("floatingip") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + FloatingIP update(@PathParam("id") String id, @WrapWith("floatingip") FloatingIP.UpdateFloatingIP updateFloatingIP); + + /** + * Deletes the specified floatingIP + * + * @param id the id of the floatingIP to delete + * @return true if delete successful, false if not + */ + @Named("floatingip:delete") + @DELETE + @Path("/{id}") + @Fallback(FalseOnNotFoundOr404.class) + boolean delete(@PathParam("id") String id); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java new file mode 100644 index 0000000..e259d69 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/RouterApi.java @@ -0,0 +1,198 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.openstack.neutron.v2.extensions; + +import javax.inject.Named; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.MediaType; + +import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; +import org.jclouds.Fallbacks.FalseOnNotFoundOr404; +import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.collect.PagedIterable; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; +import org.jclouds.openstack.neutron.v2.domain.Router; +import org.jclouds.openstack.neutron.v2.domain.RouterInterface; +import org.jclouds.openstack.neutron.v2.domain.Routers; +import org.jclouds.openstack.neutron.v2.fallbacks.EmptyRoutersFallback; +import org.jclouds.openstack.neutron.v2.functions.ParseRouters; +import org.jclouds.openstack.neutron.v2.functions.RouterToPagedIterable; +import org.jclouds.openstack.neutron.v2.options.EmptyOptions; +import org.jclouds.openstack.v2_0.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.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.annotations.Transform; +import org.jclouds.rest.annotations.WrapWith; + +import com.google.common.annotations.Beta; + +/** + * Provides access to Router operations for the OpenStack Networking (Neutron) v2 API. + * <p/> + * A logical entity for forwarding packets across internal subnets and NATting them on external + * networks through an appropriate external gateway. + * + * @see <a href= + * "http://docs.openstack.org/api/openstack-network/2.0/content/router_ext.html">api doc</a> + */ +@Beta +@Path("/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 + @Transform(RouterToPagedIterable.class) + @ResponseParser(ParseRouters.class) + @Fallback(EmptyPagedIterableOnNotFoundOr404.class) + PagedIterable<Router> list(); + + /** + * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/pagination.html">api doc</a> + */ + @Named("router:list") + @GET + @ResponseParser(ParseRouters.class) + @Fallback(EmptyRoutersFallback.class) + Routers list(PaginationOptions options); + + /** + * Returns a Routers collection that should contain a single router with the id requested. + * + * @param id the id of the router to return + * @return Routers collection or empty if not found + */ + @Named("router:get") + @GET + @Path("/{id}") + @SelectJson("router") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + Router get(@PathParam("id") String id); + + /** + * Create a new router + * + * @param router Options for creating a router + * @return the newly created router + */ + @Named("router:create") + @POST + @SelectJson("router") + Router create(@WrapWith("router") Router.CreateRouter router); + + /** + * Update a router + * + * @param id the id of the router to update + * @param router Contains only the attributes to update + * @return The modified router + */ + @Named("router:update") + @PUT + @Path("/{id}") + @SelectJson("router") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + Router update(@PathParam("id") String id, @WrapWith("router") Router.UpdateRouter router); + + /** + * Deletes the specified router + * + * @param id the id of the router to delete + * @return true if delete successful, false if not + */ + @Named("router:delete") + @DELETE + @Path("/{id}") + @Fallback(FalseOnNotFoundOr404.class) + boolean delete(@PathParam("id") String id); + + /** + * Add a interface to a router to connect to the specified subnet + * + * @param routerId the id of the router to create the interface at + * @param subnetId the id of the subnet to connect with the interface + * @return the newly-created router interface + */ + @Named("router:addInterfaceForSubnet") + @PUT + @Path("/{id}/add_router_interface") + @MapBinder(EmptyOptions.class) + @Fallback(NullOnNotFoundOr404.class) + @Nullable + 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) + @Fallback(NullOnNotFoundOr404.class) + @Nullable + RouterInterface addInterfaceForPort(@PathParam("id") String routerId, @PayloadParam("port_id") String portId); + + /** + * Remove the interface where the specified subnet is connected to + * + * @param routerId the id of the router to remove the interface from + * @param subnetId the id of the subnet to disconnect from the interface + */ + @Named("router:removeInterfaceForSubnet") + @PUT + @Path("/{id}/remove_router_interface") + @MapBinder(EmptyOptions.class) + @Fallback(FalseOnNotFoundOr404.class) + boolean removeInterfaceForSubnet(@PathParam("id") String routerId, @PayloadParam("subnet_id") String subnetId); + + /** + * Remove the interface where the specified port is connected to + * + * @param routerId the id of the router to remove the interface from + * @param portId the id of the port to disconnect from the interface + */ + @Named("router:removeInterfaceForPort") + @PUT + @Path("/{id}/remove_router_interface") + @MapBinder(EmptyOptions.class) + @Fallback(FalseOnNotFoundOr404.class) + boolean removeInterfaceForPort(@PathParam("id") String routerId, @PayloadParam("port_id") String portId); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/SecurityGroupApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/SecurityGroupApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/SecurityGroupApi.java new file mode 100644 index 0000000..0832d4c --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/SecurityGroupApi.java @@ -0,0 +1,186 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.openstack.neutron.v2.extensions; + +import javax.inject.Named; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.jclouds.Fallbacks; +import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; +import org.jclouds.collect.PagedIterable; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; +import org.jclouds.openstack.neutron.v2.domain.Rule; +import org.jclouds.openstack.neutron.v2.domain.Rules; +import org.jclouds.openstack.neutron.v2.domain.SecurityGroup; +import org.jclouds.openstack.neutron.v2.domain.SecurityGroups; +import org.jclouds.openstack.neutron.v2.fallbacks.EmptyRulesFallback; +import org.jclouds.openstack.neutron.v2.fallbacks.EmptySecurityGroupsFallback; +import org.jclouds.openstack.neutron.v2.functions.ParseRules; +import org.jclouds.openstack.neutron.v2.functions.ParseSecurityGroups; +import org.jclouds.openstack.neutron.v2.functions.RulesToPagedIterable; +import org.jclouds.openstack.neutron.v2.functions.SecurityGroupsToPagedIterable; +import org.jclouds.openstack.v2_0.options.PaginationOptions; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.annotations.Transform; +import org.jclouds.rest.annotations.WrapWith; +import com.google.common.annotations.Beta; + +/** + * Provides access to Security Group extension operations for the OpenStack Networking (Neutron) v2 API. + * <p/> + * Security groups and security group rules allows administrators and tenants the ability to specify the type of + * traffic and direction (ingress/egress) that is allowed to pass through a port. A security group is a container for + * security group rules. + */ +@Beta +@RequestFilters(AuthenticateRequest.class) +@Consumes(MediaType.APPLICATION_JSON) +@Produces(MediaType.APPLICATION_JSON) +public interface SecurityGroupApi { + /** + * Groups + */ + + /** + * @return all security groups currently defined in Neutron for the current tenant. + */ + @Path("/security-groups") + @Named("security-group:list") + @GET + @ResponseParser(ParseSecurityGroups.class) + @Transform(SecurityGroupsToPagedIterable.class) + @Fallback(EmptyPagedIterableOnNotFoundOr404.class) + PagedIterable<SecurityGroup> listSecurityGroups(); + + /** + * @return all security groups currently defined in Neutron for the current tenant. + */ + @Path("/security-groups") + @Named("security-group:list") + @GET + @ResponseParser(ParseSecurityGroups.class) + @Fallback(EmptySecurityGroupsFallback.class) + SecurityGroups listSecurityGroups(PaginationOptions options); + + /** + * @param id the id of the security group to return + * @return SecurityGroup or null if not found. + */ + @Path("/security-groups/{id}") + @Named("security-group:get") + @GET + @SelectJson("security_group") + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Nullable + SecurityGroup getSecurityGroup(@PathParam("id") String id); + + /** + * Creates a new SecurityGroup. + * + * @param securityGroup Describes the security group to be created. + * @return a reference of the newly-created security group + */ + @Path("/security-groups") + @Named("secuity-group:create") + @POST + @SelectJson("security_group") + SecurityGroup create(@WrapWith("security_group") SecurityGroup.CreateSecurityGroup securityGroup); + + /** + * Deletes the specified Security Group. + * + * @param id the id of the security group to delete + * @return true if delete was successful, false if not + */ + @Path("/security-groups/{id}") + @Named("security-group:delete") + @DELETE + @Fallback(Fallbacks.FalseOnNotFoundOr404.class) + boolean deleteSecurityGroup(@PathParam("id") String id); + + /** + * Rules + */ + + /** + * @return all security groups rules currently defined in Neutron for the current tenant. + */ + @Path("/security-group-rules") + @Named("security-group-rule:list") + @GET + @ResponseParser(ParseRules.class) + @Transform(RulesToPagedIterable.class) + @Fallback(EmptyPagedIterableOnNotFoundOr404.class) + PagedIterable<Rule> listRules(); + + /** + * @return all security groups rules currently defined in Neutron for the current tenant. + */ + @Path("/security-group-rules") + @Named("security-group-rule:list") + @GET + @ResponseParser(ParseRules.class) + @Fallback(EmptyRulesFallback.class) + Rules listRules(PaginationOptions options); + + /** + * @param id the id of the security group rule to return. + * @return SecurityGroupRule or null if not found. + */ + @Path("/security-group-rules/{id}") + @Named("security-group-rule:get") + @GET + @SelectJson("security_group_rule") + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Nullable + Rule get(@PathParam("id") String id); + + /** + * Creates a new Security Group Rule. + * + * @param securityGroupRule Describes the security group rule to be created. + * @return a reference of the newly-created security group rule. + */ + @Path("/security-group-rules") + @Named("security-group-rule:create") + @POST + @SelectJson("security_group_rule") + Rule create(@WrapWith("security_group_rule") Rule.CreateRule securityGroupRule); + + /** + * Deletes the specified Security Group Rule. + * + * @param id the id of the security group rule to delete. + * @return true if delete was successful, false if not. + */ + @Path("/security-group-rules/{id}") + @Named("security-group-rule:delete") + @DELETE + @Fallback(Fallbacks.FalseOnNotFoundOr404.class) + boolean deleteRule(@PathParam("id") String id); +} 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/extensions/lbaas/v1/LBaaSApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java new file mode 100644 index 0000000..dad80d8 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java new file mode 100644 index 0000000..ede9046 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.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.fallbacks; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.FloatingIPs; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyFloatingIPsFallback implements Fallback<FloatingIPs> { + @Override + public FloatingIPs createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return FloatingIPs.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java new file mode 100644 index 0000000..8410afb --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.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.fallbacks; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.Networks; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyNetworksFallback implements Fallback<Networks> { + @Override + public Networks createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return Networks.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java new file mode 100644 index 0000000..ac2e0db --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.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.fallbacks; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.Ports; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyPortsFallback implements Fallback<Ports> { + @Override + public Ports createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return Ports.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java new file mode 100644 index 0000000..8b74be2 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.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.fallbacks; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.Routers; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyRoutersFallback implements Fallback<Routers> { + @Override + public Routers createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return Routers.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java new file mode 100644 index 0000000..4556f74 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.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.fallbacks; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.Rules; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyRulesFallback implements Fallback<Rules> { + @Override + public Rules createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return Rules.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java new file mode 100644 index 0000000..70a3e37 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.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.fallbacks; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.SecurityGroups; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptySecurityGroupsFallback implements Fallback<SecurityGroups> { + @Override + public SecurityGroups createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return SecurityGroups.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java new file mode 100644 index 0000000..8f7a94a --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.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.fallbacks; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.Subnets; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptySubnetsFallback implements Fallback<Subnets> { + @Override + public Subnets createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return Subnets.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java new file mode 100644 index 0000000..8364fba --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.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.fallbacks.lbaas.v1; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyHealthMonitorsFallback implements Fallback<HealthMonitors> { + @Override + public HealthMonitors createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return HealthMonitors.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java new file mode 100644 index 0000000..9cb8084 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.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.fallbacks.lbaas.v1; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyMembersFallback implements Fallback<Members> { + @Override + public Members createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return Members.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java new file mode 100644 index 0000000..0c2ce99 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.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.fallbacks.lbaas.v1; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyPoolsFallback implements Fallback<Pools> { + @Override + public Pools createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return Pools.EMPTY; + } + throw propagate(t); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java new file mode 100644 index 0000000..4dfae2d --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.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.fallbacks.lbaas.v1; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + +import org.jclouds.Fallback; +import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs; +import org.jclouds.rest.ResourceNotFoundException; + +public class EmptyVIPsFallback implements Fallback<VIPs> { + @Override + public VIPs createOrPropagate(Throwable t) throws Exception { + if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) + || contains404(t)) { + return VIPs.EMPTY; + } + throw propagate(t); + } +}
