http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java deleted file mode 100644 index d664cd6..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/RulesToPagedIterable.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Rule; -import org.jclouds.openstack.neutron.v2.extensions.SecurityGroupApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures Routers works as PagedIterable. - */ -public class RulesToPagedIterable extends - Arg0ToPagedIterable.FromCaller<Rule, RulesToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected RulesToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Rule>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final SecurityGroupApi securityGroupApi = api.getSecurityGroupApi(region).get(); - return new Function<Object, IterableWithMarker<Rule>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Rule> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(securityGroupApi.listRules(paginationOptions)); - } - - @Override - public String toString() { - return "listRules()"; - } - }; - } - -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java deleted file mode 100644 index 15c7c14..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SecurityGroupsToPagedIterable.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.SecurityGroup; -import org.jclouds.openstack.neutron.v2.extensions.SecurityGroupApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Ensures Routers works as PagedIterable. - */ -public class SecurityGroupsToPagedIterable extends - Arg0ToPagedIterable.FromCaller<SecurityGroup, SecurityGroupsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected SecurityGroupsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<SecurityGroup>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final SecurityGroupApi securityGroupApi = api.getSecurityGroupApi(region).get(); - return new Function<Object, IterableWithMarker<SecurityGroup>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<SecurityGroup> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(securityGroupApi.listSecurityGroups(paginationOptions)); - } - - @Override - public String toString() { - return "listSecurityGroups()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java deleted file mode 100644 index a5e6abe..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/SubnetsToPagedIterable.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.Subnet; -import org.jclouds.openstack.neutron.v2.features.SubnetApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import javax.inject.Inject; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Ensures Subnets works as a PagedIterable. - */ -public class SubnetsToPagedIterable extends Arg0ToPagedIterable.FromCaller<Subnet, SubnetsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected SubnetsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Subnet>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final SubnetApi subnetApi = api.getSubnetApi(region); - return new Function<Object, IterableWithMarker<Subnet>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Subnet> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(subnetApi.list(paginationOptions)); - } - - @Override - public String toString() { - return "listSubnets()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java deleted file mode 100644 index e925b81..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/HealthMonitorsToPagedIterable.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes HealthMonitors work as a PagedIterable. - */ -public class HealthMonitorsToPagedIterable extends - Arg0ToPagedIterable.FromCaller<HealthMonitor, HealthMonitorsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected HealthMonitorsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<HealthMonitor>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<HealthMonitor>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<HealthMonitor> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listHealthMonitors(paginationOptions)); - } - - @Override - public String toString() { - return "listHealthMonitors()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java deleted file mode 100644 index 23b1719..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/MembersToPagedIterable.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Member; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes Members work as a PagedIterable. - */ -public class MembersToPagedIterable extends Arg0ToPagedIterable.FromCaller<Member, MembersToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected MembersToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Member>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<Member>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Member> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listMembers(paginationOptions)); - } - - @Override - public String toString() { - return "listMembers()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java deleted file mode 100644 index d74ceaf..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseHealthMonitors.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseHealthMonitors extends ParseJson<HealthMonitors> { - - @Inject - public ParseHealthMonitors(Json json) { - super(json, TypeLiteral.get(HealthMonitors.class)); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java deleted file mode 100644 index 252a5b0..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseMembers.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseMembers extends ParseJson<Members> { - - @Inject - public ParseMembers(Json json) { - super(json, TypeLiteral.get(Members.class)); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java deleted file mode 100644 index adf81da..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParsePools.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParsePools extends ParseJson<Pools> { - - @Inject - public ParsePools(Json json) { - super(json, TypeLiteral.get(Pools.class)); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java deleted file mode 100644 index d97710c..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/ParseVIPs.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs; - -import com.google.inject.TypeLiteral; - -/** - * Used by jclouds to provide more specific collections and fallbacks. - */ -@Singleton -public class ParseVIPs extends ParseJson<VIPs> { - - @Inject - public ParseVIPs(Json json) { - super(json, TypeLiteral.get(VIPs.class)); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java deleted file mode 100644 index c59b966..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/PoolsToPagedIterable.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pool; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes Pools work as a PagedIterable. - */ -public class PoolsToPagedIterable extends Arg0ToPagedIterable.FromCaller<Pool, PoolsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected PoolsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Pool>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<Pool>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<Pool> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listPools(paginationOptions)); - } - - @Override - public String toString() { - return "listPools()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java deleted file mode 100644 index 5731b2f..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/functions/lbaas/v1/VIPsToPagedIterable.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.functions.lbaas.v1; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.collect.internal.Arg0ToPagedIterable; -import org.jclouds.openstack.neutron.v2.NeutronApi; -import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIP; -import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; -import org.jclouds.openstack.v2_0.options.PaginationOptions; - -import com.google.common.base.Function; -import com.google.common.base.Optional; - -/** - * Makes VIPs work as a PagedIterable. - */ -public class VIPsToPagedIterable extends Arg0ToPagedIterable.FromCaller<VIP, VIPsToPagedIterable> { - - private final NeutronApi api; - - @Inject - protected VIPsToPagedIterable(NeutronApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<VIP>> markerToNextForArg0(Optional<Object> arg0) { - String region = arg0.isPresent() ? arg0.get().toString() : null; - final LBaaSApi lbaasApi = api.getLBaaSApi(region).get(); - return new Function<Object, IterableWithMarker<VIP>>() { - - @SuppressWarnings("unchecked") - @Override - public IterableWithMarker<VIP> apply(Object input) { - PaginationOptions paginationOptions = PaginationOptions.class.cast(input); - return IterableWithMarker.class.cast(lbaasApi.listVIPs(paginationOptions)); - } - - @Override - public String toString() { - return "listVIPs()"; - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java deleted file mode 100644 index 5aaaae5..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/handlers/NeutronErrorHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.handlers; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.HttpResponseException; -import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ResourceNotFoundException; - -import javax.inject.Singleton; - -import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream; - -/** - * This will parse and set an appropriate exception on the command object. - */ -@Singleton -public class NeutronErrorHandler implements HttpErrorHandler { - public void handleError(HttpCommand command, HttpResponse response) { - // it is important to always read fully and close streams - byte[] data = closeClientButKeepContentStream(response); - String message = data != null ? new String(data) : null; - - Exception exception = message != null ? new HttpResponseException(command, response, message) - : new HttpResponseException(command, response); - message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), - response.getStatusLine()); - switch (response.getStatusCode()) { - case 400: - break; - case 401: - case 403: - exception = new AuthorizationException(message, exception); - break; - case 404: - if (!command.getCurrentRequest().getMethod().equals("DELETE")) { - exception = new ResourceNotFoundException(message, exception); - } - break; - case 409: - exception = new IllegalStateException(exception.getMessage(), exception); - break; - } - command.setException(exception); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java deleted file mode 100644 index 98205fc..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/options/EmptyOptions.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2.options; - -import com.google.inject.Inject; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; -import org.jclouds.rest.binders.BindToJsonPayload; - -import java.util.Map; - -/** - * This class is used for methods who don't need a wrapper around their JSON body - * - */ -public class EmptyOptions implements MapBinder { - - @Inject - private BindToJsonPayload jsonBinder; - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - return bindToRequest(request, (Object) postParams); - } - - @Override - public <R extends HttpRequest> R bindToRequest(R request, Object input) { - return jsonBinder.bindToRequest(request, input); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApi.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApi.java deleted file mode 100644 index a5ff027..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApi.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0; - -import java.io.Closeable; -import java.util.Set; - -import org.jclouds.location.Region; -import org.jclouds.location.Zone; -import org.jclouds.location.functions.RegionToEndpoint; -import org.jclouds.location.functions.ZoneToEndpoint; -import org.jclouds.openstack.neutron.v2_0.extensions.RouterApi; -import org.jclouds.openstack.neutron.v2_0.features.NetworkApi; -import org.jclouds.openstack.neutron.v2_0.features.PortApi; -import org.jclouds.openstack.neutron.v2_0.features.SubnetApi; -import org.jclouds.openstack.v2_0.features.ExtensionApi; -import org.jclouds.rest.annotations.Delegate; -import org.jclouds.rest.annotations.EndpointParam; - -import com.google.common.base.Optional; -import com.google.inject.Provides; - -/** - * Provides access to the OpenStack Networking (Neutron) v2 API. - * <p/> - * - * @deprecated Please use {@link org.jclouds.openstack.neutron.v2.NeutronApi} as this - * interface will be removed in jclouds 3.0. - */ -@Deprecated -public interface NeutronApi extends Closeable { - - /** - * @return the Region codes configured - */ - @Provides - @Region - Set<String> getConfiguredRegions(); - - /** - * Provides access to Extension features. - */ - @Delegate - ExtensionApi getExtensionApi(@EndpointParam(parser = RegionToEndpoint.class) String region); - - /** - * Provides access to Network features. - */ - @Delegate - NetworkApi getNetworkApi(@EndpointParam(parser = RegionToEndpoint.class) String region); - - /** - * Provides access to Subnet features. - */ - @Delegate - SubnetApi getSubnetApi(@EndpointParam(parser = RegionToEndpoint.class) String region); - - /** - * Provides access to Port features. - */ - @Delegate - PortApi getPortApi(@EndpointParam(parser = RegionToEndpoint.class) String region); - - /** - * Provides access to Router features. - */ - @Delegate - Optional<? extends RouterApi> getRouterApi(@EndpointParam(parser = RegionToEndpoint.class) String region); - - /** - * @return the Zone codes configured - * @deprecated Please use {@link #getConfiguredRegions()} as this method will be removed in jclouds 3.0. - */ - @Deprecated - @Provides - @Zone - Set<String> getConfiguredZones(); - - /** - * Provides access to Extension features. - * @deprecated Please use {@link #getExtensionApi(String)} as this method will be removed in jclouds 3.0. - */ - @Deprecated - @Delegate - ExtensionApi getExtensionApiForZone( - @EndpointParam(parser = ZoneToEndpoint.class) String zone); - - /** - * Provides access to Network features. - * @deprecated Please use {@link #getNetworkApi(String)} as this method will be removed in jclouds 3.0. - */ - @Deprecated - @Delegate - NetworkApi getNetworkApiForZone(@EndpointParam(parser = ZoneToEndpoint.class) String zone); - - /** - * Provides access to Subnet features. - * @deprecated Please use {@link #getSubnetApi(String)} as this method will be removed in jclouds 3.0. - */ - @Deprecated - @Delegate - SubnetApi getSubnetApiForZone(@EndpointParam(parser = ZoneToEndpoint.class) String zone); - - /** - * Provides access to Port features. - * @deprecated Please use {@link #getPortApi(String)} as this method will be removed in jclouds 3.0. - */ - @Deprecated - @Delegate - PortApi getPortApiForZone(@EndpointParam(parser = ZoneToEndpoint.class) String zone); - - /** - * Provides access to Router features. - * @deprecated Please use {@link #getRouterApi(String)} as this method will be removed in jclouds 3.0. - */ - @Deprecated - @Delegate - Optional<? extends RouterApi> getRouterExtensionForZone(@EndpointParam(parser = ZoneToEndpoint.class) String zone); -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApiMetadata.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApiMetadata.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApiMetadata.java deleted file mode 100644 index 6327f1e..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/NeutronApiMetadata.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0; - -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE; - -import java.net.URI; -import java.util.Properties; - -import org.jclouds.apis.ApiMetadata; -import org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule; -import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule; -import org.jclouds.openstack.neutron.v2_0.config.NeutronHttpApiModule; -import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.rest.internal.BaseHttpApiMetadata; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * Implementation of {@link org.jclouds.apis.ApiMetadata} for Neutron 2.0 API - */ -@Deprecated -public class NeutronApiMetadata extends BaseHttpApiMetadata<NeutronApi> { - - @Override - public Builder toBuilder() { - return new Builder().fromApiMetadata(this); - } - - public NeutronApiMetadata() { - this(new Builder()); - } - - protected NeutronApiMetadata(Builder builder) { - super(builder); - } - - public static Properties defaultProperties() { - Properties properties = BaseHttpApiMetadata.defaultProperties(); - properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS); - properties.setProperty(SERVICE_TYPE, ServiceType.NETWORK); - return properties; - } - - public static class Builder extends BaseHttpApiMetadata.Builder<NeutronApi, Builder> { - - protected Builder() { - super(NeutronApi.class); - id("openstack-neutron-legacy") - .name("OpenStack Neutron API") - .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") - .credentialName("${password}") - .endpointName("KeyStone base url ending in /v2.0/") - .documentation(URI.create("http://docs.openstack.org/api/openstack-network/2.0/content/")) - .version("2.0") - .defaultEndpoint("http://localhost:5000/v2.0/") - .defaultProperties(NeutronApiMetadata.defaultProperties()) - .defaultModules(ImmutableSet.<Class<? extends Module>>builder() - .add(AuthenticationApiModule.class) - .add(KeystoneAuthenticationModule.class) - .add(ZoneModule.class) - .add(NeutronHttpApiModule.class).build()); - } - - @Override - public NeutronApiMetadata build() { - return new NeutronApiMetadata(this); - } - - @Override - public Builder fromApiMetadata(ApiMetadata in) { - super.fromApiMetadata(in); - return this; - } - - @Override - protected Builder self() { - return this; - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/config/NeutronHttpApiModule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/config/NeutronHttpApiModule.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/config/NeutronHttpApiModule.java deleted file mode 100644 index fe3d74c..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/config/NeutronHttpApiModule.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.openstack.neutron.v2_0.config; - -import java.net.URI; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import javax.inject.Provider; -import javax.inject.Singleton; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.annotation.ClientError; -import org.jclouds.http.annotation.Redirection; -import org.jclouds.http.annotation.ServerError; -import org.jclouds.json.config.GsonModule.DateAdapter; -import org.jclouds.json.config.GsonModule.Iso8601DateAdapter; -import org.jclouds.openstack.neutron.v2_0.NeutronApi; -import org.jclouds.openstack.neutron.v2_0.handlers.NeutronErrorHandler; -import org.jclouds.openstack.v2_0.domain.Extension; -import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet; -import org.jclouds.rest.ConfiguresHttpApi; -import org.jclouds.rest.config.HttpApiModule; -import org.jclouds.rest.functions.ImplicitOptionalConverter; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import com.google.inject.Provides; - -/** - * Configures the Neutron connection. - */ -@ConfiguresHttpApi -public class NeutronHttpApiModule extends HttpApiModule<NeutronApi> { - - @Override - protected void configure() { - bind(DateAdapter.class).to(Iso8601DateAdapter.class); - bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class); - super.configure(); - } - - @Provides - @Singleton - public Multimap<URI, URI> aliases() { - return ImmutableMultimap.<URI, URI>builder() - .build(); - } - - @Provides - @Singleton - public LoadingCache<String, Set<? extends Extension>> provideExtensionsByZone(final Provider<NeutronApi> quantumApi) { - return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS) - .build(new CacheLoader<String, Set<? extends Extension>>() { - @Override - public Set<? extends Extension> load(String key) throws Exception { - return quantumApi.get().getExtensionApiForZone(key).list(); - } - }); - } - - @Override - protected void bindErrorHandlers() { - bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(NeutronErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(NeutronErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(NeutronErrorHandler.class); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/AllocationPool.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/AllocationPool.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/AllocationPool.java deleted file mode 100644 index 6e1ff7f..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/AllocationPool.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0.domain; - -import java.beans.ConstructorProperties; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; - -/** - * A Neutron Subnet Allocation Pool - * - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api doc</a> - */ -public class AllocationPool { - - private final String start; - private final String end; - - @ConstructorProperties({ - "start", "end" - }) - protected AllocationPool(String start, String end) { - this.start = start; - this.end = end; - } - - /** - * @return the start ip - */ - public String getStart() { - return start; - } - - /** - * @return the end ip - */ - public String getEnd() { - return end; - } - - @Override - public int hashCode() { - return Objects.hashCode(start, end); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - AllocationPool that = AllocationPool.class.cast(obj); - return Objects.equal(this.start, that.start) && Objects.equal(this.end, that.end); - } - - protected ToStringHelper string() { - return Objects.toStringHelper(this).add("start", start).add("end", end); - } - - @Override - public String toString() { - return string().toString(); - } - - public static Builder builder() { - return new ConcreteBuilder(); - } - - public Builder toBuilder() { - return new ConcreteBuilder().fromAllocationPool(this); - } - - public abstract static class Builder { - protected abstract Builder self(); - - protected String start; - protected String end; - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.AllocationPool#getStart() - */ - public Builder start(String start) { - this.start = start; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.AllocationPool#getEnd() - */ - public Builder end(String end) { - this.end = end; - return self(); - } - - public AllocationPool build() { - return new AllocationPool(start, end); - } - - public Builder fromAllocationPool(AllocationPool in) { - return this.start(in.getStart()).end(in.getEnd()); - } - } - - private static class ConcreteBuilder extends Builder { - @Override - protected ConcreteBuilder self() { - return this; - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkNetwork.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkNetwork.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkNetwork.java deleted file mode 100644 index f2e4a0e..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkNetwork.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0.domain; - -import com.google.common.base.Objects; - -import java.beans.ConstructorProperties; - -/** - * A Neutron network used for creating networks in bulk - * The only difference between this and the actual network are the missing fields id, tenantId, state & shared - */ -public class BulkNetwork { - - private final String name; - private final Boolean adminStateUp; - private final Boolean external; - private final NetworkType networkType; - private final String physicalNetworkName; - private final Integer segmentationId; - - @ConstructorProperties({ - "name", "admin_state_up", "router:external", "provider:network_type", "provider:physical_network", "provider:segmentation_id" - }) - protected BulkNetwork(String name, Boolean adminStateUp, Boolean external, String networkType, String physicalNetworkName, Integer segmentationId) { - this.name = name; - this.adminStateUp = adminStateUp; - this.external = external; - this.networkType = NetworkType.fromValue(networkType); - this.physicalNetworkName = physicalNetworkName; - this.segmentationId = segmentationId; - } - - /** - * @return the name of the network - */ - public String getName() { - return name; - } - - /** - * @return the administrative state of network. If false, the network does not forward packets. - */ - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * @return true if network is external, false if not - */ - public Boolean getExternal() { - return external; - } - - /** - * @return the type of network - */ - public NetworkType getNetworkType() { - return networkType; - } - - /** - * @return the physical network name - */ - public String getPhysicalNetworkName() { - return physicalNetworkName; - } - - /** - * @return the segmentation id of the network - */ - public Integer getSegmentationId() { - return segmentationId; - } - - @Override - public int hashCode() { - return Objects.hashCode(name, adminStateUp, external, networkType, physicalNetworkName, segmentationId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - BulkNetwork that = BulkNetwork.class.cast(obj); - return Objects.equal(this.name, that.name) - && Objects.equal(this.adminStateUp, that.adminStateUp) - && Objects.equal(this.external, that.external) - && Objects.equal(this.networkType, that.networkType) - && Objects.equal(this.physicalNetworkName, that.physicalNetworkName) - && Objects.equal(this.segmentationId, that.segmentationId); - } - - protected Objects.ToStringHelper string() { - return Objects.toStringHelper(this) - .add("name", name).add("adminStateUp", adminStateUp).add("external", external) - .add("networkType", networkType).add("physicalNetworkName", physicalNetworkName) - .add("segmentationId", segmentationId); - } - - @Override - public String toString() { - return string().toString(); - } - - public static Builder builder() { - return new ConcreteBuilder(); - } - - public Builder toBuilder() { - return new ConcreteBuilder().fromBulkNetwork(this); - } - - public abstract static class Builder { - protected abstract Builder self(); - - protected String name; - protected Boolean adminStateUp; - protected Boolean external; - protected NetworkType networkType; - protected String physcialNetworkName; - protected Integer segmentationId; - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkNetwork#getName() - */ - public Builder name(String name) { - this.name = name; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkNetwork#getAdminStateUp() - */ - public Builder adminStateUp(Boolean adminStateUp) { - this.adminStateUp = adminStateUp; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkNetwork#getExternal() - */ - public Builder external(Boolean external) { - this.external = external; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkNetwork#getNetworkType() - */ - public Builder networkType(NetworkType networkType) { - this.networkType = networkType; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkNetwork#getPhysicalNetworkName() - */ - public Builder physicalNetworkName(String physicalNetworkName) { - this.physcialNetworkName = physicalNetworkName; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkNetwork#getSegmentationId() - */ - public Builder segmentationId(Integer segmentationId) { - this.segmentationId = segmentationId; - return self(); - } - - public BulkNetwork build() { - return new BulkNetwork(name, adminStateUp, external, networkType == null ? null : networkType.getValue(), physcialNetworkName, segmentationId); - } - - public Builder fromBulkNetwork(BulkNetwork in) { - return this.name(in.getName()) - .adminStateUp(in.getAdminStateUp()) - .external(in.getExternal()) - .networkType(in.getNetworkType()) - .physicalNetworkName(in.getPhysicalNetworkName()) - .segmentationId(in.getSegmentationId()); - } - } - - private static class ConcreteBuilder extends Builder { - @Override - protected ConcreteBuilder self() { - return this; - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkPort.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkPort.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkPort.java deleted file mode 100644 index 91c2637..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkPort.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0.domain; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; - -import java.beans.ConstructorProperties; -import java.util.Collection; -import java.util.Set; - -/** - * A Neutron port used for creating ports in bulk - * The only difference between this and the actual port are the missing fields id, tenantId & state - */ -public class BulkPort { - - private final String name; - private final String networkId; - private final Boolean adminStateUp; - private final String deviceId; - private final String deviceOwner; - private final Set<IP> fixedIps; - private final String macAddress; - - @ConstructorProperties({ - "name", "network_id", "admin_state_up", "device_id", "device_owner", "fixed_ips", "mac_address" - }) - protected BulkPort(String name, String networkId, Boolean adminStateUp, String deviceId, String deviceOwner, Set<IP> fixedIps, String macAddress) { - this.name = name; - this.networkId = networkId; - this.adminStateUp = adminStateUp; - this.deviceId = deviceId; - this.deviceOwner = deviceOwner; - this.fixedIps = fixedIps != null ? ImmutableSet.copyOf(fixedIps) : ImmutableSet.<IP>of(); - this.macAddress = macAddress; - } - - /** - * @return the name of the port - */ - public String getName() { - return name; - } - - /** - * @return the id of the network where this port is associated with - */ - public String getNetworkId() { - return networkId; - } - - /** - * @return the administrative state of port. If false, port does not forward packets - */ - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * @return the id of the device (e.g. server) using this port. - */ - public String getDeviceId() { - return deviceId; - } - - /** - * @return the entity (e.g.: dhcp agent) using this port. - */ - public String getDeviceOwner() { - return deviceOwner; - } - - /** - * @return the set of fixed ips this port has been assigned - */ - public Set<IP> getFixedIps() { - return fixedIps; - } - - /** - * @return the mac address of this port - */ - public String getMacAddress() { - return macAddress; - } - - @Override - public int hashCode() { - return Objects.hashCode(name, networkId, adminStateUp, deviceId, deviceOwner, fixedIps, macAddress); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - BulkPort that = BulkPort.class.cast(obj); - return Objects.equal(this.name, that.name) - && Objects.equal(this.networkId, that.networkId) - && Objects.equal(this.adminStateUp, that.adminStateUp) - && Objects.equal(this.deviceId, that.deviceId) - && Objects.equal(this.deviceOwner, that.deviceOwner) - && Objects.equal(this.fixedIps, that.fixedIps) - && Objects.equal(this.macAddress, that.macAddress); - } - - protected Objects.ToStringHelper string() { - return Objects.toStringHelper(this) - .add("name", name).add("networkId", networkId).add("adminStateUp", adminStateUp) - .add("deviceId", deviceId).add("deviceOwner", deviceOwner).add("fixedIps", fixedIps).add("macAddress", macAddress); - } - - @Override - public String toString() { - return string().toString(); - } - - public static Builder builder() { - return new ConcreteBuilder(); - } - - public Builder toBuilder() { - return new ConcreteBuilder().fromBulkPort(this); - } - - public abstract static class Builder { - protected abstract Builder self(); - - protected String name; - protected String networkId; - protected String deviceId; - protected String deviceOwner; - protected String macAddress; - protected Set<IP> fixedIps; - protected Boolean adminStateUp; - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkPort#getName() - */ - public Builder name(String name) { - this.name = name; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkPort#getNetworkId() - */ - public Builder networkId(String networkId) { - this.networkId = networkId; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkPort#getDeviceId() - */ - public Builder deviceId(String deviceId) { - this.deviceId = deviceId; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkPort#getDeviceOwner() - */ - public Builder deviceOwner(String deviceOwner) { - this.deviceOwner = deviceOwner; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkPort#getMacAddress() - */ - public Builder macAddress(String macAddress) { - this.macAddress = macAddress; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkPort#getFixedIps() - */ - public Builder fixedIps(Collection<IP> fixedIps) { - this.fixedIps = ImmutableSet.copyOf(fixedIps); - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkPort#getAdminStateUp() - */ - public Builder adminStateUp(Boolean adminStateUp) { - this.adminStateUp = adminStateUp; - return self(); - } - - public BulkPort build() { - return new BulkPort(name, networkId, adminStateUp, deviceId, deviceOwner, fixedIps, macAddress); - } - - public Builder fromBulkPort(BulkPort in) { - return this.name(in.getName()) - .networkId(in.getNetworkId()) - .adminStateUp(in.getAdminStateUp()) - .deviceId(in.getDeviceId()) - .deviceOwner(in.getDeviceOwner()) - .fixedIps(in.getFixedIps()) - .macAddress(in.getMacAddress()); - } - } - - private static class ConcreteBuilder extends Builder { - @Override - protected ConcreteBuilder self() { - return this; - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkSubnet.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkSubnet.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkSubnet.java deleted file mode 100644 index c1eea45..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/BulkSubnet.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0.domain; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; - -import java.beans.ConstructorProperties; -import java.util.Collection; -import java.util.Set; - -/** - * A Neutron subnet used for creating subnets in bulk - * The only difference between this and the actual subnet are the missing fields id & tenantId - */ -public class BulkSubnet { - - protected String name; - protected String networkId; - protected String gatewayIp; - protected Integer ipVersion; - protected String cidr; - protected Set<AllocationPool> allocationPools; - protected Boolean enableDhcp; - protected Set<String> dnsNameServers; - protected Set<HostRoute> hostRoutes; - - @ConstructorProperties({ - "name", "network_id", "gateway_ip", "ip_version", "cidr", "allocation_pools", "enable_dhcp", "dns_nameservers", "host_routes" - }) - protected BulkSubnet(String name, String networkId, String gatewayIp, Integer ipVersion, String cidr, - Set<AllocationPool> allocationPools, Boolean enableDhcp, Set<String> dnsNameServers, Set<HostRoute> hostRoutes) { - this.name = name; - this.networkId = networkId; - this.gatewayIp = gatewayIp; - this.ipVersion = ipVersion; - this.cidr = cidr; - this.allocationPools = allocationPools != null ? ImmutableSet.copyOf(allocationPools) : ImmutableSet.<AllocationPool>of(); - this.enableDhcp = enableDhcp; - this.dnsNameServers = dnsNameServers != null ? ImmutableSet.copyOf(dnsNameServers) : ImmutableSet.<String>of(); - this.hostRoutes = hostRoutes != null ? ImmutableSet.copyOf(hostRoutes) : ImmutableSet.<HostRoute>of(); - } - - /** - * @return the name of the subnet - */ - public String getName() { - return name; - } - - /** - * @return the id of the network this subnet is associated with - */ - public String getNetworkId() { - return networkId; - } - - /** - * @return the default gateway used by devices in this subnet - */ - public String getGatewayIp() { - return gatewayIp; - } - - /** - * @return the ip version used by this subnet - */ - public Integer getIpVersion() { - return ipVersion; - } - - /** - * @return the cidr representing the IP range for this subnet, based on IP version - */ - public String getCidr() { - return cidr; - } - - /** - * @return the sub-ranges of cidr available for dynamic allocation to ports - */ - public Set<AllocationPool> getAllocationPools() { - return allocationPools; - } - - /** - * @return true if DHCP is enabled for this subnet, false if not. - */ - public Boolean getEnableDhcp() { - return enableDhcp; - } - - /** - * @return the set of DNS name servers used by hosts in this subnet. - */ - public Set<String> getDnsNameServers() { - return dnsNameServers; - } - - /** - * @return the set of routes that should be used by devices with IPs from this subnet - */ - public Set<HostRoute> getHostRoutes() { - return hostRoutes; - } - - @Override - public int hashCode() { - return Objects.hashCode(name, networkId, gatewayIp, ipVersion, cidr, - allocationPools, enableDhcp, dnsNameServers, hostRoutes); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - BulkSubnet that = BulkSubnet.class.cast(obj); - return Objects.equal(this.name, that.name) - && Objects.equal(this.networkId, that.networkId) - && Objects.equal(this.gatewayIp, that.gatewayIp) - && Objects.equal(this.ipVersion, that.ipVersion) - && Objects.equal(this.cidr, that.cidr) - && Objects.equal(this.allocationPools, that.allocationPools) - && Objects.equal(this.enableDhcp, that.enableDhcp) - && Objects.equal(this.dnsNameServers, that.dnsNameServers) - && Objects.equal(this.hostRoutes, that.hostRoutes); - } - - protected Objects.ToStringHelper string() { - return Objects.toStringHelper(this) - .add("name", name).add("networkId", networkId).add("gatewayIp", gatewayIp).add("ipVersion", ipVersion) - .add("cidr", cidr).add("enableDhcp", enableDhcp).add("allocationPools", allocationPools) - .add("dnsNameServers", dnsNameServers).add("hostRoutes", hostRoutes); - } - - @Override - public String toString() { - return string().toString(); - } - - public static Builder builder() { - return new ConcreteBuilder(); - } - - public Builder toBuilder() { - return new ConcreteBuilder().fromBulkSubnet(this); - } - - public abstract static class Builder { - protected abstract Builder self(); - - protected String name; - protected String networkId; - protected String gatewayIp; - protected Integer ipVersion; - protected String cidr; - protected Set<AllocationPool> allocationPools; - protected Boolean enableDhcp; - protected Set<String> dnsNameServers; - protected Set<HostRoute> hostRoutes; - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getName() - */ - public Builder name(String name) { - this.name = name; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getNetworkId() - */ - public Builder networkId(String networkId) { - this.networkId = networkId; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getGatewayIp() - */ - public Builder gatewayIp(String gatewayIp) { - this.gatewayIp = gatewayIp; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getIpVersion() - */ - public Builder ipVersion(Integer ipVersion) { - this.ipVersion = ipVersion; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getCidr() - */ - public Builder cidr(String cidr) { - this.cidr = cidr; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getAllocationPools() - */ - public Builder allocationPools(Collection<AllocationPool> allocationPools) { - this.allocationPools = ImmutableSet.copyOf(allocationPools); - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getEnableDhcp() - */ - public Builder enableDhcp(Boolean enableDhcp) { - this.enableDhcp = enableDhcp; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getDnsNameServers() - */ - public Builder dnsNameServers(Collection<String> dnsNameServers) { - this.dnsNameServers = ImmutableSet.copyOf(dnsNameServers); - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet#getHostRoutes() - */ - public Builder hostRoutes(Collection<HostRoute> hostRoutes) { - this.hostRoutes = ImmutableSet.copyOf(hostRoutes); - return self(); - } - - public BulkSubnet build() { - return new BulkSubnet(name, networkId, gatewayIp, ipVersion, cidr, allocationPools, enableDhcp, dnsNameServers, hostRoutes); - } - - public Builder fromBulkSubnet(BulkSubnet in) { - return this.name(in.getName()) - .networkId(in.getNetworkId()) - .gatewayIp(in.getGatewayIp()) - .ipVersion(in.getIpVersion()) - .cidr(in.getCidr()) - .allocationPools(in.getAllocationPools()) - .enableDhcp(in.getEnableDhcp()) - .dnsNameServers(in.getDnsNameServers()) - .hostRoutes(in.getHostRoutes()); - } - } - - private static class ConcreteBuilder extends Builder { - @Override - protected ConcreteBuilder self() { - return this; - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/ExternalGatewayInfo.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/ExternalGatewayInfo.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/ExternalGatewayInfo.java deleted file mode 100644 index f5473ed..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/ExternalGatewayInfo.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0.domain; - -import com.google.common.base.Objects; - -import java.beans.ConstructorProperties; - -/** - * Information on external gateway for the router - */ -public class ExternalGatewayInfo { - - private final String networkId; - - @ConstructorProperties({"network_id"}) - protected ExternalGatewayInfo(String networkId) { - this.networkId = networkId; - } - - /** - * @return the id of the network which is used as external gateway for the router - */ - public String getNetworkId() { - return networkId; - } - - @Override - public int hashCode() { - return Objects.hashCode(networkId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - ExternalGatewayInfo that = ExternalGatewayInfo.class.cast(obj); - return Objects.equal(this.networkId, that.networkId); - } - - protected Objects.ToStringHelper string() { - return Objects.toStringHelper(this).add("networkId", networkId); - } - - @Override - public String toString() { - return string().toString(); - } - - public static Builder builder() { - return new ConcreteBuilder(); - } - - public Builder toBuilder() { - return new ConcreteBuilder().fromExternalGatewayInfo(this); - } - - public abstract static class Builder { - protected abstract Builder self(); - - protected String networkId; - - /** - * @see ExternalGatewayInfo#getNetworkId() - */ - public Builder networkId(String networkId) { - this.networkId = networkId; - return self(); - } - - public ExternalGatewayInfo build() { - return new ExternalGatewayInfo(networkId); - } - - public Builder fromExternalGatewayInfo(ExternalGatewayInfo in) { - return this.networkId(in.getNetworkId()); - } - } - - private static class ConcreteBuilder extends Builder { - @Override - protected ConcreteBuilder self() { - return this; - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/HostRoute.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/HostRoute.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/HostRoute.java deleted file mode 100644 index 42c2a40..0000000 --- a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2_0/domain/HostRoute.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jclouds.openstack.neutron.v2_0.domain; - -import java.beans.ConstructorProperties; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; - -/** - * A Neutron Subnet Host Route - * - * @see <a href="http://docs.openstack.org/api/openstack-network/2.0/content/Subnets.html">api doc</a> - */ -public class HostRoute { - - private final String destinationCidr; - private final String nextHop; - - @ConstructorProperties({ - "destination", "nexthop" - }) - protected HostRoute(String destinationCidr, String nextHop) { - this.destinationCidr = destinationCidr; - this.nextHop = nextHop; - } - - /** - * @return the destination cidr for this route - */ - public String getDestinationCidr() { - return destinationCidr; - } - - /** - * @return the ip of the next hop to forward traffic to - */ - public String getNextHop() { - return nextHop; - } - - @Override - public int hashCode() { - return Objects.hashCode(destinationCidr, nextHop); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - HostRoute that = HostRoute.class.cast(obj); - return Objects.equal(this.destinationCidr, that.destinationCidr) && Objects.equal(this.nextHop, that.nextHop); - } - - protected ToStringHelper string() { - return Objects.toStringHelper(this) - .add("destinationCidr", destinationCidr).add("nextHop", nextHop); - } - - @Override - public String toString() { - return string().toString(); - } - - public static Builder builder() { - return new ConcreteBuilder(); - } - - public Builder toBuilder() { - return new ConcreteBuilder().fromHostRoute(this); - } - - public abstract static class Builder { - protected abstract Builder self(); - - protected String destinationCidr; - protected String nextHop; - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.HostRoute#getDestinationCidr() - */ - public Builder destinationCidr(String destinationCidr) { - this.destinationCidr = destinationCidr; - return self(); - } - - /** - * @see org.jclouds.openstack.neutron.v2_0.domain.HostRoute#getNextHop() - */ - public Builder nextHop(String nextHop) { - this.nextHop = nextHop; - return self(); - } - - public HostRoute build() { - return new HostRoute(destinationCidr, nextHop); - } - - public Builder fromHostRoute(HostRoute in) { - return this.destinationCidr(in.getDestinationCidr()).nextHop(in.getNextHop()); - } - } - - private static class ConcreteBuilder extends Builder { - @Override - protected ConcreteBuilder self() { - return this; - } - } - -}
