You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ev...@apache.org on 2014/11/18 19:56:20 UTC
[5/5] jclouds git commit: JCLOUDS-716: Remove Rackspace First-Gen
Cloud Servers
JCLOUDS-716: Remove Rackspace First-Gen Cloud Servers
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/162226b8
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/162226b8
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/162226b8
Branch: refs/heads/master
Commit: 162226b8a96f249d0717ddf94752821730698a77
Parents: 60ba755
Author: Everett Toews <ev...@apache.org>
Authored: Tue Nov 18 11:50:01 2014 -0600
Committer: Everett Toews <ev...@apache.org>
Committed: Tue Nov 18 12:56:04 2014 -0600
----------------------------------------------------------------------
apis/cloudservers/README.txt | 6 -
apis/cloudservers/pom.xml | 131 ---
.../cloudservers/CloudServersApiMetadata.java | 78 --
.../cloudservers/CloudServersClient.java | 554 ------------
.../BindBackupScheduleToJsonPayload.java | 50 --
...CloudServersComputeServiceContextModule.java | 136 ---
.../extensions/CloudServersImageExtension.java | 125 ---
.../functions/CloudServersImageToImage.java | 54 --
.../CloudServersImageToOperatingSystem.java | 85 --
.../compute/functions/FlavorToHardware.java | 38 -
.../compute/functions/ServerToNodeMetadata.java | 139 ---
.../CloudServersComputeServiceAdapter.java | 141 ---
.../config/CloudServersHttpApiModule.java | 87 --
.../cloudservers/domain/AbsoluteLimit.java | 123 ---
.../org/jclouds/cloudservers/domain/Action.java | 21 -
.../jclouds/cloudservers/domain/Addresses.java | 142 ---
.../cloudservers/domain/BackupSchedule.java | 143 ---
.../cloudservers/domain/DailyBackup.java | 35 -
.../org/jclouds/cloudservers/domain/Flavor.java | 162 ----
.../org/jclouds/cloudservers/domain/Image.java | 219 -----
.../cloudservers/domain/ImageStatus.java | 41 -
.../org/jclouds/cloudservers/domain/Limits.java | 130 ---
.../jclouds/cloudservers/domain/RateLimit.java | 225 -----
.../cloudservers/domain/RateLimitUnit.java | 35 -
.../jclouds/cloudservers/domain/RebootType.java | 31 -
.../org/jclouds/cloudservers/domain/Server.java | 301 -------
.../cloudservers/domain/ServerStatus.java | 50 --
.../jclouds/cloudservers/domain/ShareIp.java | 120 ---
.../cloudservers/domain/SharedIpGroup.java | 152 ----
.../jclouds/cloudservers/domain/Version.java | 159 ----
.../cloudservers/domain/VersionStatus.java | 35 -
.../cloudservers/domain/WeeklyBackup.java | 35 -
.../ParseCloudServersErrorFromHttpResponse.java | 90 --
.../options/CreateServerOptions.java | 234 -----
.../options/CreateSharedIpGroupOptions.java | 84 --
.../cloudservers/options/ListOptions.java | 106 ---
.../options/RebuildServerOptions.java | 71 --
.../cloudservers/predicates/ServerActive.java | 62 --
.../cloudservers/predicates/ServerDeleted.java | 62 --
.../services/org.jclouds.apis.ApiMetadata | 1 -
.../CloudServersApiMetadataTest.java | 28 -
.../CloudServersClientLiveTest.java | 606 -------------
.../cloudservers/CloudServersClientTest.java | 898 -------------------
.../cloudservers/CloudServersExpectTest.java | 50 --
.../CloudServersComputeServiceLiveTest.java | 83 --
...dServersComputeServiceContextModuleTest.java | 32 -
.../CloudServersImageExtensionExpectTest.java | 88 --
.../CloudServersImageExtensionLiveTest.java | 40 -
.../functions/CloudServersImageToImageTest.java | 59 --
.../compute/functions/FlavorToHardwareTest.java | 56 --
.../functions/ServerToNodeMetadataTest.java | 163 ----
.../jclouds/cloudservers/domain/ServerTest.java | 40 -
.../ParseAddressesFromJsonResponseTest.java | 57 --
...ParseBackupScheduleFromJsonResponseTest.java | 64 --
.../ParseFlavorFromJsonResponseTest.java | 59 --
.../ParseFlavorListFromJsonResponseTest.java | 77 --
.../ParseImageFromJsonResponseTest.java | 87 --
.../ParseImageListFromJsonResponseTest.java | 97 --
...arseInetAddressListFromJsonResponseTest.java | 65 --
.../ParseServerFromJsonResponseTest.java | 75 --
.../ParseServerListFromJsonResponseTest.java | 98 --
.../ParseSharedIpGroupFromJsonResponseTest.java | 56 --
...seSharedIpGroupListFromJsonResponseTest.java | 78 --
.../handlers/RetryOnRenewExpectTest.java | 128 ---
...aseCloudServersComputeServiceExpectTest.java | 96 --
.../BaseCloudServersRestClientExpectTest.java | 81 --
.../options/CreateServerOptionsTest.java | 132 ---
.../options/CreateSharedIpGroupOptionsTest.java | 71 --
.../cloudservers/options/ListOptionsTest.java | 84 --
.../options/RebuildServerOptionsTest.java | 72 --
apis/cloudservers/src/test/resources/log4j.xml | 149 ---
.../test/resources/test_get_flavor_details.json | 8 -
.../test/resources/test_get_image_active.json | 11 -
.../test/resources/test_get_image_details.json | 11 -
.../test/resources/test_get_server_detail.json | 25 -
.../test_get_sharedipgroup_details.json | 7 -
.../src/test/resources/test_list_addresses.json | 12 -
.../resources/test_list_addresses_private.json | 8 -
.../resources/test_list_addresses_public.json | 7 -
.../resources/test_list_backupschedule.json | 7 -
.../src/test/resources/test_list_flavors.json | 12 -
.../resources/test_list_flavors_detail.json | 16 -
.../src/test/resources/test_list_images.json | 12 -
.../test/resources/test_list_images_detail.json | 20 -
.../test_list_images_detail_imageextension.json | 65 --
.../src/test/resources/test_list_servers.json | 12 -
.../resources/test_list_servers_detail.json | 45 -
.../resources/test_list_sharedipgroups.json | 12 -
.../test_list_sharedipgroups_detail.json | 14 -
apis/pom.xml | 1 -
providers/cloudservers-uk/README.txt | 8 -
providers/cloudservers-uk/pom.xml | 131 ---
.../CloudServersUKProviderMetadata.java | 80 --
.../org.jclouds.providers.ProviderMetadata | 1 -
.../CloudServersUKClientLiveTest.java | 27 -
.../CloudServersUKProviderTest.java | 46 -
.../CloudServersUKComputeServiceLiveTest.java | 30 -
.../CloudServersUKTemplateBuilderLiveTest.java | 52 --
providers/cloudservers-us/README.txt | 8 -
providers/cloudservers-us/pom.xml | 130 ---
.../CloudServersUSProviderMetadata.java | 80 --
.../org.jclouds.providers.ProviderMetadata | 1 -
.../CloudServersUSClientLiveTest.java | 27 -
.../CloudServersUSProviderTest.java | 46 -
.../CloudServersUSComputeServiceLiveTest.java | 30 -
.../CloudServersUSTemplateBuilderLiveTest.java | 52 --
providers/pom.xml | 2 -
107 files changed, 9318 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/README.txt
----------------------------------------------------------------------
diff --git a/apis/cloudservers/README.txt b/apis/cloudservers/README.txt
deleted file mode 100644
index 39cab16..0000000
--- a/apis/cloudservers/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# The jclouds API for Rackspace's Cloud Server (http://www.rackspacecloud.com/cloud_hosting_products/servers/).
-#
-# TODO: Implementation status.
-# TODO: Supported features.
-# TODO: Usage example.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/pom.xml
----------------------------------------------------------------------
diff --git a/apis/cloudservers/pom.xml b/apis/cloudservers/pom.xml
deleted file mode 100644
index 6ac8f88..0000000
--- a/apis/cloudservers/pom.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <relativePath>../../project/pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>cloudservers</artifactId>
- <name>jclouds cloudservers api</name>
- <description>jclouds components to access an implementation of CloudServers</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.cloudservers.endpoint>https://auth.api.rackspacecloud.com</test.cloudservers.endpoint>
- <test.cloudservers.api-version>1.0</test.cloudservers.api-version>
- <test.cloudservers.build-version />
- <test.cloudservers.identity>${test.rackspace.identity}</test.cloudservers.identity>
- <test.cloudservers.credential>${test.rackspace.credential}</test.cloudservers.credential>
- <test.cloudservers.template />
- <jclouds.osgi.export>org.jclouds.cloudservers*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
- </jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds.common</groupId>
- <artifactId>openstack-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.common</groupId>
- <artifactId>openstack-common</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <test.cloudstack.endpoint>${test.cloudstack.endpoint}</test.cloudstack.endpoint>
- <test.cloudstack.api-version>${test.cloudstack.api-version}</test.cloudstack.api-version>
- <test.cloudstack.build-version>${test.cloudstack.build-version}</test.cloudstack.build-version>
- <test.cloudstack.identity>${test.cloudstack.identity}</test.cloudstack.identity>
- <test.cloudstack.credential>${test.cloudstack.credential}</test.cloudstack.credential>
- <test.cloudstack.template>${test.cloudstack.template}</test.cloudstack.template>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
-
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
deleted file mode 100644
index 04ed2e7..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
+++ /dev/null
@@ -1,78 +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.cloudservers;
-
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
-import org.jclouds.cloudservers.config.CloudServersHttpApiModule;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.rest.internal.BaseHttpApiMetadata;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-public class CloudServersApiMetadata extends BaseHttpApiMetadata {
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public CloudServersApiMetadata() {
- this(new Builder());
- }
-
- protected CloudServersApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = BaseHttpApiMetadata.defaultProperties();
- return properties;
- }
-
- public static class Builder extends BaseHttpApiMetadata.Builder<CloudServersClient, Builder> {
-
- protected Builder() {
- super(CloudServersClient.class);
- id("cloudservers")
- .name("Rackspace Cloud Servers API")
- .identityName("Username")
- .credentialName("API Key")
- .documentation(URI.create("http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide/content/ch01.html"))
- .version("1.0")
- .defaultEndpoint("https://auth.api.rackspacecloud.com")
- .defaultProperties(CloudServersApiMetadata.defaultProperties())
- .view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersHttpApiModule.class, CloudServersComputeServiceContextModule.class));
- }
-
- @Override
- public CloudServersApiMetadata build() {
- return new CloudServersApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
deleted file mode 100644
index 5b0d5d8..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
+++ /dev/null
@@ -1,554 +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.cloudservers;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import static org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-
-import java.io.Closeable;
-import java.util.Set;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.jclouds.cloudservers.binders.BindBackupScheduleToJsonPayload;
-import org.jclouds.cloudservers.domain.Addresses;
-import org.jclouds.cloudservers.domain.BackupSchedule;
-import org.jclouds.cloudservers.domain.Flavor;
-import org.jclouds.cloudservers.domain.Image;
-import org.jclouds.cloudservers.domain.Limits;
-import org.jclouds.cloudservers.domain.RebootType;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.SharedIpGroup;
-import org.jclouds.cloudservers.options.CreateServerOptions;
-import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
-import org.jclouds.cloudservers.options.ListOptions;
-import org.jclouds.cloudservers.options.RebuildServerOptions;
-import org.jclouds.openstack.filters.AddTimestampQuery;
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.services.Compute;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.Unwrap;
-
-/**
- * Provides access to Cloud Servers via their REST API.
- *
- * @deprecated The Rackspace First-Gen Cloud Servers product has been deprecated. Please refer to the
- * <a href="http://jclouds.apache.org/guides/rackspace">Rackspace Getting Started Guide</a>
- * for accessing the Rackspace Cloud. This API will be removed in 2.0.
- */
-@Deprecated
-@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
-@Endpoint(Compute.class)
-public interface CloudServersClient extends Closeable {
- /**
- * All accounts, by default, have a preconfigured set of thresholds (or limits) to manage
- * capacity and prevent abuse of the system. The system recognizes two kinds of limits: rate
- * limits and absolute limits. Rate limits are thresholds that are reset after a certain amount
- * of time passes. Absolute limits are fixed.
- *
- * @return limits on the account
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/limits")
- @Fallback(NullOnNotFoundOr404.class)
- Limits getLimits();
-
- /**
- *
- * List all servers (IDs and names only)
- *
- * This operation provides a list of servers associated with your identity. Servers that have
- * been deleted are not included in this list.
- * <p/>
- * in order to retrieve all details, pass the option {@link ListOptions#withDetails()
- * withDetails()}
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers")
- @Fallback(EmptySetOnNotFoundOr404.class)
- Set<Server> listServers(ListOptions... options);
-
- /**
- *
- * This operation returns details of the specified server.
- *
- * @return null, if the server is not found
- * @see Server
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Fallback(NullOnNotFoundOr404.class)
- @Path("/servers/{id}")
- Server getServer(@PathParam("id") int id);
-
- /**
- *
- * This operation deletes a cloud server instance from the system.
- * <p/>
- * Note: When a server is deleted, all images created from that server are also removed.
- *
- * @return false if the server is not found
- * @see Server
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/servers/{id}")
- boolean deleteServer(@PathParam("id") int id);
-
- /**
- * The reboot function allows for either a soft or hard reboot of a server.
- * <p/>
- * Status Transition:
- * <p/>
- * ACTIVE - REBOOT - ACTIVE (soft reboot)
- * <p/>
- * ACTIVE - HARD_REBOOT - ACTIVE (hard reboot)
- *
- * @param rebootType
- * With a soft reboot, the operating system is signaled to restart, which allows for a
- * graceful shutdown of all processes. A hard reboot is the equivalent of power cycling
- * the server.
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(APPLICATION_JSON)
- @Payload("%7B\"reboot\":%7B\"type\":\"{type}\"%7D%7D")
- void rebootServer(@PathParam("id") int id, @PayloadParam("type") RebootType rebootType);
-
- /**
- * The resize function converts an existing server to a different flavor, in essence, scaling the
- * server up or down. The original server is saved for a period of time to allow rollback if
- * there is a problem. All resizes should be tested and explicitly confirmed, at which time the
- * original server is removed. All resizes are automatically confirmed after 24 hours if they are
- * not confirmed or reverted.
- * <p/>
- * Status Transition:
- * <p/>
- * ACTIVE - QUEUE_RESIZE - PREP_RESIZE - VERIFY_RESIZE
- * <p/>
- * ACTIVE - QUEUE_RESIZE - ACTIVE (on error)
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(APPLICATION_JSON)
- @Payload("%7B\"resize\":%7B\"flavorId\":{flavorId}%7D%7D")
- void resizeServer(@PathParam("id") int id, @PayloadParam("flavorId") int flavorId);
-
- /**
- * The resize function converts an existing server to a different flavor, in essence, scaling the
- * server up or down. The original server is saved for a period of time to allow rollback if
- * there is a problem. All resizes should be tested and explicitly confirmed, at which time the
- * original server is removed. All resizes are automatically confirmed after 24 hours if they are
- * not confirmed or reverted.
- * <p/>
- * Status Transition:
- * <p/>
- * VERIFY_RESIZE - ACTIVE
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(APPLICATION_JSON)
- @Payload("{\"confirmResize\":null}")
- void confirmResizeServer(@PathParam("id") int id);
-
- /**
- * The resize function converts an existing server to a different flavor, in essence, scaling the
- * server up or down. The original server is saved for a period of time to allow rollback if
- * there is a problem. All resizes should be tested and explicitly reverted, at which time the
- * original server is removed. All resizes are automatically reverted after 24 hours if they are
- * not reverted or reverted.
- * <p/>
- * Status Transition:
- * <p/>
- * VERIFY_RESIZE - ACTIVE
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(APPLICATION_JSON)
- @Payload("{\"revertResize\":null}")
- void revertResizeServer(@PathParam("id") int id);
-
- /**
- * This operation asynchronously provisions a new server. The progress of this operation depends
- * on several factors including location of the requested image, network i/o, host load, and the
- * selected flavor. The progress of the request can be checked by performing a GET on /server/id,
- * which will return a progress attribute (0-100% completion). A password will be randomly
- * generated for you and returned in the response object. For security reasons, it will not be
- * returned in subsequent GET calls against a given server ID.
- *
- * @param options
- * - used to specify extra files, metadata, or ip parameters during server creation.
- */
- @POST
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers")
- @MapBinder(CreateServerOptions.class)
- Server createServer(@PayloadParam("name") String name, @PayloadParam("imageId") int imageId,
- @PayloadParam("flavorId") int flavorId, CreateServerOptions... options);
-
- /**
- * The rebuild function removes all data on the server and replaces it with the specified image.
- * Server ID and IP addresses remain the same.
- * <p/>
- * Status Transition:
- * <p/>
- * ACTIVE - REBUILD - ACTIVE
- * <p/>
- * ACTIVE - REBUILD - ERROR (on error)
- * <p/>
- *
- * @param options
- * - imageId is an optional argument. If it is not specified, the server is rebuilt
- * with the original imageId.
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @MapBinder(RebuildServerOptions.class)
- void rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
-
- /**
- * /** This operation allows you share an IP address to the specified server
- * <p/>
- * This operation shares an IP from an existing server in the specified shared IP group to
- * another specified server in the same group. The operation modifies cloud network restrictions
- * to allow IP traffic for the given IP to/from the server specified.
- *
- * <p/>
- * Status Transition: ACTIVE - SHARE_IP - ACTIVE (if configureServer is true) ACTIVE -
- * SHARE_IP_NO_CONFIG - ACTIVE
- *
- * @param configureServer
- * <p/>
- * if set to true, the server is configured with the new address, though the address is
- * not enabled. Note that configuring the server does require a reboot.
- * <p/>
- * If set to false, does not bind the IP to the server itself. A heartbeat facility
- * (e.g. keepalived) can then be used within the servers to perform health checks and
- * manage IP failover.
- */
- @PUT
- @Path("/servers/{id}/ips/public/{address}")
- @Produces(APPLICATION_JSON)
- @Payload("%7B\"shareIp\":%7B\"sharedIpGroupId\":{sharedIpGroupId},\"configureServer\":{configureServer}%7D%7D")
- void shareIp(@PathParam("address") String addressToShare, @PathParam("id") int serverToTosignBindressTo,
- @PayloadParam("sharedIpGroupId") int sharedIpGroup, @PayloadParam("configureServer") boolean configureServer);
-
- /**
- * This operation removes a shared IP address from the specified server.
- * <p/>
- * Status Transition: ACTIVE - DELETE_IP - ACTIVE
- *
- * @param addressToShare
- * @param serverToTosignBindressTo
- * @return
- */
- @DELETE
- @Path("/servers/{id}/ips/public/{address}")
- @Fallback(VoidOnNotFoundOr404.class)
- void unshareIp(@PathParam("address") String addressToShare, @PathParam("id") int serverToTosignBindressTo);
-
- /**
- * This operation allows you to change the administrative password.
- * <p/>
- * Status Transition: ACTIVE - PASSWORD - ACTIVE
- *
- */
- @PUT
- @Path("/servers/{id}")
- @Produces(APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
- void changeAdminPass(@PathParam("id") int id, @PayloadParam("adminPass") String adminPass);
-
- /**
- * This operation allows you to update the name of the server. This operation changes the name of
- * the server in the Cloud Servers system and does not change the server host name itself.
- * <p/>
- * Status Transition: ACTIVE - PASSWORD - ACTIVE
- *
- */
- @PUT
- @Path("/servers/{id}")
- @Produces(APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"name\":\"{name}\"%7D%7D")
- void renameServer(@PathParam("id") int id, @PayloadParam("name") String newName);
-
- /**
- *
- * List available flavors (IDs and names only)
- *
- * in order to retrieve all details, pass the option {@link ListOptions#withDetails()
- * withDetails()}
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/flavors")
- @Fallback(EmptySetOnNotFoundOr404.class)
- Set<Flavor> listFlavors(ListOptions... options);
-
- /**
- *
- * This operation returns details of the specified flavor.
- *
- * @return null, if the flavor is not found
- * @see Flavor
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/flavors/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- Flavor getFlavor(@PathParam("id") int id);
-
- /**
- *
- * List available images (IDs and names only)
- *
- * in order to retrieve all details, pass the option {@link ListOptions#withDetails()
- * withDetails()}
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/images")
- @Fallback(EmptySetOnNotFoundOr404.class)
- Set<Image> listImages(ListOptions... options);
-
- /**
- *
- * This operation returns details of the specified image.
- *
- * @return null, if the image is not found
- *
- * @see Image
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @QueryParams(keys = "format", values = "json")
- @Path("/images/{id}")
- Image getImage(@PathParam("id") int id);
-
- /**
- *
- * This operation deletes an image from the system.
- * <p/>
- * Note: Images are immediately removed. Currently, there are no state transitions to track the
- * delete operation.
- *
- * @return false if the image is not found
- * @see Image
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/images/{id}")
- boolean deleteImage(@PathParam("id") int id);
-
- /**
- *
- * This operation creates a new image for the given server ID. Once complete, a new image will be
- * available that can be used to rebuild or create servers. Specifying the same image name as an
- * existing custom image replaces the image. The image creation status can be queried by
- * performing a GET on /images/id and examining the status and progress attributes.
- *
- * Status Transition:
- * <p/>
- * QUEUED - PREPARING - SAVING - ACTIVE
- * <p/>
- * QUEUED - PREPARING - SAVING - FAILED (on error)
- * <p/>
- * Note: At present, image creation is an asynchronous operation, so coordinating the creation
- * with data quiescence, etc. is currently not possible.
- *
- * @throws ResourceNotFoundException if the server is not found
- * @see Image
- */
- @POST
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/images")
- @Produces(APPLICATION_JSON)
- @Payload("%7B\"image\":%7B\"serverId\":{serverId},\"name\":\"{name}\"%7D%7D")
- Image createImageFromServer(@PayloadParam("name") String imageName, @PayloadParam("serverId") int serverId);
-
- /**
- *
- * List shared IP groups (IDs and names only)
- *
- * in order to retrieve all details, pass the option {@link ListOptions#withDetails()
- * withDetails()}
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @Fallback(EmptySetOnNotFoundOr404.class)
- Set<SharedIpGroup> listSharedIpGroups(ListOptions... options);
-
- /**
- *
- * This operation returns details of the specified shared IP group.
- *
- * @return null, if the shared ip group is not found
- *
- * @see SharedIpGroup
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- SharedIpGroup getSharedIpGroup(@PathParam("id") int id);
-
- /**
- * This operation creates a new shared IP group. Please note, all responses to requests for
- * shared_ip_groups return an array of servers. However, on a create request, the shared IP group
- * can be created empty or can be initially populated with a single server. Use
- * {@link CreateSharedIpGroupOptions} to specify an server.
- */
- @POST
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @MapBinder(CreateSharedIpGroupOptions.class)
- SharedIpGroup createSharedIpGroup(@PayloadParam("name") String name,
- CreateSharedIpGroupOptions... options);
-
- /**
- * This operation deletes the specified shared IP group. This operation will ONLY succeed if 1)
- * there are no active servers in the group (i.e. they have all been terminated) or 2) no servers
- * in the group are actively sharing IPs.
- *
- * @return false if the shared ip group is not found
- * @see SharedIpGroup
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/shared_ip_groups/{id}")
- boolean deleteSharedIpGroup(@PathParam("id") int id);
-
- /**
- * List the backup schedule for the specified server
- *
- * @throws ResourceNotFoundException, if the server doesn't exist
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/backup_schedule")
- BackupSchedule getBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * Delete backup schedule for the specified server.
- * <p/>
- * Web Hosting #119571 currently disables the schedule, not deletes it.
- *
- * @return false if the schedule is not found
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/servers/{id}/backup_schedule")
- boolean deleteBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * Enable/update the backup schedule for the specified server
- *
- */
- @POST
- @Path("/servers/{id}/backup_schedule")
- void replaceBackupSchedule(@PathParam("id") int id,
- @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
-
- /**
- * List all server addresses
- *
- * returns empty set if the server doesn't exist
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips")
- Addresses getAddresses(@PathParam("id") int serverId);
-
- /**
- * List all public server addresses
- *
- * returns empty set if the server doesn't exist
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips/public")
- @Fallback(EmptySetOnNotFoundOr404.class)
- Set<String> listPublicAddresses(@PathParam("id") int serverId);
-
- /**
- * List all private server addresses
- *
- * returns empty set if the server doesn't exist
- */
- @GET
- @Unwrap
- @Consumes(APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips/private")
- @Fallback(EmptySetOnNotFoundOr404.class)
- Set<String> listPrivateAddresses(@PathParam("id") int serverId);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/binders/BindBackupScheduleToJsonPayload.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/binders/BindBackupScheduleToJsonPayload.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/binders/BindBackupScheduleToJsonPayload.java
deleted file mode 100644
index 13b83b5..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/binders/BindBackupScheduleToJsonPayload.java
+++ /dev/null
@@ -1,50 +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.cloudservers.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.domain.BackupSchedule;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.json.Json;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-
-@Singleton
-public class BindBackupScheduleToJsonPayload extends BindToJsonPayload {
- @Inject
- public BindBackupScheduleToJsonPayload(Json jsonBinder) {
- super(jsonBinder);
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- throw new IllegalStateException("Replace Backup Schedule needs an BackupSchedule object, not a Map");
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
- checkArgument(toBind instanceof BackupSchedule, "this binder is only valid for BackupSchedules!");
- return super.bindToRequest(request, (Object) ImmutableMap.of("backupSchedule", toBind));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
deleted file mode 100644
index 44cbb95..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
+++ /dev/null
@@ -1,136 +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.cloudservers.compute.config;
-
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.compute.extensions.CloudServersImageExtension;
-import org.jclouds.cloudservers.compute.functions.CloudServersImageToImage;
-import org.jclouds.cloudservers.compute.functions.CloudServersImageToOperatingSystem;
-import org.jclouds.cloudservers.compute.functions.FlavorToHardware;
-import org.jclouds.cloudservers.compute.functions.ServerToNodeMetadata;
-import org.jclouds.cloudservers.compute.strategy.CloudServersComputeServiceAdapter;
-import org.jclouds.cloudservers.domain.Flavor;
-import org.jclouds.cloudservers.domain.ImageStatus;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.ServerStatus;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.domain.Location;
-import org.jclouds.functions.IdentityFunction;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Injector;
-import com.google.inject.Provides;
-import com.google.inject.TypeLiteral;
-
-public class CloudServersComputeServiceContextModule extends
- ComputeServiceAdapterContextModule<Server, Flavor, org.jclouds.cloudservers.domain.Image, Location> {
-
- @SuppressWarnings("unchecked")
- @Override
- protected void configure() {
- super.configure();
- bind(new TypeLiteral<ComputeServiceAdapter<Server, Flavor, org.jclouds.cloudservers.domain.Image, Location>>() {
- }).to(CloudServersComputeServiceAdapter.class);
-
- bind(new TypeLiteral<Function<Server, NodeMetadata>>() {
- }).to(ServerToNodeMetadata.class);
-
- bind(new TypeLiteral<Function<org.jclouds.cloudservers.domain.Image, Image>>() {
- }).to(CloudServersImageToImage.class);
- bind(new TypeLiteral<Function<org.jclouds.cloudservers.domain.Image, OperatingSystem>>() {
- }).to(CloudServersImageToOperatingSystem.class);
-
- bind(new TypeLiteral<Function<Flavor, Hardware>>() {
- }).to(FlavorToHardware.class);
-
- // we aren't converting location from a provider-specific type
- bind(new TypeLiteral<Function<Location, Location>>() {
- }).to(Class.class.cast(IdentityFunction.class));
-
- bind(new TypeLiteral<ImageExtension>() {
- }).to(CloudServersImageExtension.class);
- }
-
- @VisibleForTesting
- public static final Map<ServerStatus, NodeMetadata.Status> toPortableNodeStatus = ImmutableMap
- .<ServerStatus, NodeMetadata.Status> builder()
- .put(ServerStatus.ACTIVE, NodeMetadata.Status.RUNNING)
- .put(ServerStatus.SUSPENDED, NodeMetadata.Status.SUSPENDED)
- .put(ServerStatus.DELETED, NodeMetadata.Status.TERMINATED)
- .put(ServerStatus.QUEUE_RESIZE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.PREP_RESIZE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.RESIZE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.VERIFY_RESIZE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.QUEUE_MOVE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.PREP_MOVE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.MOVE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.VERIFY_MOVE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.RESCUE, NodeMetadata.Status.PENDING)
- .put(ServerStatus.ERROR, NodeMetadata.Status.ERROR)
- .put(ServerStatus.BUILD, NodeMetadata.Status.PENDING)
- .put(ServerStatus.RESTORING, NodeMetadata.Status.PENDING)
- .put(ServerStatus.PASSWORD, NodeMetadata.Status.PENDING)
- .put(ServerStatus.REBUILD, NodeMetadata.Status.PENDING)
- .put(ServerStatus.DELETE_IP, NodeMetadata.Status.PENDING)
- .put(ServerStatus.SHARE_IP_NO_CONFIG, NodeMetadata.Status.PENDING)
- .put(ServerStatus.SHARE_IP, NodeMetadata.Status.PENDING)
- .put(ServerStatus.REBOOT, NodeMetadata.Status.PENDING)
- .put(ServerStatus.HARD_REBOOT, NodeMetadata.Status.PENDING)
- .put(ServerStatus.UNKNOWN, NodeMetadata.Status.UNRECOGNIZED)
- .put(ServerStatus.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED).build();
-
- @Singleton
- @Provides
- Map<ServerStatus, NodeMetadata.Status> toPortableNodeStatus() {
- return toPortableNodeStatus;
- }
-
- @VisibleForTesting
- public static final Map<ImageStatus, Image.Status> toPortableImageStatus = ImmutableMap
- .<ImageStatus, Image.Status> builder()
- .put(ImageStatus.ACTIVE, Image.Status.AVAILABLE)
- .put(ImageStatus.SAVING, Image.Status.PENDING)
- .put(ImageStatus.PREPARING, Image.Status.PENDING)
- .put(ImageStatus.QUEUED, Image.Status.PENDING)
- .put(ImageStatus.FAILED, Image.Status.ERROR)
- .put(ImageStatus.UNKNOWN, Image.Status.UNRECOGNIZED)
- .put(ImageStatus.UNRECOGNIZED, Image.Status.UNRECOGNIZED).build();
-
- @Singleton
- @Provides
- Map<ImageStatus, Image.Status> toPortableImageStatus() {
- return toPortableImageStatus;
- }
-
- @Override
- protected Optional<ImageExtension> provideImageExtension(Injector i) {
- return Optional.of(i.getInstance(ImageExtension.class));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.java
deleted file mode 100644
index 6b34c8b..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.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.cloudservers.compute.extensions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_IMAGE_AVAILABLE;
-
-import java.util.NoSuchElementException;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.compute.domain.CloneImageTemplate;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.ImageTemplate;
-import org.jclouds.compute.domain.ImageTemplateBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.Atomics;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.UncheckedTimeoutException;
-
-/**
- * CloudServers implementation of {@link ImageExtension}
- *
- * @see <a href="http://docs.rackspace.com/servers/api/v1.0/cs-devguide/content/Images-d1e4062.html">docs</a>
- */
-@Singleton
-public class CloudServersImageExtension implements ImageExtension {
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final CloudServersClient client;
- private final ListeningExecutorService userExecutor;
- private final Supplier<Location> location;
- private final Predicate<AtomicReference<Image>> imageAvailablePredicate;
-
- @Inject
- public CloudServersImageExtension(CloudServersClient client, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- Supplier<Location> location,
- @Named(TIMEOUT_IMAGE_AVAILABLE) Predicate<AtomicReference<Image>> imageAvailablePredicate) {
- this.client = checkNotNull(client, "client");
- this.userExecutor = checkNotNull(userExecutor, "userExecutor");
- this.location = checkNotNull(location, "location");
- this.imageAvailablePredicate = checkNotNull(imageAvailablePredicate, "imageAvailablePredicate");
- }
-
- @Override
- public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
- Server server = client.getServer(Integer.parseInt(id));
- if (server == null)
- throw new NoSuchElementException("Cannot find server with id: " + id);
- CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
- return template;
- }
-
- @Override
- public ListenableFuture<Image> createImage(ImageTemplate template) {
- checkState(template instanceof CloneImageTemplate,
- " openstack-nova only supports creating images through cloning.");
- CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
- org.jclouds.cloudservers.domain.Image csImage = client.createImageFromServer(cloneTemplate.getName(),
- Integer.parseInt(cloneTemplate.getSourceNodeId()));
-
- final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
- .location(location.get())
- .ids(csImage.getId() + "")
- .description(cloneTemplate.getName())
- .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
- .status(Image.Status.PENDING).build());
-
- return userExecutor.submit(new Callable<Image>() {
- @Override
- public Image call() throws Exception {
- if (imageAvailablePredicate.apply(image))
- return image.get();
- // TODO: get rid of the expectation that the image will be available, as it is very brittle
- throw new UncheckedTimeoutException("Image was not created within the time limit: " + image.get());
- }
- });
- }
-
- @Override
- public boolean deleteImage(String id) {
- try {
- this.client.deleteImage(Integer.parseInt(id));
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java
deleted file mode 100644
index 0d46523..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java
+++ /dev/null
@@ -1,54 +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.cloudservers.compute.functions;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.domain.ImageStatus;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.Image.Status;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class CloudServersImageToImage implements Function<org.jclouds.cloudservers.domain.Image, Image> {
- private final Map<ImageStatus, Status> toPortableImageStatus;
- private final Function<org.jclouds.cloudservers.domain.Image, OperatingSystem> imageToOs;
-
- @Inject
- CloudServersImageToImage(Map<ImageStatus, Image.Status> toPortableImageStatus, Function<org.jclouds.cloudservers.domain.Image, OperatingSystem> imageToOs) {
- this.toPortableImageStatus = toPortableImageStatus;
- this.imageToOs = imageToOs;
- }
-
- public Image apply(org.jclouds.cloudservers.domain.Image from) {
- ImageBuilder builder = new ImageBuilder();
- builder.ids(from.getId() + "");
- builder.name(from.getName());
- builder.description(from.getName());
- builder.version(from.getUpdated().getTime() + "");
- builder.operatingSystem(imageToOs.apply(from));
- builder.status(toPortableImageStatus.get(from.getStatus()));
- Image image = builder.build();
- return image;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToOperatingSystem.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToOperatingSystem.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToOperatingSystem.java
deleted file mode 100644
index 417472b..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToOperatingSystem.java
+++ /dev/null
@@ -1,85 +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.cloudservers.compute.functions;
-
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.util.ComputeServiceUtils;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class CloudServersImageToOperatingSystem implements
- Function<org.jclouds.cloudservers.domain.Image, OperatingSystem> {
- public static final Pattern DEFAULT_PATTERN = Pattern.compile("(([^ ]*) ([0-9.]+) ?.*)");
- // Windows Server 2008 R2 x64
- public static final Pattern WINDOWS_PATTERN = Pattern.compile("Windows (.*) (x[86][64])");
-
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final Map<OsFamily, Map<String, String>> osVersionMap;
-
- @Inject
- public CloudServersImageToOperatingSystem(Map<OsFamily, Map<String, String>> osVersionMap) {
- this.osVersionMap = osVersionMap;
- }
-
- public OperatingSystem apply(final org.jclouds.cloudservers.domain.Image from) {
- OsFamily osFamily = null;
- String osName = null;
- String osArch = null;
- String osVersion = null;
- String osDescription = from.getName();
- boolean is64Bit = true;
- if (from.getName().indexOf("Red Hat EL") != -1) {
- osFamily = OsFamily.RHEL;
- } else if (from.getName().indexOf("Oracle EL") != -1) {
- osFamily = OsFamily.OEL;
- } else if (from.getName().indexOf("Windows") != -1) {
- osFamily = OsFamily.WINDOWS;
- Matcher matcher = WINDOWS_PATTERN.matcher(from.getName());
- if (matcher.find()) {
- osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(1), osVersionMap);
- is64Bit = matcher.group(2).equals("x64");
- }
- } else {
- Matcher matcher = DEFAULT_PATTERN.matcher(from.getName());
- if (matcher.find()) {
- try {
- osFamily = OsFamily.fromValue(matcher.group(2).toLowerCase());
- } catch (IllegalArgumentException e) {
- logger.debug("<< didn't match os(%s)", matcher.group(2));
- }
- osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(3), osVersionMap);
- }
- }
- return new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/FlavorToHardware.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/FlavorToHardware.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/FlavorToHardware.java
deleted file mode 100644
index 96aa3fb..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/FlavorToHardware.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.cloudservers.compute.functions;
-
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.domain.Flavor;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.internal.VolumeImpl;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-
-@Singleton
-public class FlavorToHardware implements Function<Flavor, Hardware> {
- public Hardware apply(Flavor from) {
- return new HardwareBuilder().ids(from.getId() + "").name(from.getName()).hypervisor("xen")
- .processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))).ram(from.getRam())
- .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDisk(), true, true))).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadata.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadata.java
deleted file mode 100644
index a2bacd3..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadata.java
+++ /dev/null
@@ -1,139 +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.cloudservers.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue;
-import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
-
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.ServerStatus;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.NodeMetadata.Status;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- protected final Supplier<Location> location;
- protected final Map<ServerStatus, Status> serverToNodeStatus;
- protected final Supplier<Set<? extends Image>> images;
- protected final Supplier<Set<? extends Hardware>> hardwares;
- protected final GroupNamingConvention nodeNamingConvention;
-
- private static class FindImageForServer implements Predicate<Image> {
- private final Server instance;
-
- private FindImageForServer(Server instance) {
- this.instance = instance;
- }
-
- @Override
- public boolean apply(Image input) {
- return input.getProviderId().equals(instance.getImageId() + "");
- }
- }
-
- private static class FindHardwareForServer implements Predicate<Hardware> {
- private final Server instance;
-
- private FindHardwareForServer(Server instance) {
- this.instance = instance;
- }
-
- @Override
- public boolean apply(Hardware input) {
- return input.getProviderId().equals(instance.getFlavorId() + "");
- }
- }
-
- @Inject
- ServerToNodeMetadata(Map<ServerStatus, Status> serverStateToNodeStatus,
- @Memoized Supplier<Set<? extends Image>> images, Supplier<Location> location,
- @Memoized Supplier<Set<? extends Hardware>> hardwares,
- GroupNamingConvention.Factory namingConvention) {
- this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
- this.serverToNodeStatus = checkNotNull(serverStateToNodeStatus, "serverStateToNodeStatus");
- this.images = checkNotNull(images, "images");
- this.location = checkNotNull(location, "location");
- this.hardwares = checkNotNull(hardwares, "hardwares");
- }
-
- @Override
- public NodeMetadata apply(Server from) {
- NodeMetadataBuilder builder = new NodeMetadataBuilder();
- builder.ids(from.getId() + "");
- builder.name(from.getName());
- builder.hostname(from.getName());
- builder.location(new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId()).description(
- from.getHostId()).parent(location.get()).build());
- addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
- builder.group(groupFromMapOrName(from.getMetadata(), from.getName(), nodeNamingConvention));
- builder.imageId(from.getImageId() + "");
- builder.operatingSystem(parseOperatingSystem(from));
- builder.hardware(parseHardware(from));
- builder.status(serverToNodeStatus.get(from.getStatus()));
- builder.publicAddresses(from.getAddresses().getPublicAddresses());
- builder.privateAddresses(from.getAddresses().getPrivateAddresses());
- return builder.build();
- }
-
- protected Hardware parseHardware(Server from) {
- try {
- return Iterables.find(hardwares.get(), new FindHardwareForServer(from));
- } catch (NoSuchElementException e) {
- logger.debug("could not find a matching hardware for server %s", from);
- }
- return null;
- }
-
- protected OperatingSystem parseOperatingSystem(Server from) {
- try {
- return Iterables.find(images.get(), new FindImageForServer(from)).getOperatingSystem();
- } catch (NoSuchElementException e) {
- logger.debug("could not find a matching image for server %s in location %s", from, location.get());
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java
deleted file mode 100644
index 82744b0..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java
+++ /dev/null
@@ -1,141 +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.cloudservers.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.contains;
-import static com.google.common.collect.Iterables.filter;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withMetadata;
-import static org.jclouds.cloudservers.options.ListOptions.Builder.withDetails;
-import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.domain.Flavor;
-import org.jclouds.cloudservers.domain.Image;
-import org.jclouds.cloudservers.domain.RebootType;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.options.ListOptions;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LoginCredentials;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * defines the connection between the {@link CloudServersClient} implementation and the jclouds
- * {@link ComputeService}
- */
-@Singleton
-public class CloudServersComputeServiceAdapter implements ComputeServiceAdapter<Server, Flavor, Image, Location> {
-
- protected final CloudServersClient client;
-
- @Inject
- protected CloudServersComputeServiceAdapter(CloudServersClient client) {
- this.client = checkNotNull(client, "client");
- }
-
- @Override
- public NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String group, String name,
- Template template) {
- template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
- Server server = client
- .createServer(name, Integer.parseInt(template.getImage().getProviderId()), Integer.parseInt(template
- .getHardware().getProviderId()), withMetadata(metadataAndTagsAsCommaDelimitedValue(template.getOptions())));
-
- return new NodeAndInitialCredentials<Server>(server, server.getId() + "", LoginCredentials.builder().password(
- server.getAdminPass()).build());
- }
-
-
-
- @Override
- public Iterable<Flavor> listHardwareProfiles() {
- return client.listFlavors(withDetails());
-
- }
-
- @Override
- public Iterable<Image> listImages() {
- return client.listImages(withDetails());
- }
-
- @Override
- public Iterable<Server> listNodes() {
- return client.listServers(ListOptions.Builder.withDetails());
- }
-
- @Override
- public Iterable<Server> listNodesByIds(final Iterable<String> ids) {
- return filter(listNodes(), new Predicate<Server>() {
-
- @Override
- public boolean apply(Server server) {
- return contains(ids, server.getId());
- }
- });
- }
-
- @Override
- public Iterable<Location> listLocations() {
- // Not using the adapter to determine locations
- return ImmutableSet.<Location>of();
- }
-
- @Override
- public Server getNode(String id) {
- int serverId = Integer.parseInt(id);
- return client.getServer(serverId);
- }
-
- @Override
- public Image getImage(String id) {
- int imageId = Integer.parseInt(id);
- return client.getImage(imageId);
- }
-
- @Override
- public void destroyNode(String id) {
- int serverId = Integer.parseInt(id);
- // if false server wasn't around in the first place
- client.deleteServer(serverId);
- }
-
- @Override
- public void rebootNode(String id) {
- int serverId = Integer.parseInt(id);
- // if false server wasn't around in the first place
- client.rebootServer(serverId, RebootType.HARD);
- }
-
- @Override
- public void resumeNode(String id) {
- throw new UnsupportedOperationException("suspend not supported");
- }
-
- @Override
- public void suspendNode(String id) {
- throw new UnsupportedOperationException("suspend not supported");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
deleted file mode 100644
index 71aa0a6..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
+++ /dev/null
@@ -1,87 +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.cloudservers.config;
-
-import static com.google.common.base.Suppliers.memoizeWithExpiration;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-
-import java.net.URI;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.handlers.ParseCloudServersErrorFromHttpResponse;
-import org.jclouds.date.TimeStamp;
-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.location.suppliers.RegionIdToURISupplier;
-import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
-import org.jclouds.openstack.services.Compute;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.rest.config.HttpApiModule;
-
-import com.google.common.base.Supplier;
-import com.google.inject.Provides;
-
-@ConfiguresHttpApi
-public class CloudServersHttpApiModule extends HttpApiModule<CloudServersClient> {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- super.configure();
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseCloudServersErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseCloudServersErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseCloudServersErrorFromHttpResponse.class);
- }
-
- @Override
- protected void installLocations() {
- super.installLocations();
- install(new AuthenticationServiceModule());
- }
-
- @Provides
- @Singleton
- @Compute
- protected Supplier<URI> provideCloudServers(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
- return getLastValueInMap(factory.createForApiTypeAndVersion("cloudServers", apiVersion));
- }
-
- // TODO: see if we still need this.
- @Provides
- @Singleton
- @TimeStamp
- protected Supplier<Date> provideCacheBusterDate() {
- return memoizeWithExpiration(new Supplier<Date>() {
- public Date get() {
- return new Date();
- }
- }, 1, TimeUnit.SECONDS);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/AbsoluteLimit.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/AbsoluteLimit.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/AbsoluteLimit.java
deleted file mode 100644
index 286b2c3..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/AbsoluteLimit.java
+++ /dev/null
@@ -1,123 +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.cloudservers.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Class AbsoluteLimit
- *
-*/
-public class AbsoluteLimit {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromAbsoluteLimit(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String name;
- protected int value;
-
- /**
- * @see AbsoluteLimit#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see AbsoluteLimit#getValue()
- */
- public T value(int value) {
- this.value = value;
- return self();
- }
-
- public AbsoluteLimit build() {
- return new AbsoluteLimit(name, value);
- }
-
- public T fromAbsoluteLimit(AbsoluteLimit in) {
- return this
- .name(in.getName())
- .value(in.getValue());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String name;
- private final int value;
-
- @ConstructorProperties({
- "name", "value"
- })
- protected AbsoluteLimit(String name, int value) {
- this.name = checkNotNull(name, "name");
- this.value = value;
- }
-
- public String getName() {
- return this.name;
- }
-
- public int getValue() {
- return this.value;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, value);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- AbsoluteLimit that = AbsoluteLimit.class.cast(obj);
- return Objects.equal(this.name, that.name)
- && Objects.equal(this.value, that.value);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("name", name).add("value", value);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Action.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Action.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Action.java
deleted file mode 100644
index 11448ad..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Action.java
+++ /dev/null
@@ -1,21 +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.cloudservers.domain;
-
-public enum Action {
- CONFIRM_RESIZE, REBOOT, REBUILD, RESIZE, REVERT_RESIZE
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/162226b8/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Addresses.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Addresses.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Addresses.java
deleted file mode 100644
index a308f67..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Addresses.java
+++ /dev/null
@@ -1,142 +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.cloudservers.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Collection;
-import java.util.Set;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Class Addresses
- *
-*/
-public class Addresses {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromAddresses(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected Set<String> publicAddresses;
- protected Set<String> privateAddresses;
-
- /**
- * @see Addresses#getPublicAddresses()
- */
- public T publicAddresses(Collection<String> publicAddresses) {
- this.publicAddresses = ImmutableSet.copyOf(checkNotNull(publicAddresses, "publicAddresses"));
- return self();
- }
-
- public T publicAddresses(String... in) {
- return publicAddresses(ImmutableSet.copyOf(in));
- }
-
- /**
- * @see Addresses#getPrivateAddresses()
- */
- public T privateAddresses(Collection<String> privateAddresses) {
- this.privateAddresses = ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses"));
- return self();
- }
-
- public T privateAddresses(String... in) {
- return privateAddresses(ImmutableSet.copyOf(in));
- }
-
- public Addresses build() {
- return new Addresses(publicAddresses, privateAddresses);
- }
-
- public T fromAddresses(Addresses in) {
- return this
- .publicAddresses(in.getPublicAddresses())
- .privateAddresses(in.getPrivateAddresses());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("public")
- private final Set<String> publicAddresses;
- @Named("private")
- private final Set<String> privateAddresses;
-
- @ConstructorProperties({
- "public", "private"
- })
- protected Addresses(@Nullable Set<String> publicAddresses, @Nullable Set<String> privateAddresses) {
- this.publicAddresses = publicAddresses == null ? null : ImmutableSet.copyOf(publicAddresses);
- this.privateAddresses = privateAddresses == null ? null : ImmutableSet.copyOf(privateAddresses);
- }
-
- @Nullable
- public Set<String> getPublicAddresses() {
- return this.publicAddresses;
- }
-
- @Nullable
- public Set<String> getPrivateAddresses() {
- return this.privateAddresses;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(publicAddresses, privateAddresses);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Addresses that = Addresses.class.cast(obj);
- return Objects.equal(this.publicAddresses, that.publicAddresses)
- && Objects.equal(this.privateAddresses, that.privateAddresses);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("publicAddresses", publicAddresses).add("privateAddresses", privateAddresses);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}