diff --git a/apis/cloudservers/README.txt b/apis/cloudservers/README.txt
deleted file mode 100644
index 39cab16dbb..0000000000
--- 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.
diff --git a/apis/cloudservers/pom.xml b/apis/cloudservers/pom.xml
deleted file mode 100644
index 6ac8f88fdd..0000000000
--- a/apis/cloudservers/pom.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.jclouds
- jclouds-project
- 2.0.0-SNAPSHOT
- ../../project/pom.xml
-
-
- org.apache.jclouds.api
- cloudservers
- jclouds cloudservers api
- jclouds components to access an implementation of CloudServers
- bundle
-
-
- https://auth.api.rackspacecloud.com
- 1.0
-
- ${test.rackspace.identity}
- ${test.rackspace.credential}
-
- org.jclouds.cloudservers*;version="${project.version}"
-
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
-
-
-
-
-
- org.apache.jclouds.common
- openstack-common
- ${project.version}
-
-
- org.apache.jclouds
- jclouds-compute
- ${project.version}
-
-
- org.apache.jclouds
- jclouds-core
- ${project.version}
- test-jar
- test
-
-
- org.apache.jclouds.common
- openstack-common
- ${project.version}
- test-jar
- test
-
-
- org.apache.jclouds
- jclouds-compute
- ${project.version}
- test-jar
- test
-
-
- org.apache.jclouds.driver
- jclouds-sshj
- ${project.version}
- test
-
-
- org.apache.jclouds.driver
- jclouds-log4j
- ${project.version}
- test
-
-
-
-
-
- live
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration
- integration-test
-
- test
-
-
-
- ${test.cloudstack.endpoint}
- ${test.cloudstack.api-version}
- ${test.cloudstack.build-version}
- ${test.cloudstack.identity}
- ${test.cloudstack.credential}
- ${test.cloudstack.template}
-
-
-
-
-
-
-
-
-
-
-
-
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 04ed2e7a0d..0000000000
--- 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 {
-
- 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.>of(CloudServersHttpApiModule.class, CloudServersComputeServiceContextModule.class));
- }
-
- @Override
- public CloudServersApiMetadata build() {
- return new CloudServersApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
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 5b0d5d8ce0..0000000000
--- 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
- * Rackspace Getting Started Guide
- * 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.
- *
- * 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 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.
- *
- * 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.
- *
- * Status Transition:
- *
- * ACTIVE - REBOOT - ACTIVE (soft reboot)
- *
- * 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.
- *
- * Status Transition:
- *
- * ACTIVE - QUEUE_RESIZE - PREP_RESIZE - VERIFY_RESIZE
- *
- * 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.
- *
- * Status Transition:
- *
- * 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.
- *
- * Status Transition:
- *
- * 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.
- *
- * Status Transition:
- *
- * ACTIVE - REBUILD - ACTIVE
- *
- * ACTIVE - REBUILD - ERROR (on error)
- *
- *
- * @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
- *
- * 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.
- *
- *
- * Status Transition: ACTIVE - SHARE_IP - ACTIVE (if configureServer is true) ACTIVE -
- * SHARE_IP_NO_CONFIG - ACTIVE
- *
- * @param configureServer
- *
- * 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.
- *
- * 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.
- *
- * 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.
- *
- * 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.
- *
- * 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 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 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.
- *
- * 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:
- *
- * QUEUED - PREPARING - SAVING - ACTIVE
- *
- * QUEUED - PREPARING - SAVING - FAILED (on error)
- *
- * 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 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.
- *
- * 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 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 listPrivateAddresses(@PathParam("id") int serverId);
-}
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 13b83b5be6..0000000000
--- 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 bindToRequest(R request, Map postParams) {
- throw new IllegalStateException("Replace Backup Schedule needs an BackupSchedule object, not a Map");
- }
-
- @Override
- public 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));
- }
-}
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 44cbb95f23..0000000000
--- 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 {
-
- @SuppressWarnings("unchecked")
- @Override
- protected void configure() {
- super.configure();
- bind(new TypeLiteral>() {
- }).to(CloudServersComputeServiceAdapter.class);
-
- bind(new TypeLiteral>() {
- }).to(ServerToNodeMetadata.class);
-
- bind(new TypeLiteral>() {
- }).to(CloudServersImageToImage.class);
- bind(new TypeLiteral>() {
- }).to(CloudServersImageToOperatingSystem.class);
-
- bind(new TypeLiteral>() {
- }).to(FlavorToHardware.class);
-
- // we aren't converting location from a provider-specific type
- bind(new TypeLiteral>() {
- }).to(Class.class.cast(IdentityFunction.class));
-
- bind(new TypeLiteral() {
- }).to(CloudServersImageExtension.class);
- }
-
- @VisibleForTesting
- public static final Map toPortableNodeStatus = ImmutableMap
- . 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 toPortableNodeStatus() {
- return toPortableNodeStatus;
- }
-
- @VisibleForTesting
- public static final Map toPortableImageStatus = ImmutableMap
- . 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 toPortableImageStatus() {
- return toPortableImageStatus;
- }
-
- @Override
- protected Optional provideImageExtension(Injector i) {
- return Optional.of(i.getInstance(ImageExtension.class));
- }
-
-}
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 6b34c8b95d..0000000000
--- 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 docs
- */
-@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;
- private final Predicate> imageAvailablePredicate;
-
- @Inject
- public CloudServersImageExtension(CloudServersClient client, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
- Supplier location,
- @Named(TIMEOUT_IMAGE_AVAILABLE) Predicate> 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 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 = 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() {
- @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;
- }
-
-}
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 0d465232b4..0000000000
--- 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 {
- private final Map toPortableImageStatus;
- private final Function imageToOs;
-
- @Inject
- CloudServersImageToImage(Map toPortableImageStatus, Function 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;
- }
-}
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 417472b47f..0000000000
--- 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 {
- 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> osVersionMap;
-
- @Inject
- public CloudServersImageToOperatingSystem(Map> 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);
- }
-}
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 96aa3fb9d2..0000000000
--- 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 {
- 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. of(new VolumeImpl((float) from.getDisk(), true, true))).build();
- }
-}
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 a2bacd3e4c..0000000000
--- 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 {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- protected final Supplier location;
- protected final Map serverToNodeStatus;
- protected final Supplier> images;
- protected final Supplier> hardwares;
- protected final GroupNamingConvention nodeNamingConvention;
-
- private static class FindImageForServer implements Predicate {
- 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 {
- 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 serverStateToNodeStatus,
- @Memoized Supplier> images, Supplier location,
- @Memoized Supplier> 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;
- }
-}
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 82744b0a98..0000000000
--- 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 {
-
- protected final CloudServersClient client;
-
- @Inject
- protected CloudServersComputeServiceAdapter(CloudServersClient client) {
- this.client = checkNotNull(client, "client");
- }
-
- @Override
- public NodeAndInitialCredentials 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.getId() + "", LoginCredentials.builder().password(
- server.getAdminPass()).build());
- }
-
-
-
- @Override
- public Iterable listHardwareProfiles() {
- return client.listFlavors(withDetails());
-
- }
-
- @Override
- public Iterable listImages() {
- return client.listImages(withDetails());
- }
-
- @Override
- public Iterable listNodes() {
- return client.listServers(ListOptions.Builder.withDetails());
- }
-
- @Override
- public Iterable listNodesByIds(final Iterable ids) {
- return filter(listNodes(), new Predicate() {
-
- @Override
- public boolean apply(Server server) {
- return contains(ids, server.getId());
- }
- });
- }
-
- @Override
- public Iterable listLocations() {
- // Not using the adapter to determine locations
- return ImmutableSet.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");
- }
-
-}
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 71aa0a6118..0000000000
--- 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 {
-
- @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 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 provideCacheBusterDate() {
- return memoizeWithExpiration(new Supplier() {
- public Date get() {
- return new Date();
- }
- }, 1, TimeUnit.SECONDS);
- }
-}
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 286b2c3aab..0000000000
--- 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> {
- 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 {
- @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();
- }
-
-}
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 11448ade6a..0000000000
--- 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
-}
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 a308f67942..0000000000
--- 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> {
- protected abstract T self();
-
- protected Set publicAddresses;
- protected Set privateAddresses;
-
- /**
- * @see Addresses#getPublicAddresses()
- */
- public T publicAddresses(Collection 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 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 {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @Named("public")
- private final Set publicAddresses;
- @Named("private")
- private final Set privateAddresses;
-
- @ConstructorProperties({
- "public", "private"
- })
- protected Addresses(@Nullable Set publicAddresses, @Nullable Set privateAddresses) {
- this.publicAddresses = publicAddresses == null ? null : ImmutableSet.copyOf(publicAddresses);
- this.privateAddresses = privateAddresses == null ? null : ImmutableSet.copyOf(privateAddresses);
- }
-
- @Nullable
- public Set getPublicAddresses() {
- return this.publicAddresses;
- }
-
- @Nullable
- public Set 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();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/BackupSchedule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/BackupSchedule.java
deleted file mode 100644
index dc46e3a0bc..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/BackupSchedule.java
+++ /dev/null
@@ -1,143 +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 java.beans.ConstructorProperties;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A backup schedule can be defined to create server images at regular intervals (daily and weekly).
- * Backup schedules are configurable per server.
- *
-*/
-public class BackupSchedule {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromBackupSchedule(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected DailyBackup daily;
- protected boolean enabled;
- protected WeeklyBackup weekly;
-
- /**
- * @see BackupSchedule#getDaily()
- */
- public T daily(DailyBackup daily) {
- this.daily = daily;
- return self();
- }
-
- /**
- * @see BackupSchedule#isEnabled()
- */
- public T enabled(boolean enabled) {
- this.enabled = enabled;
- return self();
- }
-
- /**
- * @see BackupSchedule#getWeekly()
- */
- public T weekly(WeeklyBackup weekly) {
- this.weekly = weekly;
- return self();
- }
-
- public BackupSchedule build() {
- return new BackupSchedule(daily, enabled, weekly);
- }
-
- public T fromBackupSchedule(BackupSchedule in) {
- return this
- .daily(in.getDaily())
- .enabled(in.isEnabled())
- .weekly(in.getWeekly());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final DailyBackup daily;
- private final boolean enabled;
- private final WeeklyBackup weekly;
-
- @ConstructorProperties({
- "daily", "enabled", "weekly"
- })
- protected BackupSchedule(@Nullable DailyBackup daily, boolean enabled, @Nullable WeeklyBackup weekly) {
- this.daily = daily;
- this.enabled = enabled;
- this.weekly = weekly;
- }
-
- @Nullable
- public DailyBackup getDaily() {
- return this.daily;
- }
-
- public boolean isEnabled() {
- return this.enabled;
- }
-
- @Nullable
- public WeeklyBackup getWeekly() {
- return this.weekly;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(daily, enabled, weekly);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- BackupSchedule that = BackupSchedule.class.cast(obj);
- return Objects.equal(this.daily, that.daily)
- && Objects.equal(this.enabled, that.enabled)
- && Objects.equal(this.weekly, that.weekly);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("daily", daily).add("enabled", enabled).add("weekly", weekly);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/DailyBackup.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/DailyBackup.java
deleted file mode 100644
index d76c00e87b..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/DailyBackup.java
+++ /dev/null
@@ -1,35 +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 DailyBackup {
-
- DISABLED, H_0000_0200, H_0200_0400, H_0400_0600, H_0600_0800, H_0800_1000, H_1000_1200, H_1200_1400, H_1400_1600, H_1600_1800, H_1800_2000, H_2000_2200, H_2200_0000, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static DailyBackup fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Flavor.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Flavor.java
deleted file mode 100644
index 4edc77ff1d..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Flavor.java
+++ /dev/null
@@ -1,162 +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 org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A flavor is an available hardware configuration for a server. Each flavor has a unique
- * combination of disk space and memory capacity.
- *
-*/
-public class Flavor {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromFlavor(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected int id;
- protected String name;
- protected Integer disk;
- protected Integer ram;
-
- /**
- * @see Flavor#getId()
- */
- public T id(int id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see Flavor#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see Flavor#getDisk()
- */
- public T disk(Integer disk) {
- this.disk = disk;
- return self();
- }
-
- /**
- * @see Flavor#getRam()
- */
- public T ram(Integer ram) {
- this.ram = ram;
- return self();
- }
-
- public Flavor build() {
- return new Flavor(id, name, disk, ram);
- }
-
- public T fromFlavor(Flavor in) {
- return this
- .id(in.getId())
- .name(in.getName())
- .disk(in.getDisk())
- .ram(in.getRam());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final int id;
- private final String name;
- private final Integer disk;
- private final Integer ram;
-
- @ConstructorProperties({
- "id", "name", "disk", "ram"
- })
- protected Flavor(int id, String name, @Nullable Integer disk, @Nullable Integer ram) {
- this.id = id;
- this.name = checkNotNull(name, "name");
- this.disk = disk;
- this.ram = ram;
- }
-
- public int getId() {
- return this.id;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Nullable
- public Integer getDisk() {
- return this.disk;
- }
-
- @Nullable
- public Integer getRam() {
- return this.ram;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, name, disk, ram);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Flavor that = Flavor.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.disk, that.disk)
- && Objects.equal(this.ram, that.ram);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("name", name).add("disk", disk).add("ram", ram);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Image.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Image.java
deleted file mode 100644
index 61c8397ddd..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Image.java
+++ /dev/null
@@ -1,219 +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.Date;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * An image is a collection of files used to create or rebuild a server. Rackspace provides a number
- * of pre-built OS images by default. You may also create custom images from cloud servers you have
- * launched. These custom images are useful for backup purposes or for producing gold server images
- * if you plan to deploy a particular server configuration frequently.
- *
-*/
-public class Image {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromImage(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected Date created;
- protected int id;
- protected String name;
- protected Integer progress;
- protected Integer serverId;
- protected ImageStatus status;
- protected Date updated;
-
- /**
- * @see Image#getCreated()
- */
- public T created(Date created) {
- this.created = created;
- return self();
- }
-
- /**
- * @see Image#getId()
- */
- public T id(int id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see Image#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see Image#getProgress()
- */
- public T progress(Integer progress) {
- this.progress = progress;
- return self();
- }
-
- /**
- * @see Image#getServerId()
- */
- public T serverId(Integer serverId) {
- this.serverId = serverId;
- return self();
- }
-
- /**
- * @see Image#getStatus()
- */
- public T status(ImageStatus status) {
- this.status = status;
- return self();
- }
-
- /**
- * @see Image#getUpdated()
- */
- public T updated(Date updated) {
- this.updated = updated;
- return self();
- }
-
- public Image build() {
- return new Image(created, id, name, progress, serverId, status, updated);
- }
-
- public T fromImage(Image in) {
- return this
- .created(in.getCreated())
- .id(in.getId())
- .name(in.getName())
- .progress(in.getProgress())
- .serverId(in.getServerId())
- .status(in.getStatus())
- .updated(in.getUpdated());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Date created;
- private final int id;
- private final String name;
- private final Integer progress;
- private final Integer serverId;
- private final ImageStatus status;
- private final Date updated;
-
- @ConstructorProperties({
- "created", "id", "name", "progress", "serverId", "status", "updated"
- })
- protected Image(@Nullable Date created, int id, String name, @Nullable Integer progress, @Nullable Integer serverId, @Nullable ImageStatus status, @Nullable Date updated) {
- this.created = created;
- this.id = id;
- this.name = checkNotNull(name, "name");
- this.progress = progress;
- this.serverId = serverId;
- this.status = status;
- this.updated = updated;
- }
-
- @Nullable
- public Date getCreated() {
- return this.created;
- }
-
- public int getId() {
- return this.id;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Nullable
- public Integer getProgress() {
- return this.progress;
- }
-
- @Nullable
- public Integer getServerId() {
- return this.serverId;
- }
-
- @Nullable
- public ImageStatus getStatus() {
- return this.status;
- }
-
- @Nullable
- public Date getUpdated() {
- return this.updated;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(created, id, name, progress, serverId, status, updated);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Image that = Image.class.cast(obj);
- return Objects.equal(this.created, that.created)
- && Objects.equal(this.id, that.id)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.progress, that.progress)
- && Objects.equal(this.serverId, that.serverId)
- && Objects.equal(this.status, that.status)
- && Objects.equal(this.updated, that.updated);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("created", created).add("id", id).add("name", name).add("progress", progress).add("serverId", serverId).add("status", status).add("updated", updated);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ImageStatus.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ImageStatus.java
deleted file mode 100644
index 68740b803b..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ImageStatus.java
+++ /dev/null
@@ -1,41 +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;
-
-/**
- * In-flight images will have the status attribute set to SAVING and the conditional progress
- * element (0- 100% completion) will also be returned. Other possible values for the status
- * attribute include: UNKNOWN, PREPARING, ACTIVE QUEUED, FAILED. Images with an ACTIVE status are
- * available for install.
- */
-public enum ImageStatus {
-
- UNRECOGNIZED, UNKNOWN, ACTIVE, SAVING, PREPARING, QUEUED, FAILED;
-
- public String value() {
- return name();
- }
-
- public static ImageStatus fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Limits.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Limits.java
deleted file mode 100644
index 1b085c8cf1..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Limits.java
+++ /dev/null
@@ -1,130 +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.Map;
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Class Limits
-*/
-public class Limits {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromLimits(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected Set rate = ImmutableSet.of();
- protected Map absolute = ImmutableMap.of();
-
- /**
- * @see Limits#getRate()
- */
- public T rate(Set rate) {
- this.rate = ImmutableSet.copyOf(checkNotNull(rate, "rate"));
- return self();
- }
-
- public T rate(RateLimit... in) {
- return rate(ImmutableSet.copyOf(in));
- }
-
- /**
- * @see Limits#getAbsolute()
- */
- public T absolute(Map absolute) {
- this.absolute = ImmutableMap.copyOf(checkNotNull(absolute, "absolute"));
- return self();
- }
-
- public Limits build() {
- return new Limits(rate, absolute);
- }
-
- public T fromLimits(Limits in) {
- return this
- .rate(in.getRate())
- .absolute(in.getAbsolute());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Set rate;
- private final Map absolute;
-
- @ConstructorProperties({
- "rate", "absolute"
- })
- protected Limits(Set rate, Map absolute) {
- this.rate = ImmutableSet.copyOf(checkNotNull(rate, "rate"));
- this.absolute = ImmutableMap.copyOf(checkNotNull(absolute, "absolute"));
- }
-
- public Set getRate() {
- return this.rate;
- }
-
- public Map getAbsolute() {
- return this.absolute;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(rate, absolute);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Limits that = Limits.class.cast(obj);
- return Objects.equal(this.rate, that.rate)
- && Objects.equal(this.absolute, that.absolute);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("rate", rate).add("absolute", absolute);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RateLimit.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RateLimit.java
deleted file mode 100644
index b56f623807..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RateLimit.java
+++ /dev/null
@@ -1,225 +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 org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * RateLimit.
- *
- * we specify rate limits in terms of both a human readable wild-card URI and a machine processable
- * regular expression. The regular expression boundary matcher '^' takes affect after the root URI
- * path. For example, the regular expression ^/servers would match the bolded portion of the
- * following URI: https://servers.api.rackspacecloud.com/v1.0/3542812 /servers .
- *
- * Rate limits are applied in order relative to the verb, going from least to most specific. For
- * example, although the threshold for POST to /servers is 25 per day, one cannot POST to /servers
- * more than 10 times within a single minute because the rate limits for any POST is 10/min. In the
- * event you exceed the thresholds established for your identity, a 413 Rate Control HTTP response
- * will be returned with a Reply-After header to notify the client when theyagain.
- *
-*/
-public class RateLimit {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromRateLimit(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected String uri;
- protected String regex;
- protected int remaining;
- protected long resetTime;
- protected RateLimitUnit unit;
- protected int value;
- protected String verb;
-
- /**
- * @see RateLimit#getUri()
- */
- public T uri(String uri) {
- this.uri = uri;
- return self();
- }
-
- /**
- * @see RateLimit#getRegex()
- */
- public T regex(String regex) {
- this.regex = regex;
- return self();
- }
-
- /**
- * @see RateLimit#getRemaining()
- */
- public T remaining(int remaining) {
- this.remaining = remaining;
- return self();
- }
-
- /**
- * @see RateLimit#getResetTime()
- */
- public T resetTime(long resetTime) {
- this.resetTime = resetTime;
- return self();
- }
-
- /**
- * @see RateLimit#getUnit()
- */
- public T unit(RateLimitUnit unit) {
- this.unit = unit;
- return self();
- }
-
- /**
- * @see RateLimit#getValue()
- */
- public T value(int value) {
- this.value = value;
- return self();
- }
-
- /**
- * @see RateLimit#getVerb()
- */
- public T verb(String verb) {
- this.verb = verb;
- return self();
- }
-
- public RateLimit build() {
- return new RateLimit(uri, regex, remaining, resetTime, unit, value, verb);
- }
-
- public T fromRateLimit(RateLimit in) {
- return this
- .uri(in.getUri())
- .regex(in.getRegex())
- .remaining(in.getRemaining())
- .resetTime(in.getResetTime())
- .unit(in.getUnit())
- .value(in.getValue())
- .verb(in.getVerb());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String uri;
- private final String regex;
- private final int remaining;
- private final long resetTime;
- private final RateLimitUnit unit;
- private final int value;
- private final String verb;
-
- @ConstructorProperties({
- "uri", "regex", "remaining", "resetTime", "unit", "value", "verb"
- })
- protected RateLimit(String uri, @Nullable String regex, int remaining, long resetTime, @Nullable RateLimitUnit unit,
- int value, @Nullable String verb) {
- this.uri = checkNotNull(uri, "uri");
- this.regex = regex;
- this.remaining = remaining;
- this.resetTime = resetTime;
- this.unit = unit;
- this.value = value;
- this.verb = verb;
- }
-
- public String getUri() {
- return this.uri;
- }
-
- @Nullable
- public String getRegex() {
- return this.regex;
- }
-
- public int getRemaining() {
- return this.remaining;
- }
-
- public long getResetTime() {
- return this.resetTime;
- }
-
- @Nullable
- public RateLimitUnit getUnit() {
- return this.unit;
- }
-
- public int getValue() {
- return this.value;
- }
-
- @Nullable
- public String getVerb() {
- return this.verb;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(uri, regex, remaining, resetTime, unit, value, verb);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- RateLimit that = RateLimit.class.cast(obj);
- return Objects.equal(this.uri, that.uri)
- && Objects.equal(this.regex, that.regex)
- && Objects.equal(this.remaining, that.remaining)
- && Objects.equal(this.resetTime, that.resetTime)
- && Objects.equal(this.unit, that.unit)
- && Objects.equal(this.value, that.value)
- && Objects.equal(this.verb, that.verb);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("uri", uri).add("regex", regex).add("remaining", remaining).add("resetTime", resetTime).add("unit", unit).add("value", value).add("verb", verb);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RateLimitUnit.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RateLimitUnit.java
deleted file mode 100644
index c297b3724a..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RateLimitUnit.java
+++ /dev/null
@@ -1,35 +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 RateLimitUnit {
-
- MINUTE, HOUR, DAY, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static RateLimitUnit fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RebootType.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RebootType.java
deleted file mode 100644
index e2849668d6..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/RebootType.java
+++ /dev/null
@@ -1,31 +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 RebootType {
-
- HARD, SOFT;
-
- public String value() {
- return name();
- }
-
- public static RebootType fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Server.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Server.java
deleted file mode 100644
index 6590a41475..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Server.java
+++ /dev/null
@@ -1,301 +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.Map;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * A server is a virtual machine instance in the Cloud Servers system. Flavor and image are
- * requisite elements when creating a server.
- *
-*/
-public class Server {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromServer(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected int id;
- protected String name;
- protected Map metadata;
- protected Addresses addresses;
- protected String adminPass;
- protected Integer flavorId;
- protected String hostId;
- protected Integer imageId;
- protected Integer sharedIpGroupId;
- protected Integer progress;
- protected ServerStatus status;
-
- /**
- * @see Server#getId()
- */
- public T id(int id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see Server#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see Server#getMetadata()
- */
- public T metadata(Map metadata) {
- this.metadata = ImmutableMap.copyOf(checkNotNull(metadata, "metadata"));
- return self();
- }
-
- /**
- * @see Server#getAddresses()
- */
- public T addresses(Addresses addresses) {
- this.addresses = addresses;
- return self();
- }
-
- /**
- * @see Server#getAdminPass()
- */
- public T adminPass(String adminPass) {
- this.adminPass = adminPass;
- return self();
- }
-
- /**
- * @see Server#getFlavorId()
- */
- public T flavorId(Integer flavorId) {
- this.flavorId = flavorId;
- return self();
- }
-
- /**
- * @see Server#getHostId()
- */
- public T hostId(String hostId) {
- this.hostId = hostId;
- return self();
- }
-
- /**
- * @see Server#getImageId()
- */
- public T imageId(Integer imageId) {
- this.imageId = imageId;
- return self();
- }
-
- /**
- * @see Server#getSharedIpGroupId()
- */
- public T sharedIpGroupId(Integer sharedIpGroupId) {
- this.sharedIpGroupId = sharedIpGroupId;
- return self();
- }
-
- /**
- * @see Server#getProgress()
- */
- public T progress(Integer progress) {
- this.progress = progress;
- return self();
- }
-
- /**
- * @see Server#getStatus()
- */
- public T status(ServerStatus status) {
- this.status = status;
- return self();
- }
-
- public Server build() {
- return new Server(id, name, metadata, addresses, adminPass, flavorId, hostId, imageId, sharedIpGroupId, progress, status);
- }
-
- public T fromServer(Server in) {
- return this
- .id(in.getId())
- .name(in.getName())
- .metadata(in.getMetadata())
- .addresses(in.getAddresses())
- .adminPass(in.getAdminPass())
- .flavorId(in.getFlavorId())
- .hostId(in.getHostId())
- .imageId(in.getImageId())
- .sharedIpGroupId(in.getSharedIpGroupId())
- .progress(in.getProgress())
- .status(in.getStatus());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final int id;
- private final String name;
- private final Map metadata;
- private final Addresses addresses;
- private final String adminPass;
- private final Integer flavorId;
- private final String hostId;
- private final Integer imageId;
- private final Integer sharedIpGroupId;
- private final Integer progress;
- private final ServerStatus status;
-
- @ConstructorProperties({
- "id", "name", "metadata", "addresses", "adminPass", "flavorId", "hostId", "imageId", "sharedIpGroupId", "progress", "status"
- })
- protected Server(int id, String name, @Nullable Map metadata, @Nullable Addresses addresses,
- @Nullable String adminPass, @Nullable Integer flavorId, @Nullable String hostId, @Nullable Integer imageId,
- @Nullable Integer sharedIpGroupId, @Nullable Integer progress, @Nullable ServerStatus status) {
- this.id = id;
- this.name = checkNotNull(name, "name");
- this.metadata = metadata == null ? null : ImmutableMap.copyOf(metadata);
- this.addresses = addresses;
- this.adminPass = adminPass;
- this.flavorId = flavorId;
- this.hostId = hostId;
- this.imageId = imageId;
- this.sharedIpGroupId = sharedIpGroupId;
- this.progress = progress;
- this.status = status == null ? ServerStatus.UNKNOWN : status;
- }
-
- public int getId() {
- return this.id;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Nullable
- public Map getMetadata() {
- return this.metadata;
- }
-
- @Nullable
- public Addresses getAddresses() {
- return this.addresses;
- }
-
- @Nullable
- public String getAdminPass() {
- return this.adminPass;
- }
-
- @Nullable
- public Integer getFlavorId() {
- return this.flavorId;
- }
-
- /**
- * The Cloud Servers provisioning algorithm has an anti-affinity property that attempts to spread
- * out customer VMs across hosts. Under certain situations, VMs from the same customer may be
- * placed on the same host. hostId represents the host your cloud server runs on and can be used
- * to determine this scenario if it's relevant to your application.
- *
- * Note: hostId is unique PER ACCOUNT and is not globally unique.
- */
- @Nullable
- public String getHostId() {
- return this.hostId;
- }
-
- @Nullable
- public Integer getImageId() {
- return this.imageId;
- }
-
- @Nullable
- public Integer getSharedIpGroupId() {
- return this.sharedIpGroupId;
- }
-
- @Nullable
- public Integer getProgress() {
- return this.progress;
- }
-
- /**
- * Servers contain a status attribute that can be used as an indication of the current server
- * state. Servers with an ACTIVE status are available for use.
- */
- public ServerStatus getStatus() {
- return this.status;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, name, metadata, addresses, adminPass, flavorId, hostId, imageId, sharedIpGroupId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Server that = Server.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.metadata, that.metadata)
- && Objects.equal(this.addresses, that.addresses)
- && Objects.equal(this.adminPass, that.adminPass)
- && Objects.equal(this.flavorId, that.flavorId)
- && Objects.equal(this.hostId, that.hostId)
- && Objects.equal(this.imageId, that.imageId)
- && Objects.equal(this.sharedIpGroupId, that.sharedIpGroupId);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("name", name).add("metadata", metadata).add("addresses", addresses).add("adminPass", adminPass).add("flavorId", flavorId).add("hostId", hostId).add("imageId", imageId).add("sharedIpGroupId", sharedIpGroupId).add("progress", progress).add("status", status);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ServerStatus.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ServerStatus.java
deleted file mode 100644
index 89c3542945..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ServerStatus.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.domain;
-
-/**
- *
- * Servers contain a status attribute that can be used as an indication of the current server state.
- * Servers with an ACTIVE status are available for use.
- *
- *
Note
- * When the system changes a server's status from BUILD to ACTIVE the system will not be immediately
- * available. The 'ACTIVE' label is really misleading in the fact that it just means the system
- * doesn't have any activity going on related to it's configuration.
- *
- * Processes such as ssh will not be available until 5-10 seconds following the phase ACTIVE
- *
- *
[Web Hosting #119335]
- *
- */
-public enum ServerStatus {
-
- ACTIVE, SUSPENDED, DELETED, QUEUE_RESIZE, PREP_RESIZE, RESIZE, VERIFY_RESIZE, QUEUE_MOVE, PREP_MOVE, MOVE, VERIFY_MOVE, RESCUE, ERROR, BUILD, RESTORING, PASSWORD, REBUILD, DELETE_IP, SHARE_IP_NO_CONFIG, SHARE_IP, REBOOT, HARD_REBOOT, UNKNOWN, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static ServerStatus fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ShareIp.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ShareIp.java
deleted file mode 100644
index 9c18f29adc..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/ShareIp.java
+++ /dev/null
@@ -1,120 +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 java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Class ShareIp
-*/
-public class ShareIp {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromShareIp(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected boolean configureServer;
- protected int sharedIpGroupId;
-
- /**
- * @see ShareIp#isConfigureServer()
- */
- public T configureServer(boolean configureServer) {
- this.configureServer = configureServer;
- return self();
- }
-
- /**
- * @see ShareIp#getSharedIpGroupId()
- */
- public T sharedIpGroupId(int sharedIpGroupId) {
- this.sharedIpGroupId = sharedIpGroupId;
- return self();
- }
-
- public ShareIp build() {
- return new ShareIp(configureServer, sharedIpGroupId);
- }
-
- public T fromShareIp(ShareIp in) {
- return this
- .configureServer(in.isConfigureServer())
- .sharedIpGroupId(in.getSharedIpGroupId());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final boolean configureServer;
- private final int sharedIpGroupId;
-
- @ConstructorProperties({
- "configureServer", "sharedIpGroupId"
- })
- protected ShareIp(boolean configureServer, int sharedIpGroupId) {
- this.configureServer = configureServer;
- this.sharedIpGroupId = sharedIpGroupId;
- }
-
- public boolean isConfigureServer() {
- return this.configureServer;
- }
-
- public int getSharedIpGroupId() {
- return this.sharedIpGroupId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(configureServer, sharedIpGroupId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ShareIp that = ShareIp.class.cast(obj);
- return Objects.equal(this.configureServer, that.configureServer)
- && Objects.equal(this.sharedIpGroupId, that.sharedIpGroupId);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("configureServer", configureServer).add("sharedIpGroupId", sharedIpGroupId);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/SharedIpGroup.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/SharedIpGroup.java
deleted file mode 100644
index 62354e377e..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/SharedIpGroup.java
+++ /dev/null
@@ -1,152 +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.List;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableList;
-
-/**
- * A shared IP group is a collection of servers that can share IPs with other members of the group.
- * Any server in a group can share one or more public IPs with any other server in the group. With
- * the exception of the first server in a shared IP group, servers must be launched into shared IP
- * groups. A server may only be a member of one shared IP group.
- *
-*/
-public class SharedIpGroup {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromSharedIpGroup(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected int id;
- protected String name;
- protected List servers = null;
-
- /**
- * @see SharedIpGroup#getId()
- */
- public T id(int id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see SharedIpGroup#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see SharedIpGroup#getServers()
- */
- public T servers(List servers) {
- this.servers = ImmutableList.copyOf(checkNotNull(servers, "servers"));
- return self();
- }
-
- public T servers(Integer... in) {
- return servers(ImmutableList.copyOf(in));
- }
-
- public SharedIpGroup build() {
- return new SharedIpGroup(id, name, servers);
- }
-
- public T fromSharedIpGroup(SharedIpGroup in) {
- return this
- .id(in.getId())
- .name(in.getName())
- .servers(in.getServers());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final int id;
- private final String name;
- private final List servers;
-
- @ConstructorProperties({
- "id", "name", "servers"
- })
- protected SharedIpGroup(int id, String name, @Nullable List servers) {
- this.id = id;
- this.name = checkNotNull(name, "name");
- this.servers = servers == null ? null : ImmutableList.copyOf(servers);
- }
-
- public int getId() {
- return this.id;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Nullable
- public List getServers() {
- return this.servers;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, name, servers);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- SharedIpGroup that = SharedIpGroup.class.cast(obj);
- return Objects.equal(this.id, that.id)
- && Objects.equal(this.name, that.name)
- && Objects.equal(this.servers, that.servers);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id).add("name", name).add("servers", servers);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Version.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Version.java
deleted file mode 100644
index 753f0ebb6a..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/Version.java
+++ /dev/null
@@ -1,159 +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 org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Class Version
-*/
-public class Version {
-
- public static Builder> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder> toBuilder() {
- return new ConcreteBuilder().fromVersion(this);
- }
-
- public abstract static class Builder> {
- protected abstract T self();
-
- protected String docURL;
- protected String id;
- protected VersionStatus status;
- protected String wadl;
-
- /**
- * @see Version#getDocURL()
- */
- public T docURL(String docURL) {
- this.docURL = docURL;
- return self();
- }
-
- /**
- * @see Version#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see Version#getStatus()
- */
- public T status(VersionStatus status) {
- this.status = status;
- return self();
- }
-
- /**
- * @see Version#getWadl()
- */
- public T wadl(String wadl) {
- this.wadl = wadl;
- return self();
- }
-
- public Version build() {
- return new Version(docURL, id, status, wadl);
- }
-
- public T fromVersion(Version in) {
- return this
- .docURL(in.getDocURL())
- .id(in.getId())
- .status(in.getStatus())
- .wadl(in.getWadl());
- }
- }
-
- private static class ConcreteBuilder extends Builder {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String docURL;
- private final String id;
- private final VersionStatus status;
- private final String wadl;
-
- @ConstructorProperties({
- "docURL", "id", "status", "wadl"
- })
- protected Version(String docURL, String id, @Nullable VersionStatus status, @Nullable String wadl) {
- this.docURL = checkNotNull(docURL, "docURL");
- this.id = checkNotNull(id, "id");
- this.status = status == null ? VersionStatus.UNRECOGNIZED : status;
- this.wadl = wadl;
- }
-
- public String getDocURL() {
- return this.docURL;
- }
-
- public String getId() {
- return this.id;
- }
-
- public VersionStatus getStatus() {
- return this.status;
- }
-
- @Nullable
- public String getWadl() {
- return this.wadl;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(docURL, id, status, wadl);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Version that = Version.class.cast(obj);
- return Objects.equal(this.docURL, that.docURL)
- && Objects.equal(this.id, that.id)
- && Objects.equal(this.status, that.status)
- && Objects.equal(this.wadl, that.wadl);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("docURL", docURL).add("id", id).add("status", status).add("wadl", wadl);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/VersionStatus.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/VersionStatus.java
deleted file mode 100644
index 164dc7361c..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/VersionStatus.java
+++ /dev/null
@@ -1,35 +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 VersionStatus {
-
- BETA, CURRENT, DEPRECATED, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static VersionStatus fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/WeeklyBackup.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/WeeklyBackup.java
deleted file mode 100644
index f62921350a..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/domain/WeeklyBackup.java
+++ /dev/null
@@ -1,35 +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 WeeklyBackup {
-
- DISABLED, SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, UNRECOGNIZED;
-
- public String value() {
- return name();
- }
-
- public static WeeklyBackup fromValue(String v) {
- try {
- return valueOf(v);
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/handlers/ParseCloudServersErrorFromHttpResponse.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/handlers/ParseCloudServersErrorFromHttpResponse.java
deleted file mode 100644
index 012e5e5036..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/handlers/ParseCloudServersErrorFromHttpResponse.java
+++ /dev/null
@@ -1,90 +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.handlers;
-
-import static org.jclouds.http.HttpUtils.releasePayload;
-
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.jclouds.util.Strings2;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- */
-public class ParseCloudServersErrorFromHttpResponse implements HttpErrorHandler {
- @Resource
- protected Logger logger = Logger.NULL;
- public static final Pattern RESOURCE_PATTERN = Pattern
- .compile("^/v1[^/]*/[0-9]+/([^/]+)/([0-9]+)");
-
- public void handleError(HttpCommand command, HttpResponse response) {
- Exception exception = new HttpResponseException(command, response);
- try {
- String content = parseErrorFromContentOrNull(command, response);
- exception = content != null ? new HttpResponseException(command, response, content) : exception;
- switch (response.getStatusCode()) {
- case 401:
- exception = new AuthorizationException(exception.getMessage(), exception);
- break;
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- String path = command.getCurrentRequest().getEndpoint().getPath();
- Matcher matcher = RESOURCE_PATTERN.matcher(path);
- String message;
- if (matcher.find()) {
- message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
- } else {
- message = path;
- }
- exception = new ResourceNotFoundException(message);
- }
- break;
- case 409:
- exception = new IllegalStateException(content);
- break;
- default:
- exception = new HttpResponseException(command, response, content);
- break;
- }
- } finally {
- releasePayload(response);
- command.setException(exception);
- }
- }
-
- String parseErrorFromContentOrNull(HttpCommand command, HttpResponse response) {
- if (response.getPayload() != null) {
- try {
- return Strings2.toStringAndClose(response.getPayload().openStream());
- } catch (IOException e) {
- logger.warn(e, "exception reading error from response", response);
- }
- }
- return null;
- }
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/CreateServerOptions.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/CreateServerOptions.java
deleted file mode 100644
index c6e0cc2260..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/CreateServerOptions.java
+++ /dev/null
@@ -1,234 +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.options;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.io.BaseEncoding.base64;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.inject.Inject;
-
-import org.jclouds.cloudservers.domain.Addresses;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-public class CreateServerOptions implements MapBinder {
- @Inject
- private BindToJsonPayload jsonBinder;
-
- static class File {
- private final String path;
- private final String contents;
-
- public File(String path, byte[] contents) {
- this.path = checkNotNull(path, "path");
- this.contents = base64().encode(checkNotNull(contents, "contents"));
- checkArgument(path.getBytes().length < 255, String.format(
- "maximum length of path is 255 bytes. Path specified %s is %d bytes", path, path.getBytes().length));
- checkArgument(contents.length < 10 * 1024, String.format(
- "maximum size of the file is 10KB. Contents specified is %d bytes", contents.length));
- }
-
- public String getContents() {
- return contents;
- }
-
- public String getPath() {
- return path;
- }
-
- }
-
- @SuppressWarnings("unused")
- private static class ServerRequest {
- final String name;
- final int imageId;
- final int flavorId;
- Map metadata;
- List personality;
- Integer sharedIpGroupId;
- Addresses addresses;
-
- private ServerRequest(String name, int imageId, int flavorId) {
- this.name = name;
- this.imageId = imageId;
- this.flavorId = flavorId;
- }
-
- }
-
- private Map metadata = Maps.newHashMap();
- private List files = Lists.newArrayList();
- private Integer sharedIpGroupId;
- private String publicIp;
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- ServerRequest server = new ServerRequest(checkNotNull(postParams.get("name"), "name parameter not present").toString(),
- Integer.parseInt(checkNotNull(postParams.get("imageId"), "imageId parameter not present").toString()),
- Integer.parseInt(checkNotNull(postParams.get("flavorId"), "flavorId parameter not present").toString()));
- if (!metadata.isEmpty())
- server.metadata = metadata;
- if (!files.isEmpty())
- server.personality = files;
- if (sharedIpGroupId != null)
- server.sharedIpGroupId = this.sharedIpGroupId;
- if (publicIp != null) {
- server.addresses = Addresses.builder().publicAddresses(ImmutableSet.of(publicIp)).build();
- }
- return bindToRequest(request, ImmutableMap.of("server", server));
- }
-
- /**
- * You may further customize a cloud server by injecting data into the file system of the cloud
- * server itself. This is useful, for example, for inserting ssh keys, setting configuration
- * files, or storing data that you want to retrieve from within the instance itself. It is
- * intended to provide a minimal amount of launch-time personalization. If significant
- * customization is required, a custom image should be created. The max size of the file path
- * data is 255 bytes while the max size of the file contents is 10KB. Note that the file contents
- * should be encoded as a Base64 string and the 10KB limit refers to the number of bytes in the
- * decoded data not the number of characters in the encoded data. The maximum number of file
- * path/content pairs that can be supplied is 5. Any existing files that match the specified file
- * will be renamed to include the extension bak followed by a time stamp. For example, the file
- * /etc/passwd will be backed up as /etc/passwd.bak.1246036261.5785. All files will have root and
- * the root group as owner and group owner, respectively and will allow user and group read
- * access only (-r--r-----).
- */
- public CreateServerOptions withFile(String path, byte[] contents) {
- checkState(files.size() < 5, "maximum number of files allowed is 5");
- files.add(new File(path, contents));
- return this;
- }
-
- /**
- * A shared IP group is a collection of servers that can share IPs with other members of the
- * group. Any server in a group can share one or more public IPs with any other server in the
- * group. With the exception of the first server in a shared IP group, servers must be launched
- * into shared IP groups. A server may only be a member of one shared IP group.
- *
- *
- * Servers in the same shared IP group can share public IPs for various high availability and
- * load balancing configurations. To launch an HA server, include the optional sharedIpGroupId
- * element and the server will be launched into that shared IP group.
- *
- *
- * Note: sharedIpGroupId is an optional parameter and for optimal performance, should ONLY be
- * specified when intending to share IPs between servers.
- *
- * @see #withSharedIp(String)
- */
- public CreateServerOptions withSharedIpGroup(int id) {
- checkArgument(id > 0, "id must be positive or zero. was: " + id);
- this.sharedIpGroupId = id;
- return this;
- }
-
- /**
- * Custom cloud server metadata can also be supplied at launch time. This metadata is stored in
- * the API system where it is retrievable by querying the API for server status. The maximum size
- * of the metadata key and value is each 255 bytes and the maximum number of key-value pairs that
- * can be supplied per server is 5.
- */
- public CreateServerOptions withMetadata(Map metadata) {
- checkNotNull(metadata, "metadata");
- checkArgument(metadata.size() <= 5, "you cannot have more then 5 metadata values. You specified: "
- + metadata.size());
- for (Entry entry : metadata.entrySet()) {
- checkArgument(entry.getKey().getBytes().length < 255, String.format(
- "maximum length of metadata key is 255 bytes. Key specified %s is %d bytes", entry.getKey(), entry
- .getKey().getBytes().length));
- checkArgument(entry.getKey().getBytes().length < 255, String.format(
- "maximum length of metadata value is 255 bytes. Value specified for %s (%s) is %d bytes", entry
- .getKey(), entry.getValue(), entry.getValue().getBytes().length));
- }
- this.metadata = metadata;
- return this;
- }
-
- /**
- * Public IP addresses can be shared across multiple servers for use in various high availability
- * scenarios. When an IP address is shared to another server, the cloud network restrictions are
- * modified to allow each server to listen to and respond on that IP address (you may optionally
- * specify that the target server network configuration be modified). Shared IP addresses can be
- * used with many standard heartbeat facilities (e.g. keepalived) that monitor for failure and
- * manage IP failover.
- *
- *
- * If you intend to use a shared IP on the server being created and have no need for a separate
- * public IP address, you may launch the server into a shared IP group and specify an IP address
- * from that shared IP group to be used as its public IP. You can accomplish this by specifying
- * the public shared IP address in your request. This is optional and is only valid if
- * sharedIpGroupId is also supplied.
- */
- public CreateServerOptions withSharedIp(String publicIp) {
- checkState(sharedIpGroupId != null, "sharedIp is invalid unless a shared ip group is specified.");
- this.publicIp = checkNotNull(publicIp, "ip");
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see CreateServerOptions#withFile(String,byte[])
- */
- public static CreateServerOptions withFile(String path, byte[] contents) {
- CreateServerOptions options = new CreateServerOptions();
- return options.withFile(path, contents);
- }
-
- /**
- * @see CreateServerOptions#withSharedIpGroup(int)
- */
- public static CreateServerOptions withSharedIpGroup(int id) {
- CreateServerOptions options = new CreateServerOptions();
- return options.withSharedIpGroup(id);
- }
-
- /**
- * @see CreateServerOptions#withMetadata(Map)
- */
- public static CreateServerOptions withMetadata(Map metadata) {
- CreateServerOptions options = new CreateServerOptions();
- return options.withMetadata(metadata);
- }
-
- /**
- * @see CreateServerOptions#withSharedIp(String)
- */
- public static CreateServerOptions withSharedIp(String publicIp) {
- CreateServerOptions options = new CreateServerOptions();
- return options.withSharedIp(publicIp);
- }
-
- }
-
- @Override
- public R bindToRequest(R request, Object input) {
- return jsonBinder.bindToRequest(request, input);
- }
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/CreateSharedIpGroupOptions.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/CreateSharedIpGroupOptions.java
deleted file mode 100644
index 56f1b721ed..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/CreateSharedIpGroupOptions.java
+++ /dev/null
@@ -1,84 +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.options;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-
-public class CreateSharedIpGroupOptions implements MapBinder {
- @Inject
- private BindToJsonPayload jsonBinder;
-
- Integer serverId;
-
- @SuppressWarnings("unused")
- private static class SharedIpGroupRequest {
- final String name;
- Integer server;
-
- private SharedIpGroupRequest(String name, @Nullable Integer serverId) {
- this.name = name;
- this.server = serverId;
- }
-
- }
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- SharedIpGroupRequest createRequest = new SharedIpGroupRequest(checkNotNull(postParams.get("name")).toString(), serverId);
- return jsonBinder.bindToRequest(request, ImmutableMap.of("sharedIpGroup", createRequest));
- }
-
- @Override
- public R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("CreateSharedIpGroup is a POST operation");
- }
-
- /**
- *
- * @param id
- * of the server to include with this request.
- */
- public CreateSharedIpGroupOptions withServer(int id) {
- checkArgument(id > 0, "server id must be a positive number");
- this.serverId = id;
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see CreateSharedIpGroupOptions#withServer(int)
- */
- public static CreateSharedIpGroupOptions withServer(int id) {
- CreateSharedIpGroupOptions options = new CreateSharedIpGroupOptions();
- return options.withServer(id);
- }
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/ListOptions.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/ListOptions.java
deleted file mode 100644
index d4f5144a47..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/ListOptions.java
+++ /dev/null
@@ -1,106 +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.options;
-
-import java.util.Date;
-
-import org.jclouds.openstack.options.BaseListOptions;
-
-/**
- * Options used to control the amount of detail in the request.
- *
- * @see BaseListOptions
- * @see
- */
-public class ListOptions extends BaseListOptions {
-
- public static final ListOptions NONE = new ListOptions();
-
- /**
- * unless used, only the name and id will be returned per row.
- *
- * @return
- */
- public ListOptions withDetails() {
- this.pathSuffix = "/detail";
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListOptions changesSince(Date ifModifiedSince) {
- super.changesSince(ifModifiedSince);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListOptions maxResults(int limit) {
- super.maxResults(limit);
- return this;
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ListOptions startAt(long offset) {
- super.startAt(offset);
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see ListOptions#withDetails()
- */
- public static ListOptions withDetails() {
- ListOptions options = new ListOptions();
- return options.withDetails();
- }
-
- /**
- * @see BaseListOptions#startAt(long)
- */
- public static ListOptions startAt(long prefix) {
- ListOptions options = new ListOptions();
- return options.startAt(prefix);
- }
-
- /**
- * @see BaseListOptions#maxResults(long)
- */
- public static ListOptions maxResults(int maxKeys) {
- ListOptions options = new ListOptions();
- return options.maxResults(maxKeys);
- }
-
- /**
- * @see BaseListOptions#changesSince(Date)
- */
- public static ListOptions changesSince(Date since) {
- ListOptions options = new ListOptions();
- return options.changesSince(since);
- }
-
- }
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/RebuildServerOptions.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/RebuildServerOptions.java
deleted file mode 100644
index 08769d4ce3..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/options/RebuildServerOptions.java
+++ /dev/null
@@ -1,71 +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.options;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-public class RebuildServerOptions implements MapBinder {
- @Inject
- private BindToJsonPayload jsonBinder;
- Integer imageId;
-
- @Override
- public R bindToRequest(R request, Map postParams) {
- Map image = Maps.newHashMap();
- if (imageId != null)
- image.put("imageId", imageId);
- return jsonBinder.bindToRequest(request, ImmutableMap.of("rebuild", image));
- }
-
- @Override
- public R bindToRequest(R request, Object toBind) {
- throw new IllegalStateException("RebuildServer is a POST operation");
- }
-
- /**
- *
- * @param id
- * of the image to rebuild the server with.
- */
- public RebuildServerOptions withImage(int id) {
- checkArgument(id > 0, "server id must be a positive number");
- this.imageId = id;
- return this;
- }
-
- public static class Builder {
-
- /**
- * @see RebuildServerOptions#withImage(int)
- */
- public static RebuildServerOptions withImage(int id) {
- RebuildServerOptions options = new RebuildServerOptions();
- return options.withImage(id);
- }
- }
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/predicates/ServerActive.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/predicates/ServerActive.java
deleted file mode 100644
index f2ea6e6da1..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/predicates/ServerActive.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.cloudservers.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.ServerStatus;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Predicate;
-import com.google.inject.Inject;
-
-/**
- *
- * Tests to see if a task succeeds.
- */
-@Singleton
-public class ServerActive implements Predicate {
-
- private final CloudServersClient client;
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Inject
- public ServerActive(CloudServersClient client) {
- this.client = client;
- }
-
- public boolean apply(Server server) {
- logger.trace("looking for state on server %s", checkNotNull(server, "server"));
- server = refresh(server);
- if (server == null)
- return false;
- logger.trace("%s: looking for server state %s: currently: %s", server.getId(),
- ServerStatus.ACTIVE, server.getStatus());
- return server.getStatus() == ServerStatus.ACTIVE;
- }
-
- private Server refresh(Server server) {
- return client.getServer(server.getId());
- }
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/predicates/ServerDeleted.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/predicates/ServerDeleted.java
deleted file mode 100644
index 0efbe2410e..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/predicates/ServerDeleted.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.cloudservers.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.ServerStatus;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Predicate;
-import com.google.inject.Inject;
-
-/**
- *
- * Tests to see if a task succeeds.
- */
-@Singleton
-public class ServerDeleted implements Predicate {
-
- private final CloudServersClient client;
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Inject
- public ServerDeleted(CloudServersClient client) {
- this.client = client;
- }
-
- public boolean apply(Server server) {
- logger.trace("looking for state on server %s", checkNotNull(server, "server"));
- server = refresh(server);
- if (server == null)
- return true;
- logger.trace("%s: looking for server state %s: currently: %s", server.getId(),
- ServerStatus.DELETED, server.getStatus());
- return server.getStatus() == ServerStatus.DELETED;
- }
-
- private Server refresh(Server server) {
- return client.getServer(server.getId());
- }
-}
diff --git a/apis/cloudservers/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/apis/cloudservers/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
deleted file mode 100644
index 417ed21eaf..0000000000
--- a/apis/cloudservers/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.cloudservers.CloudServersApiMetadata
\ No newline at end of file
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersApiMetadataTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersApiMetadataTest.java
deleted file mode 100644
index c551a74e6a..0000000000
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersApiMetadataTest.java
+++ /dev/null
@@ -1,28 +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 org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "CloudServersApiMetadataTest")
-public class CloudServersApiMetadataTest extends BaseComputeServiceApiMetadataTest {
-
- public CloudServersApiMetadataTest() {
- super(new CloudServersApiMetadata());
- }
-}
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientLiveTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientLiveTest.java
deleted file mode 100644
index c9240f9683..0000000000
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientLiveTest.java
+++ /dev/null
@@ -1,606 +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 java.util.concurrent.TimeUnit.SECONDS;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withFile;
-import static org.jclouds.cloudservers.options.CreateSharedIpGroupOptions.Builder.withServer;
-import static org.jclouds.cloudservers.options.ListOptions.Builder.withDetails;
-import static org.jclouds.util.Predicates2.retry;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.security.SecureRandom;
-import java.util.Map;
-import java.util.Set;
-
-import org.jclouds.cloudservers.domain.BackupSchedule;
-import org.jclouds.cloudservers.domain.DailyBackup;
-import org.jclouds.cloudservers.domain.Flavor;
-import org.jclouds.cloudservers.domain.Image;
-import org.jclouds.cloudservers.domain.ImageStatus;
-import org.jclouds.cloudservers.domain.Limits;
-import org.jclouds.cloudservers.domain.RebootType;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.ServerStatus;
-import org.jclouds.cloudservers.domain.SharedIpGroup;
-import org.jclouds.cloudservers.domain.WeeklyBackup;
-import org.jclouds.cloudservers.options.RebuildServerOptions;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.io.Payload;
-import org.jclouds.predicates.SocketOpen;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.ssh.SshException;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.jclouds.util.Strings2;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeGroups;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.net.HostAndPort;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * Tests behavior of {@code CloudServersClient}
- */
-@Test(groups = "live", singleThreaded = true, testName = "CloudServersClientLiveTest")
-public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTest {
-
- public CloudServersClientLiveTest() {
- provider = "cloudservers";
- }
-
- protected CloudServersClient client;
- protected SshClient.Factory sshFactory;
- protected Predicate socketTester;
-
- @BeforeGroups(groups = { "integration", "live" })
- @Override
- public void setupContext() {
- super.setupContext();
- Injector injector = view.utils().injector();
- client = injector.getInstance(CloudServersClient.class);
- sshFactory = injector.getInstance(SshClient.Factory.class);
- SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
- socketTester = retry(socketOpen, 120, 1, SECONDS);
- injector.injectMembers(socketOpen); // add logger
- }
-
- public void testLimits() throws Exception {
- Limits response = client.getLimits();
- assert null != response;
- assertTrue(!response.getAbsolute().isEmpty());
- assertTrue(!response.getRate().isEmpty());
- }
-
- public void testListServers() throws Exception {
-
- Set response = client.listServers();
- assert null != response;
- long initialContainerCount = response.size();
- assertTrue(initialContainerCount >= 0);
-
- }
-
- public void testListServersDetail() throws Exception {
- Set response = client.listServers(withDetails());
- assert null != response;
- long initialContainerCount = response.size();
- assertTrue(initialContainerCount >= 0);
- }
-
- public void testListImages() throws Exception {
- Set response = client.listImages();
- assert null != response;
- long imageCount = response.size();
- assertTrue(imageCount >= 1);
- for (Image image : response) {
- assertTrue(image.getId() >= 0);
- assert null != image.getName() : image;
- }
-
- }
-
- public void testListImagesDetail() throws Exception {
- Set response = client.listImages(withDetails());
- assert null != response;
- long imageCount = response.size();
- assertTrue(imageCount >= 0);
- for (Image image : response) {
- assertTrue(image.getId() >= 1);
- assert null != image.getName() : image;
- assert null != image.getStatus() : image;
- }
- }
-
- public void testGetImagesDetail() throws Exception {
- Set response = client.listImages(withDetails());
- assert null != response;
- long imageCount = response.size();
- assertTrue(imageCount >= 0);
- for (Image image : response) {
- Image newDetails = client.getImage(image.getId());
- assertEquals(image, newDetails);
- }
- }
-
- @Test
- public void testGetImageDetailsNotFound() throws Exception {
- assert client.getImage(12312987) == null;
- }
-
- @Test
- public void testGetServerDetailsNotFound() throws Exception {
- assert client.getServer(12312987) == null;
- }
-
- public void testGetServersDetail() throws Exception {
- Set response = client.listServers(withDetails());
- assert null != response;
- long serverCount = response.size();
- assertTrue(serverCount >= 0);
- for (Server server : response) {
- Server newDetails = client.getServer(server.getId());
- assertEquals(server, newDetails);
- }
- }
-
- public void testListFlavors() throws Exception {
- Set response = client.listFlavors();
- assert null != response;
- long flavorCount = response.size();
- assertTrue(flavorCount >= 1);
- for (Flavor flavor : response) {
- assertTrue(flavor.getId() >= 0);
- assert null != flavor.getName() : flavor;
- }
-
- }
-
- public void testListFlavorsDetail() throws Exception {
- Set response = client.listFlavors(withDetails());
- assert null != response;
- long flavorCount = response.size();
- assertTrue(flavorCount >= 0);
- for (Flavor flavor : response) {
- assertTrue(flavor.getId() >= 1);
- assert null != flavor.getName() : flavor;
- assert null != flavor.getDisk() : flavor;
- assert null != flavor.getRam() : flavor;
- }
- }
-
- public void testGetFlavorsDetail() throws Exception {
- Set response = client.listFlavors(withDetails());
- assert null != response;
- long flavorCount = response.size();
- assertTrue(flavorCount >= 0);
- for (Flavor flavor : response) {
- Flavor newDetails = client.getFlavor(flavor.getId());
- assertEquals(flavor, newDetails);
- }
- }
-
- @Test
- public void testGetFlavorDetailsNotFound() throws Exception {
- assert client.getFlavor(12312987) == null;
- }
-
- public void testListSharedIpGroups() throws Exception {
- Set response = client.listSharedIpGroups();
- assert null != response;
- long sharedIpGroupCount = response.size();
- assertTrue(sharedIpGroupCount >= 0);
- for (SharedIpGroup sharedIpGroup : response) {
- assertTrue(sharedIpGroup.getId() >= 0);
- assert null != sharedIpGroup.getName() : sharedIpGroup;
- }
-
- }
-
- public void testListSharedIpGroupsDetail() throws Exception {
- Set response = client.listSharedIpGroups(withDetails());
- assert null != response;
- long sharedIpGroupCount = response.size();
- assertTrue(sharedIpGroupCount >= 0);
- for (SharedIpGroup sharedIpGroup : response) {
- assertTrue(sharedIpGroup.getId() >= 1);
- assert null != sharedIpGroup.getName() : sharedIpGroup;
- assert null != sharedIpGroup.getServers() : sharedIpGroup;
- }
- }
-
- public void testGetSharedIpGroupsDetail() throws Exception {
- Set response = client.listSharedIpGroups(withDetails());
- assert null != response;
- long sharedIpGroupCount = response.size();
- assertTrue(sharedIpGroupCount >= 0);
- for (SharedIpGroup sharedIpGroup : response) {
- SharedIpGroup newDetails = client.getSharedIpGroup(sharedIpGroup.getId());
- assertEquals(sharedIpGroup, newDetails);
- }
- }
-
- @Test
- public void testGetSharedIpGroupDetailsNotFound() throws Exception {
- assert client.getSharedIpGroup(12312987) == null;
- }
-
- @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateServer")
- public void testCreateSharedIpGroup() throws Exception {
- SharedIpGroup sharedIpGroup = null;
- while (sharedIpGroup == null) {
- String sharedIpGroupName = serverPrefix + "createSharedIpGroup" + new SecureRandom().nextInt();
- try {
- sharedIpGroup = client.createSharedIpGroup(sharedIpGroupName, withServer(serverId));
- } catch (UndeclaredThrowableException e) {
- HttpResponseException htpe = (HttpResponseException) e.getCause().getCause();
- if (htpe.getResponse().getStatusCode() == 400)
- continue;
- throw e;
- }
- }
- assertNotNull(sharedIpGroup.getName());
- sharedIpGroupId = sharedIpGroup.getId();
- // Response doesn't include the server id Web Hosting #119311
- assert !sharedIpGroup.getServers().equals(ImmutableList.of(serverId));
- }
-
- private int sharedIpGroupId;
-
- private String serverPrefix = System.getProperty("user.name") + ".cs";
- private int serverId;
- private String adminPass;
- Map metadata = ImmutableMap.of("jclouds", "rackspace");
- private String ip;
- private int serverId2;
- private String adminPass2;
- private int imageId;
-
- public void testCreateServer() throws Exception {
- int imageId = 14362;
- int flavorId = 1;
- Server server = null;
- while (server == null) {
- String serverName = serverPrefix + "createserver" + new SecureRandom().nextInt();
- try {
- server = client.createServer(serverName, imageId, flavorId, withFile("/etc/jclouds.txt",
- "rackspace".getBytes()).withMetadata(metadata));
- } catch (UndeclaredThrowableException e) {
- HttpResponseException htpe = (HttpResponseException) e.getCause().getCause();
- if (htpe.getResponse().getStatusCode() == 400)
- continue;
- throw e;
- }
- }
- assertNotNull(server.getAdminPass());
- serverId = server.getId();
- adminPass = server.getAdminPass();
- ip = server.getAddresses().getPublicAddresses().iterator().next();
- assertEquals(server.getStatus(), ServerStatus.BUILD);
- blockUntilServerActive(serverId);
- }
-
- private void blockUntilServerActive(int serverId) throws InterruptedException {
- Server currentDetails = null;
- for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client
- .getServer(serverId)) {
- System.out.printf("blocking on status active%n%s%n", currentDetails);
- Thread.sleep(5 * 1000);
- }
- }
-
- private void blockUntilServerVerifyResize(int serverId) throws InterruptedException {
- Server currentDetails = null;
- for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.VERIFY_RESIZE; currentDetails = client
- .getServer(serverId)) {
- System.out.printf("blocking on status verify resize%n%s%n", currentDetails);
- Thread.sleep(5 * 1000);
- }
- }
-
- private void blockUntilImageActive(int imageId) throws InterruptedException {
- Image currentDetails = null;
- for (currentDetails = client.getImage(imageId); currentDetails.getStatus() != ImageStatus.ACTIVE; currentDetails = client
- .getImage(imageId)) {
- System.out.printf("blocking on status active%n%s%n", currentDetails);
- Thread.sleep(5 * 1000);
- }
- }
-
- @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateServer")
- public void testServerDetails() throws Exception {
- Server server = client.getServer(serverId);
-
- assertNotNull(server.getHostId());
- assertEquals(server.getStatus(), ServerStatus.ACTIVE);
- assert server.getProgress() >= 0 : "newDetails.getProgress()" + server.getProgress();
- assertEquals(Integer.valueOf(14362), server.getImageId());
- assertEquals(Integer.valueOf(1), server.getFlavorId());
- assertNotNull(server.getAddresses());
- // listAddresses tests..
- assertEquals(client.getAddresses(serverId), server.getAddresses());
- assertEquals(server.getAddresses().getPublicAddresses().size(), 1);
- assertEquals(client.listPublicAddresses(serverId), server.getAddresses().getPublicAddresses());
- assertEquals(server.getAddresses().getPrivateAddresses().size(), 1);
- assertEquals(client.listPrivateAddresses(serverId), server.getAddresses().getPrivateAddresses());
-
- // check metadata
- assertEquals(server.getMetadata(), metadata);
-
- checkPassOk(server, adminPass);
- }
-
- /**
- * this tests "personality" as the file looked up was sent during server creation
- */
- private void checkPassOk(Server newDetails, String pass) throws IOException {
- try {
- doCheckPass(newDetails, pass);
- } catch (SshException e) {// try twice in case there is a network timeout
- try {
- Thread.sleep(10 * 1000);
- } catch (InterruptedException e1) {
- }
- doCheckPass(newDetails, pass);
- }
- }
-
- private void doCheckPass(Server newDetails, String pass) throws IOException {
- HostAndPort socket = HostAndPort.fromParts(Iterables.get(newDetails.getAddresses().getPublicAddresses(), 0), 22);
- socketTester.apply(socket);
-
- SshClient client = sshFactory.create(socket, LoginCredentials.builder().user("root").password(pass).build());
- try {
- client.connect();
- Payload etcPasswd = client.get("/etc/jclouds.txt");
- String etcPasswdContents = Strings2.toStringAndClose(etcPasswd.openStream());
- assertEquals("rackspace", etcPasswdContents.trim());
- } finally {
- if (client != null)
- client.disconnect();
- }
- }
-
- private ExecResponse exec(Server details, String pass, String command) throws IOException {
- HostAndPort socket = HostAndPort.fromParts(Iterables.get(details.getAddresses().getPublicAddresses(), 0), 22);
- socketTester.apply(socket);
- SshClient client = sshFactory.create(socket, LoginCredentials.builder().user("root").password(pass).build());
- try {
- client.connect();
- return client.exec(command);
- } finally {
- if (client != null)
- client.disconnect();
- }
- }
-
- @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateServer")
- public void testRenameServer() throws Exception {
- Server server = client.getServer(serverId);
- String oldName = server.getName();
- client.renameServer(serverId, oldName + "new");
- blockUntilServerActive(serverId);
- assertEquals(oldName + "new", client.getServer(serverId).getName());
- }
-
- @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateServer")
- public void testChangePassword() throws Exception {
- client.changeAdminPass(serverId, "elmo");
- blockUntilServerActive(serverId);
- checkPassOk(client.getServer(serverId), "elmo");
- this.adminPass = "elmo";
- }
-
- @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateSharedIpGroup")
- public void testCreateServerIp() throws Exception {
- int imageId = 14362;
- int flavorId = 1;
- Server server = null;
- while (server == null) {
- String serverName = serverPrefix + "createserver" + new SecureRandom().nextInt();
- try {
- server = client
- .createServer(serverName, imageId, flavorId, withFile("/etc/jclouds.txt", "rackspace".getBytes())
- .withMetadata(metadata).withSharedIpGroup(sharedIpGroupId).withSharedIp(ip));
- } catch (UndeclaredThrowableException e) {
- HttpResponseException htpe = (HttpResponseException) e.getCause().getCause();
- if (htpe.getResponse().getStatusCode() == 400)
- continue;
- throw e;
- }
- }
- assertNotNull(server.getAdminPass());
- serverId2 = server.getId();
- adminPass2 = server.getAdminPass();
- blockUntilServerActive(serverId2);
- assertIpConfigured(server, adminPass2);
- assert server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses() + " doesn't contain " + ip;
- assertEquals(server.getSharedIpGroupId(), Integer.valueOf(sharedIpGroupId));
- }
-
- private void assertIpConfigured(Server server, String password) {
- try {
- ExecResponse response = exec(server, password, "ifconfig -a");
- assert response.getOutput().indexOf(ip) > 0 : String.format("server %s didn't get ip %s%n%s", server, ip,
- response);
- } catch (Exception e) {
- e.printStackTrace();
- } catch (AssertionError e) {
- e.printStackTrace();
- }
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testCreateServerIp")
- public void testUnshare() throws Exception {
- client.unshareIp(ip, serverId2);
- blockUntilServerActive(serverId2);
- Server server = client.getServer(serverId2);
- assert !server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses();
- assertIpNotConfigured(server, adminPass2);
- }
-
- private void assertIpNotConfigured(Server server, String password) {
- try {
- ExecResponse response = exec(server, password, "ifconfig -a");
- assert response.getOutput().indexOf(ip) == -1 : String.format("server %s still has get ip %s%n%s", server, ip,
- response);
- } catch (Exception e) {
- e.printStackTrace();
- } catch (AssertionError e) {
- e.printStackTrace();
- }
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testUnshare")
- public void testShareConfig() throws Exception {
- client.shareIp(ip, serverId2, sharedIpGroupId, true);
- blockUntilServerActive(serverId2);
- Server server = client.getServer(serverId2);
- assert server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses();
- assertIpConfigured(server, adminPass2);
- testUnshare();
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testShareConfig")
- public void testShareNoConfig() throws Exception {
- client.shareIp(ip, serverId2, sharedIpGroupId, false);
- blockUntilServerActive(serverId2);
- Server server = client.getServer(serverId2);
- assert server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses();
- assertIpNotConfigured(server, adminPass2);
- testUnshare();
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testShareNoConfig")
- public void testBackup() throws Exception {
- assertEquals(BackupSchedule.builder().build(), client.getBackupSchedule(serverId));
- BackupSchedule dailyWeekly = BackupSchedule.builder().enabled(true).weekly(WeeklyBackup.FRIDAY).daily(DailyBackup.H_0400_0600).build();
- client.replaceBackupSchedule(serverId, dailyWeekly);
- client.deleteBackupSchedule(serverId);
- // disables, doesn't delete: Web Hosting #119571
- assertEquals(client.getBackupSchedule(serverId).isEnabled(), false);
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testBackup")
- public void testCreateImage() throws Exception {
- Image image = client.createImageFromServer("hoofie", serverId);
- assertEquals("hoofie", image.getName());
- assertEquals(Integer.valueOf(serverId), image.getServerId());
- imageId = image.getId();
- blockUntilImageActive(imageId);
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testCreateImage")
- public void testRebuildServer() throws Exception {
- client.rebuildServer(serverId, new RebuildServerOptions().withImage(imageId));
- blockUntilServerActive(serverId);
- // issue Web Hosting #119580 imageId comes back incorrect after rebuild
- assert !Integer.valueOf(imageId).equals(client.getServer(serverId).getImageId());
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testRebuildServer")
- public void testRebootHard() throws Exception {
- client.rebootServer(serverId, RebootType.HARD);
- blockUntilServerActive(serverId);
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testRebootHard")
- public void testRebootSoft() throws Exception {
- client.rebootServer(serverId, RebootType.SOFT);
- blockUntilServerActive(serverId);
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testRebootSoft")
- public void testRevertResize() throws Exception {
- client.resizeServer(serverId, 2);
- blockUntilServerVerifyResize(serverId);
- client.revertResizeServer(serverId);
- blockUntilServerActive(serverId);
- assertEquals(Integer.valueOf(1), client.getServer(serverId).getFlavorId());
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testRebootSoft")
- public void testConfirmResize() throws Exception {
- client.resizeServer(serverId2, 2);
- blockUntilServerVerifyResize(serverId2);
- client.confirmResizeServer(serverId2);
- blockUntilServerActive(serverId2);
- assertEquals(Integer.valueOf(2), client.getServer(serverId2).getFlavorId());
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = { "testRebootSoft", "testRevertResize", "testConfirmResize" })
- void deleteServer2() {
- if (serverId2 > 0) {
- client.deleteServer(serverId2);
- assert client.getServer(serverId2) == null;
- }
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "deleteServer2")
- void testDeleteImage() {
- if (imageId > 0) {
- client.deleteImage(imageId);
- assert client.getImage(imageId) == null;
- }
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testDeleteImage")
- void deleteServer1() {
- if (serverId > 0) {
- client.deleteServer(serverId);
- assert client.getServer(serverId) == null;
- }
- }
-
- @Test(timeOut = 10 * 60 * 1000, dependsOnMethods = { "deleteServer1" })
- void testDeleteSharedIpGroup() {
- if (sharedIpGroupId > 0) {
- client.deleteSharedIpGroup(sharedIpGroupId);
- assert client.getSharedIpGroup(sharedIpGroupId) == null;
- }
- }
-
- @AfterTest
- void deleteServersOnEnd() {
- if (serverId > 0) {
- client.deleteServer(serverId);
- }
- if (serverId2 > 0) {
- client.deleteServer(serverId2);
- }
- if (sharedIpGroupId > 0) {
- client.deleteSharedIpGroup(sharedIpGroupId);
- }
- }
-
- @Override
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-}
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
deleted file mode 100644
index 28f9ca60d1..0000000000
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientTest.java
+++ /dev/null
@@ -1,898 +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.Constants.PROPERTY_API_VERSION;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withFile;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withMetadata;
-import static org.jclouds.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup;
-import static org.jclouds.cloudservers.options.CreateSharedIpGroupOptions.Builder.withServer;
-import static org.jclouds.cloudservers.options.ListOptions.Builder.changesSince;
-import static org.jclouds.cloudservers.options.ListOptions.Builder.withDetails;
-import static org.jclouds.cloudservers.options.RebuildServerOptions.Builder.withImage;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
-import static org.jclouds.reflect.Reflection2.method;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.Date;
-import java.util.Properties;
-
-import javax.inject.Singleton;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.cloudservers.config.CloudServersHttpApiModule;
-import org.jclouds.cloudservers.domain.BackupSchedule;
-import org.jclouds.cloudservers.domain.DailyBackup;
-import org.jclouds.cloudservers.domain.RebootType;
-import org.jclouds.cloudservers.domain.WeeklyBackup;
-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.domain.Credentials;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.http.functions.ReturnTrueIf2xx;
-import org.jclouds.http.functions.UnwrapOnlyJsonValue;
-import org.jclouds.openstack.filters.AddTimestampQuery;
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.GetAuth;
-import org.jclouds.openstack.keystone.v1_1.domain.Auth;
-import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.reflect.Invokable;
-import com.google.inject.Module;
-import com.google.inject.Provides;
-
-@Test(groups = "unit", singleThreaded = true, testName = "CloudServersClientTest")
-public class CloudServersClientTest extends BaseRestAnnotationProcessingTest {
-
- public void testCreateServer() throws IOException, SecurityException, NoSuchMethodException {
- Invokable, ?> method = method(CloudServersClient.class, "createServer", String.class, int.class, int.class,
- CreateServerOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.