http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java deleted file mode 100644 index 6d23343..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.Image; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseImages extends ParseJson<ListPage<Image>> { - - @Inject - public ParseImages(Json json) { - super(json, new TypeLiteral<ListPage<Image>>() { - }); - } - - public static class ToPagedIterable extends BaseToPagedIterable<Image, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Image>> fetchNextPage(final String projectName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Image>>() { - - @Override - public IterableWithMarker<Image> apply(Object input) { - return api.getImageApiForProject(projectName).listAtMarker(input.toString(), options); - } - }; - } - } -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.java deleted file mode 100644 index 001a98c..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseInstances.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.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.Instance; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseInstances extends ParseJson<ListPage<Instance>> { - - @Inject - public ParseInstances(Json json) { - super(json, new TypeLiteral<ListPage<Instance>>() { - }); - } - - public static class ToPagedIterable extends BaseWithZoneToPagedIterable<Instance, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Instance>> fetchNextPage(final String project, - final String zone, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Instance>>() { - - @Override - public IterableWithMarker<Instance> apply(Object input) { - return api.getInstanceApiForProject(project) - .listAtMarkerInZone(zone, input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java deleted file mode 100644 index be78b92..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.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.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.MachineType; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseMachineTypes extends ParseJson<ListPage<MachineType>> { - - @Inject - public ParseMachineTypes(Json json) { - super(json, new TypeLiteral<ListPage<MachineType>>() {}); - } - - public static class ToPagedIterable extends BaseWithZoneToPagedIterable<MachineType, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<MachineType>> fetchNextPage(final String project, - final String zone, - final ListOptions options) { - return new Function<Object, IterableWithMarker<MachineType>>() { - - @Override - public IterableWithMarker<MachineType> apply(Object input) { - return api.getMachineTypeApiForProject(project) - .listAtMarkerInZone(zone, input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java deleted file mode 100644 index 0aa550b..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.Network; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseNetworks extends ParseJson<ListPage<Network>> { - - @Inject - public ParseNetworks(Json json) { - super(json, new TypeLiteral<ListPage<Network>>() { - }); - } - - public static class ToPagedIterable extends BaseToPagedIterable<Network, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Network>> fetchNextPage(final String projectName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Network>>() { - - @Override - public IterableWithMarker<Network> apply(Object input) { - return api.getNetworkApiForProject(projectName).listAtMarker(input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java deleted file mode 100644 index 84c8954..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.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.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.Operation; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseRegionOperations extends ParseJson<ListPage<Operation>> { - - @Inject - public ParseRegionOperations(Json json) { - super(json, new TypeLiteral<ListPage<Operation>>() { - }); - } - - public static class ToPagedIterable extends BaseWithRegionToPagedIterable<Operation, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Operation>> fetchNextPage(final String projectName, - final String regionName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Operation>>() { - - @Override - public IterableWithMarker<Operation> apply(Object input) { - return api.getRegionOperationApiForProject(projectName) - .listAtMarkerInRegion(regionName, input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java deleted file mode 100644 index ca1819e..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegions.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.Region; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseRegions extends ParseJson<ListPage<Region>> { - - @Inject - public ParseRegions(Json json) { - super(json, new TypeLiteral<ListPage<Region>>() { - }); - } - - public static class ToPagedIterable extends BaseToPagedIterable<Region, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Region>> fetchNextPage(final String projectName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Region>>() { - - @Override - public IterableWithMarker<Region> apply(Object input) { - return api.getRegionApiForProject(projectName).listAtMarker(input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java deleted file mode 100644 index 6191892..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRoutes.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.Route; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseRoutes extends ParseJson<ListPage<Route>> { - - @Inject - public ParseRoutes(Json json) { - super(json, new TypeLiteral<ListPage<Route>>() { - }); - } - - public static class ToPagedIterable extends BaseToPagedIterable<Route, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Route>> fetchNextPage(final String projectName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Route>>() { - - @Override - public IterableWithMarker<Route> apply(Object input) { - return api.getRouteApiForProject(projectName).listAtMarker(input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.java deleted file mode 100644 index 66ac2e7..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseSnapshots.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.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.Snapshot; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -@Singleton -public class ParseSnapshots extends ParseJson<ListPage<Snapshot>> { - - @Inject - public ParseSnapshots(Json json) { - super(json, new TypeLiteral<ListPage<Snapshot>>() { - }); - } - - public static class ToPagedIterable extends BaseToPagedIterable<Snapshot, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Snapshot>> fetchNextPage(final String projectName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Snapshot>>() { - - @Override - public IterableWithMarker<Snapshot> apply(Object input) { - return api.getSnapshotApiForProject(projectName) - .listAtMarker(input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.java deleted file mode 100644 index 28cc443..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneOperations.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.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.Operation; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseZoneOperations extends ParseJson<ListPage<Operation>> { - - @Inject - public ParseZoneOperations(Json json) { - super(json, new TypeLiteral<ListPage<Operation>>() { - }); - } - - public static class ToPagedIterable extends BaseWithZoneToPagedIterable<Operation, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Operation>> fetchNextPage(final String projectName, - final String zoneName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Operation>>() { - - @Override - public IterableWithMarker<Operation> apply(Object input) { - return api.getZoneOperationApiForProject(projectName) - .listAtMarkerInZone(zoneName, input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java deleted file mode 100644 index f3e54ea..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZones.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.googlecomputeengine.functions.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.collect.IterableWithMarker; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.googlecomputeengine.domain.Zone; -import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.json.Json; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -public class ParseZones extends ParseJson<ListPage<Zone>> { - - @Inject - public ParseZones(Json json) { - super(json, new TypeLiteral<ListPage<Zone>>() { - }); - } - - public static class ToPagedIterable extends BaseToPagedIterable<Zone, ToPagedIterable> { - - private final GoogleComputeEngineApi api; - - @Inject - protected ToPagedIterable(GoogleComputeEngineApi api) { - this.api = checkNotNull(api, "api"); - } - - @Override - protected Function<Object, IterableWithMarker<Zone>> fetchNextPage(final String projectName, - final ListOptions options) { - return new Function<Object, IterableWithMarker<Zone>>() { - - @Override - public IterableWithMarker<Zone> apply(Object input) { - return api.getZoneApiForProject(projectName).listAtMarker(input.toString(), options); - } - }; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java deleted file mode 100644 index b5ce22e..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java +++ /dev/null @@ -1,56 +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.googlecomputeengine.handlers; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.net.URI; -import java.util.Map; - -import javax.inject.Inject; - -import org.jclouds.googlecomputeengine.options.FirewallOptions; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; -import org.jclouds.rest.binders.BindToJsonPayload; - -public class FirewallBinder implements MapBinder { - - @Inject - private BindToJsonPayload jsonBinder; - - /** - * {@inheritDoc} - */ - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - FirewallOptions options = (FirewallOptions) checkNotNull(postParams.get("options"), "firewallOptions"); - String name = (String) checkNotNull(postParams.get("name"), "name"); - URI network = (URI) checkNotNull(postParams.get("network"), "network"); - options.name(name); - options.network(network); - return bindToRequest(request, options); - } - - /** - * {@inheritDoc} - */ - @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/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandler.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandler.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandler.java deleted file mode 100644 index 109b050..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandler.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.googlecomputeengine.handlers; - -import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.HttpResponseException; -import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ResourceNotFoundException; - -/** - * This will parse and set an appropriate exception on the command object. - */ -@Singleton -public class GoogleComputeEngineErrorHandler 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(message, exception); - break; - } - command.setException(exception); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/InstanceBinder.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/InstanceBinder.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/InstanceBinder.java deleted file mode 100644 index 2559ede..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/InstanceBinder.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.googlecomputeengine.handlers; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.net.URI; -import java.util.Map; - -import javax.inject.Inject; -import javax.inject.Named; - -import org.jclouds.googlecomputeengine.domain.InstanceTemplate; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; -import org.jclouds.rest.binders.BindToJsonPayload; - -import com.google.common.base.Function; - -public class InstanceBinder implements MapBinder { - - @Inject - private BindToJsonPayload jsonBinder; - - @Inject - @Named("machineTypeToURI") - Function<String, URI> machineTypesToURI; - - /** - * {@inheritDoc} - */ - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - InstanceTemplate template = (InstanceTemplate) checkNotNull(postParams.get("template"), "template"); - template.name(checkNotNull(postParams.get("name"), "name").toString()); - - if (template.getMachineTypeName() != null) { - template.machineType(machineTypesToURI.apply(template.getMachineTypeName())); - } - template.machineType((String) null); - return bindToRequest(request, template); - } - - /** - * {@inheritDoc} - */ - @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/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/MetadataBinder.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/MetadataBinder.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/MetadataBinder.java deleted file mode 100644 index b96afb4..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/MetadataBinder.java +++ /dev/null @@ -1,60 +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.googlecomputeengine.handlers; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; - -import javax.inject.Inject; - -import org.jclouds.googlecomputeengine.domain.Metadata; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; -import org.jclouds.rest.binders.BindToJsonPayload; - -import com.google.common.collect.ImmutableMap; - -public class MetadataBinder implements MapBinder { - - @Inject - private BindToJsonPayload jsonBinder; - - /** - * {@inheritDoc} - */ - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - Map<String, String> items = - ImmutableMap.copyOf((Map<String, String>) checkNotNull(postParams.get("items"), "item")); - String fingerprint = (String) checkNotNull(postParams.get("fingerprint"), "fingerprint"); - Metadata metadata = Metadata.builder() - .fingerprint(fingerprint) - .items(items) - .build(); - return bindToRequest(request, metadata); - } - - /** - * {@inheritDoc} - */ - @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/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java deleted file mode 100644 index 2863b44..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java +++ /dev/null @@ -1,56 +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.googlecomputeengine.handlers; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.net.URI; -import java.util.Map; - -import javax.inject.Inject; - -import org.jclouds.googlecomputeengine.options.RouteOptions; -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.MapBinder; -import org.jclouds.rest.binders.BindToJsonPayload; - -public class RouteBinder implements MapBinder { - - @Inject - private BindToJsonPayload jsonBinder; - - /** - * {@inheritDoc} - */ - @Override - public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { - RouteOptions options = (RouteOptions) checkNotNull(postParams.get("options"), "routeOptions"); - String name = (String) checkNotNull(postParams.get("name"), "name"); - URI network = (URI) checkNotNull(postParams.get("network"), "network"); - options.name(name); - options.network(network); - return bindToRequest(request, options); - } - - /** - * {@inheritDoc} - */ - @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/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/AttachDiskOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/AttachDiskOptions.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/AttachDiskOptions.java deleted file mode 100644 index 5ad2846..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/AttachDiskOptions.java +++ /dev/null @@ -1,128 +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.googlecomputeengine.options; - -import java.net.URI; - -/** - * Options for attaching disks to instances. - * - * @see <a href="https://developers.google.com/compute/docs/reference/latest/instances/attachDisk"/> - */ -public class AttachDiskOptions { - - public enum DiskType { - SCRATCH, - PERSISTENT - } - - public enum DiskMode { - READ_WRITE, - READ_ONLY - } - - private DiskType type; - private DiskMode mode; - private URI source; - private String deviceName; - private boolean boot; - - /** - * The disk type - * - * @return the disk type. - */ - public DiskType getType() { - return type; - } - - /** - * The disk mode - * - * @return the disk mode - */ - public DiskMode getMode() { - return mode; - } - - /** - * The URI of the source disk - optional, if DiskType.SCRATCH is used. - * - * @return the URI - */ - public URI getSource() { - return source; - } - - /** - * The device name on the instance - optional. - * - * @return the device name - */ - public String getDeviceName() { - return deviceName; - } - - /** - * Indicates that this is a boot disk. VM will use the first partition of the disk for its root filesystem. - * - * @return true if this is a boot disk, false otherwise - */ - public boolean getBoot() { - return boot; - } - - /** - * @see AttachDiskOptions#getType() - */ - public AttachDiskOptions type(DiskType type) { - this.type = type; - return this; - } - - /** - * @see AttachDiskOptions#getMode() - */ - public AttachDiskOptions mode(DiskMode mode) { - this.mode = mode; - return this; - } - - /** - * @see AttachDiskOptions#getSource() - */ - public AttachDiskOptions source(URI source) { - this.source = source; - return this; - } - - /** - * @see AttachDiskOptions#getDeviceName() - */ - public AttachDiskOptions deviceName(String deviceName) { - this.deviceName = deviceName; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.options.AttachDiskOptions#getBoot() - */ - public AttachDiskOptions boot(boolean boot) { - this.boot = boot; - return this; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java deleted file mode 100644 index 382bf71..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.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.googlecomputeengine.options; - -import java.net.URI; -import java.util.Date; - -/** - * Options to set the deprecation status of a resource. Currently only for images. - * - * @see <a href="https://developers.google.com/compute/docs/reference/latest/images/deprecate" /> - */ -public class DeprecateOptions { - - public enum State { - DEPRECATED, - OBSOLETE, - DELETED - } - - private State state; - private URI replacement; - private Date deprecated; - private Date obsolete; - private Date deleted; - - /** - * The new deprecation state. - * - * @return the new deprecation state. - */ - public State getState() { - return state; - } - - /** - * Optional URL for replacement of deprecated resource. - * - * @return the URL - */ - public URI getReplacement() { - return replacement; - } - - /** - * Optional RFC3339 timestamp for when the deprecation state was changed to DEPRECATED. - * - * @return the timestamp - */ - public Date getDeprecated() { - return deprecated; - } - - /** - * Optional RFC3339 timestamp for when the deprecation state was changed to OBSOLETE. - * - * @return the timestamp - */ - public Date getObsolete() { - return obsolete; - } - - /** - * Optional RFC3339 timestamp for when the deprecation state was changed to DELETED. - * - * @return the timestamp - */ - public Date getDeleted() { - return deleted; - } - - /** - * @see DeprecateOptions#getState() - */ - public DeprecateOptions state(State state) { - this.state = state; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.options.DeprecateOptions#getReplacement() - */ - public DeprecateOptions replacement(URI replacement) { - this.replacement = replacement; - return this; - } - - /** - * @see DeprecateOptions#getDeprecated() - */ - public DeprecateOptions deprecated(Date deprecated) { - this.deprecated = deprecated; - return this; - } - - /** - * @see DeprecateOptions#getObsolete() - */ - public DeprecateOptions obsolete(Date obsolete) { - this.obsolete = obsolete; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.options.DeprecateOptions#getDeleted() - */ - public DeprecateOptions deleted(Date deleted) { - this.deleted = deleted; - return this; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java deleted file mode 100644 index d70d4d0..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java +++ /dev/null @@ -1,166 +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.googlecomputeengine.options; - -import java.net.URI; -import java.util.Set; - -import org.jclouds.googlecomputeengine.domain.Firewall; - -import com.google.common.collect.ImmutableSet; - -/** - * Options to create a firewall. - * - * @see Firewall - */ -public class FirewallOptions { - - private String name; - private URI network; - private ImmutableSet.Builder<String> sourceRanges = ImmutableSet.builder(); - private ImmutableSet.Builder<String> sourceTags = ImmutableSet.builder(); - private ImmutableSet.Builder<String> targetTags = ImmutableSet.builder(); - private ImmutableSet.Builder<Firewall.Rule> allowed = ImmutableSet.builder(); - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getAllowed() - */ - public Set<Firewall.Rule> getAllowed() { - return allowed.build(); - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getAllowed() - */ - public FirewallOptions addAllowedRule(Firewall.Rule allowedRule) { - this.allowed.add(allowedRule); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getAllowed() - */ - public FirewallOptions allowedRules(Set<Firewall.Rule> allowedRules) { - this.allowed = ImmutableSet.builder(); - this.allowed.addAll(allowedRules); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getName() - */ - public FirewallOptions name(String name) { - this.name = name; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getName() - */ - public String getName() { - return name; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getNetwork() - */ - public FirewallOptions network(URI network) { - this.network = network; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getNetwork() - */ - public URI getNetwork() { - return network; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getSourceRanges() - */ - public Set<String> getSourceRanges() { - return sourceRanges.build(); - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getSourceRanges() - */ - public FirewallOptions addSourceRange(String sourceRange) { - this.sourceRanges.add(sourceRange); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getSourceRanges() - */ - public FirewallOptions sourceRanges(Set<String> sourceRanges) { - this.sourceRanges = ImmutableSet.builder(); - this.sourceRanges.addAll(sourceRanges); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getSourceTags() - */ - public Set<String> getSourceTags() { - return sourceTags.build(); - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getSourceTags() - */ - public FirewallOptions addSourceTag(String sourceTag) { - this.sourceTags.add(sourceTag); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getSourceTags() - */ - public FirewallOptions sourceTags(Set<String> sourceTags) { - this.sourceTags = ImmutableSet.builder(); - this.sourceTags.addAll(sourceTags); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getTargetTags() - */ - public Set<String> getTargetTags() { - return targetTags.build(); - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getTargetTags() - */ - public FirewallOptions addTargetTag(String targetTag) { - this.targetTags.add(targetTag); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Firewall#getTargetTags() - */ - public FirewallOptions targetTags(Set<String> targetTags) { - this.targetTags = ImmutableSet.builder(); - this.targetTags.addAll(targetTags); - return this; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java deleted file mode 100644 index 9a3e88e..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/ListOptions.java +++ /dev/null @@ -1,91 +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.googlecomputeengine.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Allows to optionally specify a filter, max results and a page token for <code>listFirstPage()</code> REST methods. - * - * @see <a href="https://developers.google.com/compute/docs/reference/v1/operations/listFirstPage"/> - */ -public class ListOptions extends BaseHttpRequestOptions { - - /** - * Optional. Filter expression for filtering listed resources, in the form filter={expression}. Your {expression} - * must contain the following: - * <p/> - * {@code <field_name> <comparison_string> <literal_string>} - * <ul> - * <li>{@code <field_name>}: The name of the field you want to compare. The field name must be valid for the - * type of resource being filtered. Only atomic field types are supported (string, number, - * boolean). Array and object fields are not currently supported.</li> - * <li>{@code <comparison_string>}: The comparison string, either eq (equals) or ne (not equals).</li> - * <li>{@code <literal_string>}: The literal string value to filter to. The literal value must be valid - * for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a - * regular expression using RE2 syntax. The literal value must match the entire field. For example, - * when filtering instances, name eq my_instance won't work, but name eq .*my_instance will work.</li> - * </ul> - * <p/> - * For example: - * <p/> - * {@code filter=status ne RUNNING} - * <p/> - * The above filter returns only results whose status field does not equal RUNNING. You can also enclose your - * literal string in single, double, or no quotes. For example, all three of the following would be valid - * expressions: - * <p/> - * {@code filter=status ne "RUNNING"}<br/> - * {@code filter=status ne 'RUNNING'}<br/> - * {@code filter=status ne RUNNING}<br/> - * <p/> - * Complex regular expressions can also be used, like the following: - * {@code name eq '."my_instance_[0-9]+'} - */ - public ListOptions filter(String filter) { - this.queryParameters.put("filter", checkNotNull(filter, "filter")); - return this; - } - - /** - * Sets Maximum count of results to be returned. Maximum and default value is 100. Acceptable items are 0 to - * 100, inclusive. (Default: 100) - */ - public ListOptions maxResults(Integer maxResults) { - this.queryParameters.put("maxResults", checkNotNull(maxResults, "maxResults") + ""); - return this; - } - - public static class Builder { - - /** - * @see ListOptions#filter(String) - */ - public ListOptions filter(String filter) { - return new ListOptions().filter(filter); - } - - /** - * @see ListOptions#maxResults(Integer) - */ - public ListOptions maxResults(Integer maxResults) { - return new ListOptions().maxResults(maxResults); - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java deleted file mode 100644 index ec891ce..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java +++ /dev/null @@ -1,202 +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.googlecomputeengine.options; - -import java.net.URI; -import java.util.Set; - -import com.google.common.collect.ImmutableSet; - -/** - * Options to create a route. - * - * @see org.jclouds.googlecomputeengine.domain.Route - */ -public class RouteOptions { - - private String name; - private URI network; - private String destRange; - private URI nextHopInstance; - private String nextHopIp; - private URI nextHopNetwork; - private URI nextHopGateway; - private String description; - private Integer priority; - - private ImmutableSet.Builder<String> tags = ImmutableSet.builder(); - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getName() - */ - public String getName() { - return name; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getName() - */ - public RouteOptions name(String name) { - this.name = name; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getDescription() - */ - public String getDescription() { - return description; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getDescription() - */ - public RouteOptions description(String description) { - this.description = description; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getDestRange() - */ - public String getDestRange() { - return destRange; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getDestRange() - */ - public RouteOptions destRange(String destRange) { - this.destRange = destRange; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopIp() - */ - public String getNextHopIp() { - return nextHopIp; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopIp() - */ - public RouteOptions nextHopIp(String nextHopIp) { - this.nextHopIp = nextHopIp; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getPriority() - */ - public Integer getPriority() { - return priority; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getPriority() - */ - public RouteOptions priority(Integer priority) { - this.priority = priority; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNetwork() - */ - public RouteOptions network(URI network) { - this.network = network; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNetwork() - */ - public URI getNetwork() { - return network; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopInstance() - */ - public RouteOptions nextHopInstance(URI nextHopInstance) { - this.nextHopInstance = nextHopInstance; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopInstance() - */ - public URI getNextHopInstance() { - return nextHopInstance; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopNetwork() - */ - public RouteOptions nextHopNetwork(URI nextHopNetwork) { - this.nextHopNetwork = nextHopNetwork; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopNetwork() - */ - public URI getNextHopNetwork() { - return nextHopNetwork; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopGateway() - */ - public RouteOptions nextHopGateway(URI nextHopGateway) { - this.nextHopGateway = nextHopGateway; - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopGateway() - */ - public URI getNextHopGateway() { - return nextHopGateway; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getTags() - */ - public Set<String> getTags() { - return tags.build(); - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getTags() - */ - public RouteOptions addTag(String tag) { - this.tags.add(tag); - return this; - } - - /** - * @see org.jclouds.googlecomputeengine.domain.Route#getTags() - */ - public RouteOptions tags(Set<String> tags) { - this.tags = ImmutableSet.builder(); - this.tags.addAll(tags); - return this; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java deleted file mode 100644 index ac34bcc..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/GlobalOperationDonePredicate.java +++ /dev/null @@ -1,59 +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.googlecomputeengine.predicates; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.concurrent.atomic.AtomicReference; - -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.config.UserProject; -import org.jclouds.googlecomputeengine.domain.Operation; - -import com.google.common.base.Predicate; -import com.google.common.base.Supplier; -import com.google.inject.Inject; - -/** - * Tests that a Global Operation is done, returning the completed Operation when it is. - */ -public class GlobalOperationDonePredicate implements Predicate<AtomicReference<Operation>> { - - private final GoogleComputeEngineApi api; - private final Supplier<String> project; - - @Inject - public GlobalOperationDonePredicate(GoogleComputeEngineApi api, @UserProject Supplier<String> project) { - this.api = api; - this.project = project; - } - - @Override - public boolean apply(AtomicReference<Operation> input) { - checkNotNull(input, "input"); - Operation current = api.getGlobalOperationApiForProject(project.get()).get(input.get().getName()); - switch (current.getStatus()) { - case DONE: - input.set(current); - return true; - case PENDING: - case RUNNING: - default: - return false; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/InstancePredicates.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/InstancePredicates.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/InstancePredicates.java deleted file mode 100644 index 8cde680..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/InstancePredicates.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.googlecomputeengine.predicates; - -import org.jclouds.googlecomputeengine.domain.InstanceTemplate.PersistentDisk; - -import com.google.common.base.Predicate; - -public class InstancePredicates { - - public static Predicate<PersistentDisk> isBootDisk() { - return new Predicate<PersistentDisk>() { - @Override - public boolean apply(PersistentDisk input) { - return input.isBoot(); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicates.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicates.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicates.java deleted file mode 100644 index 63d2767..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicates.java +++ /dev/null @@ -1,121 +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.googlecomputeengine.predicates; - -import org.jclouds.googlecomputeengine.domain.Firewall; -import org.jclouds.googlecomputeengine.domain.Firewall.Rule; -import org.jclouds.net.domain.IpPermission; -import org.jclouds.net.domain.IpProtocol; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.common.collect.Range; -import com.google.common.collect.Sets; - -public class NetworkFirewallPredicates { - - public static Predicate<Firewall> hasProtocol(final IpProtocol protocol) { - return new Predicate<Firewall>() { - - @Override - public boolean apply(Firewall fw) { - for (Rule rule : fw.getAllowed()) { - if (rule.getIpProtocol().equals(protocol)) { - return true; - } - } - - return false; - } - }; - } - - public static Predicate<Firewall> hasPortRange(final Range<Integer> portRange) { - return new Predicate<Firewall>() { - - @Override - public boolean apply(Firewall fw) { - return Iterables.any(fw.getAllowed(), new Predicate<Rule>() { - @Override - public boolean apply(Rule input) { - return input.getPorts().encloses(portRange); - } - }); - } - }; - } - - public static Predicate<Firewall> hasSourceTag(final String sourceTag) { - return new Predicate<Firewall>() { - @Override - public boolean apply(Firewall input) { - return input.getSourceTags() != null && input.getSourceTags().contains(sourceTag); - } - }; - } - - public static Predicate<Firewall> hasSourceRange(final String sourceRange) { - return new Predicate<Firewall>() { - @Override - public boolean apply(Firewall input) { - return input.getSourceRanges() != null && input.getSourceRanges().contains(sourceRange); - } - }; - } - - public static Predicate<Firewall> equalsIpPermission(final IpPermission permission) { - return new Predicate<Firewall>() { - @Override - public boolean apply(Firewall input) { - return Iterables.elementsEqual(permission.getGroupIds(), input.getSourceTags()) - && Iterables.elementsEqual(permission.getCidrBlocks(), input.getSourceRanges()) - && (input.getAllowed().size() == 1 - && ruleEqualsIpPermission(permission).apply(Iterables.getOnlyElement(input.getAllowed()))); - } - }; - } - - public static Predicate<Firewall> providesIpPermission(final IpPermission permission) { - return new Predicate<Firewall>() { - @Override - public boolean apply(Firewall input) { - boolean groupsMatchTags = (permission.getGroupIds().isEmpty() && input.getSourceTags().isEmpty()) - || !Sets.intersection(permission.getGroupIds(), input.getSourceTags()).isEmpty(); - boolean cidrsMatchRanges = (permission.getCidrBlocks().isEmpty() && input.getSourceRanges().isEmpty()) - || !Sets.intersection(permission.getCidrBlocks(), input.getSourceRanges()).isEmpty(); - boolean firewallHasPorts = hasProtocol(permission.getIpProtocol()).apply(input) - && ((permission.getFromPort() == 0 && permission.getToPort() == 0) - || hasPortRange(Range.closed(permission.getFromPort(), permission.getToPort())).apply(input)); - - return groupsMatchTags && cidrsMatchRanges && firewallHasPorts; - } - }; - } - - private static Predicate<Firewall.Rule> ruleEqualsIpPermission(final IpPermission permission) { - return new Predicate<Rule>() { - @Override - public boolean apply(Firewall.Rule input) { - return permission.getIpProtocol().equals(input.getIpProtocol()) - && ((input.getPorts().isEmpty() && permission.getFromPort() == 0 && permission.getToPort() == 0) - || (input.getPorts().asRanges().size() == 1 - && permission.getFromPort() == Iterables.getOnlyElement(input.getPorts().asRanges()).lowerEndpoint() - && permission.getToPort() == Iterables.getOnlyElement(input.getPorts().asRanges()).upperEndpoint())); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java deleted file mode 100644 index 1f3dee6..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/RegionOperationDonePredicate.java +++ /dev/null @@ -1,69 +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.googlecomputeengine.predicates; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.net.URI; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; - -import org.jclouds.collect.Memoized; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.config.UserProject; -import org.jclouds.googlecomputeengine.domain.Operation; -import org.jclouds.googlecomputeengine.domain.Region; - -import com.google.common.base.Predicate; -import com.google.common.base.Supplier; -import com.google.inject.Inject; - -/** - * Tests that a Global Operation is done, returning the completed Operation when it is. - */ -public class RegionOperationDonePredicate implements Predicate<AtomicReference<Operation>> { - - private final GoogleComputeEngineApi api; - private final Supplier<String> project; - private final Supplier<Map<URI, Region>> regions; - - @Inject - RegionOperationDonePredicate(GoogleComputeEngineApi api, @UserProject Supplier<String> project, - @Memoized Supplier<Map<URI, Region>> regions) { - this.api = api; - this.project = project; - this.regions = regions; - } - - @Override - public boolean apply(AtomicReference<Operation> input) { - checkNotNull(input, "input"); - - Operation current = api.getRegionOperationApiForProject(project.get()) - .getInRegion(regions.get().get(input.get().getRegion().get()).getName(), - input.get().getName()); - switch (current.getStatus()) { - case DONE: - input.set(current); - return true; - case PENDING: - case RUNNING: - default: - return false; - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java deleted file mode 100644 index c63c6f3..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/main/java/org/jclouds/googlecomputeengine/predicates/ZoneOperationDonePredicate.java +++ /dev/null @@ -1,68 +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.googlecomputeengine.predicates; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.net.URI; -import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; - -import org.jclouds.collect.Memoized; -import org.jclouds.domain.Location; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; -import org.jclouds.googlecomputeengine.config.UserProject; -import org.jclouds.googlecomputeengine.domain.Operation; - -import com.google.common.base.Predicate; -import com.google.common.base.Supplier; -import com.google.inject.Inject; - -/** - * Tests that a Zone Operation is done, returning the completed Operation when it is. - */ -public class ZoneOperationDonePredicate implements Predicate<AtomicReference<Operation>> { - - private final GoogleComputeEngineApi api; - private final Supplier<String> project; - private final Supplier<Map<URI, ? extends Location>> zones; - - @Inject - ZoneOperationDonePredicate(GoogleComputeEngineApi api, @UserProject Supplier<String> project, - @Memoized Supplier<Map<URI, ? extends Location>> zones) { - this.api = api; - this.project = project; - this.zones = zones; - } - - @Override - public boolean apply(AtomicReference<Operation> input) { - checkNotNull(input, "input"); - Operation current = api.getZoneOperationApiForProject(project.get()) - .getInZone(zones.get().get(input.get().getZone().get()).getId(), - input.get().getName()); - switch (current.getStatus()) { - case DONE: - input.set(current); - return true; - case PENDING: - case RUNNING: - default: - return false; - } - } -}
