You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/11/02 12:43:20 UTC
[4/5] jclouds-labs git commit: Remove DigitalOcean v1
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanHttpApiModule.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanHttpApiModule.java b/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanHttpApiModule.java
deleted file mode 100644
index 3657198..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanHttpApiModule.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.digitalocean.config;
-
-import org.jclouds.digitalocean.DigitalOceanApi;
-import org.jclouds.digitalocean.handlers.DigitalOceanErrorHandler;
-import org.jclouds.digitalocean.http.ResponseStatusFromPayloadHttpCommandExecutorService;
-import org.jclouds.digitalocean.strategy.ListSshKeys;
-import org.jclouds.http.HttpCommandExecutorService;
-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.http.config.ConfiguresHttpCommandExecutorService;
-import org.jclouds.http.config.SSLModule;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.config.HttpApiModule;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Scopes;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
-
-/**
- * Configures the DigitalOcean connection.
- */
-@ConfiguresHttpApi
-public class DigitalOceanHttpApiModule extends HttpApiModule<DigitalOceanApi> {
-
- @Override
- protected void configure() {
- super.configure();
- install(new FactoryModuleBuilder().build(ListSshKeys.Factory.class));
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(DigitalOceanErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(DigitalOceanErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(DigitalOceanErrorHandler.class);
- }
-
- @ConfiguresHttpCommandExecutorService
- public static class DigitalOceanHttpCommandExecutorServiceModule extends AbstractModule {
- @Override
- protected void configure() {
- install(new SSLModule());
- bind(HttpCommandExecutorService.class).to(ResponseStatusFromPayloadHttpCommandExecutorService.class).in(
- Scopes.SINGLETON);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanParserModule.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanParserModule.java b/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanParserModule.java
deleted file mode 100644
index 9170c8e..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/config/DigitalOceanParserModule.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.digitalocean.config;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Throwables.propagate;
-import static com.google.common.collect.Iterables.get;
-import static com.google.common.collect.Iterables.size;
-import static com.google.inject.Scopes.SINGLETON;
-
-import java.io.IOException;
-import java.lang.reflect.Type;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.PublicKey;
-import java.security.interfaces.DSAPublicKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.DSAPublicKeySpec;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.RSAPublicKeySpec;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.digitalocean.ssh.DSAKeys;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-import org.jclouds.ssh.SshKeys;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.TypeAdapter;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-/**
- * Custom parser bindings.
- */
-public class DigitalOceanParserModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class).in(SINGLETON);
- }
-
- @Singleton
- public static class SshPublicKeyAdapter extends TypeAdapter<PublicKey> {
-
- private final Function<PublicKey, String> publicKeyToSshKey;
- private final Function<String, PublicKey> sshKeyToPublicKey;
-
- @Inject
- public SshPublicKeyAdapter(Function<PublicKey, String> publicKeyToSshKey,
- Function<String, PublicKey> sshKeyToPublicKey) {
- this.publicKeyToSshKey = checkNotNull(publicKeyToSshKey, "publicKeyToSshKey cannot be null");
- this.sshKeyToPublicKey = checkNotNull(sshKeyToPublicKey, "sshKeyToPublicKey cannot be null");
- }
-
- @Override
- public void write(JsonWriter out, PublicKey value) throws IOException {
- out.value(publicKeyToSshKey.apply(value));
- }
-
- @Override
- public PublicKey read(JsonReader in) throws IOException {
- return sshKeyToPublicKey.apply(in.nextString().trim());
- }
- }
-
- @Provides
- @Singleton
- public Function<PublicKey, String> publicKeyToSshKey() {
- return new Function<PublicKey, String>() {
- @Override
- public String apply(PublicKey input) {
- if (input instanceof RSAPublicKey) {
- return SshKeys.encodeAsOpenSSH((RSAPublicKey) input);
- } else if (input instanceof DSAPublicKey) {
- return DSAKeys.encodeAsOpenSSH((DSAPublicKey) input);
- } else {
- throw new IllegalArgumentException("Only RSA and DSA keys are supported");
- }
- }
- };
- }
-
- @Provides
- @Singleton
- public Function<String, PublicKey> sshKeyToPublicKey() {
- return new Function<String, PublicKey>() {
- @Override
- public PublicKey apply(String input) {
- Iterable<String> parts = Splitter.on(' ').split(input);
- checkArgument(size(parts) >= 2, "bad format, should be: [ssh-rsa|ssh-dss] AAAAB3...");
- String type = get(parts, 0);
-
- try {
- if ("ssh-rsa".equals(type)) {
- RSAPublicKeySpec spec = SshKeys.publicKeySpecFromOpenSSH(input);
- return KeyFactory.getInstance("RSA").generatePublic(spec);
- } else if ("ssh-dss".equals(type)) {
- DSAPublicKeySpec spec = DSAKeys.publicKeySpecFromOpenSSH(input);
- return KeyFactory.getInstance("DSA").generatePublic(spec);
- } else {
- throw new IllegalArgumentException("bad format, should be: [ssh-rsa|ssh-dss] AAAAB3...");
- }
- } catch (InvalidKeySpecException ex) {
- throw propagate(ex);
- } catch (NoSuchAlgorithmException ex) {
- throw propagate(ex);
- }
- }
- };
- }
-
- @Provides
- @Singleton
- public Map<Type, Object> provideCustomAdapterBindings(SshPublicKeyAdapter sshPublicKeyAdapter) {
- return ImmutableMap.<Type, Object> of(PublicKey.class, sshPublicKeyAdapter);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/BaseResponse.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/BaseResponse.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/BaseResponse.java
deleted file mode 100644
index 8f7915e..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/BaseResponse.java
+++ /dev/null
@@ -1,118 +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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Enums;
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.inject.name.Named;
-
-/**
- * Information of an error.
- */
-public class BaseResponse {
-
- public static enum Status {
- OK, ERROR;
-
- public static Status fromValue(String value) {
- Optional<Status> status = Enums.getIfPresent(Status.class, value.toUpperCase());
- checkArgument(status.isPresent(), "Expected one of %s but was %s", Joiner.on(',').join(Status.values()), value);
- return status.get();
- }
- }
-
- private final Status status;
- @Named("error_message")
- private final String message;
- @Named("message")
- private final String details;
-
- @ConstructorProperties({ "status", "error_message", "message" })
- public BaseResponse(Status status, @Nullable String message, @Nullable String details) {
- this.status = checkNotNull(status, "status cannot be null");
- this.message = message;
- this.details = details;
- }
-
- public Status getStatus() {
- return status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public String getDetails() {
- return details;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (details == null ? 0 : details.hashCode());
- result = prime * result + (message == null ? 0 : message.hashCode());
- result = prime * result + (status == null ? 0 : status.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- BaseResponse other = (BaseResponse) obj;
- if (details == null) {
- if (other.details != null) {
- return false;
- }
- } else if (!details.equals(other.details)) {
- return false;
- }
- if (message == null) {
- if (other.message != null) {
- return false;
- }
- } else if (!message.equals(other.message)) {
- return false;
- }
- if (status != other.status) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "BaseResponse [status=" + status + ", message=" + message + ", details=" + details + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Distribution.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Distribution.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Distribution.java
deleted file mode 100644
index ef107c4..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Distribution.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.tryFind;
-import static java.util.Arrays.asList;
-
-import java.util.List;
-
-import org.jclouds.compute.domain.OsFamily;
-
-import com.google.common.base.Predicate;
-
-/**
- * DigitalOcean image distributions.
- */
-public enum Distribution {
- ARCHLINUX(OsFamily.ARCH, "Arch Linux"), CENTOS(OsFamily.CENTOS, "CentOS"), DEBIAN(OsFamily.DEBIAN, "Debian"), FEDORA(
- OsFamily.FEDORA, "Fedora"), UBUNTU(OsFamily.UBUNTU, "Ubuntu"), UNRECOGNIZED(OsFamily.UNRECOGNIZED, "");
-
- private static final List<Distribution> values = asList(Distribution.values());
-
- private final OsFamily osFamily;
- private final String value;
-
- private Distribution(OsFamily osFamily, String value) {
- this.osFamily = checkNotNull(osFamily, "osFamily cannot be null");
- this.value = checkNotNull(value, "value cannot be null");
- }
-
- public OsFamily getOsFamily() {
- return this.osFamily;
- }
-
- public String getValue() {
- return value;
- }
-
- public static Distribution fromValue(String value) {
- return tryFind(values, hasValue(value)).or(UNRECOGNIZED);
- }
-
- private static Predicate<Distribution> hasValue(final String value) {
- return new Predicate<Distribution>() {
- @Override
- public boolean apply(Distribution input) {
- return input.value.equalsIgnoreCase(value);
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Droplet.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Droplet.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Droplet.java
deleted file mode 100644
index 7fbdb72..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Droplet.java
+++ /dev/null
@@ -1,250 +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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Enums;
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-
-/**
- * A droplet.
- */
-public class Droplet {
-
- public enum Status {
- NEW, ACTIVE, ARCHIVE, OFF;
-
- public static Status fromValue(String value) {
- Optional<Status> status = Enums.getIfPresent(Status.class, value.toUpperCase());
- checkArgument(status.isPresent(), "Expected one of %s but was %s", Joiner.on(',').join(Status.values()), value);
- return status.get();
- }
- }
-
- private final int id;
- private final String name;
- @Named("image_id")
- private final int imageId;
- @Named("size_id")
- private final int sizeId;
- @Named("region_id")
- private final int regionId;
- @Named("backups_active")
- private final boolean backupsActive;
- private final List<Object> backups;
- private final List<Object> snapshots;
- @Named("ip_address")
- private final String ip;
- @Named("private_ip_address")
- private final String privateIp;
- private final boolean locked;
- private final Status status;
- @Named("created_at")
- private final Date creationDate;
-
- @ConstructorProperties({ "id", "name", "image_id", "size_id", "region_id", "backups_active", "backups", "snapshots",
- "ip_address", "private_ip_address", "locked", "status", "created_at" })
- public Droplet(int id, String name, int imageId, int sizeId, int regionId, boolean backupsActive,
- @Nullable List<Object> backups, @Nullable List<Object> snapshots, String ip, @Nullable String privateIp,
- boolean locked, Status status, @Nullable Date creationDate) throws ParseException {
- this.id = id;
- this.name = checkNotNull(name, "name cannot be null");
- this.imageId = imageId;
- this.sizeId = sizeId;
- this.regionId = regionId;
- this.backupsActive = backupsActive;
- this.backups = backups != null ? ImmutableList.copyOf(backups) : ImmutableList.of();
- this.snapshots = snapshots != null ? ImmutableList.copyOf(snapshots) : ImmutableList.of();
- this.ip = ip;
- this.privateIp = privateIp;
- this.locked = locked;
- this.status = checkNotNull(status, "status cannot be null");
- this.creationDate = creationDate;
- }
-
- public int getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public int getImageId() {
- return imageId;
- }
-
- public int getSizeId() {
- return sizeId;
- }
-
- public int getRegionId() {
- return regionId;
- }
-
- public boolean isBackupsActive() {
- return backupsActive;
- }
-
- public List<Object> getBackups() {
- return backups;
- }
-
- public List<Object> getSnapshots() {
- return snapshots;
- }
-
- public String getIp() {
- return ip;
- }
-
- public String getPrivateIp() {
- return privateIp;
- }
-
- public boolean isLocked() {
- return locked;
- }
-
- public Status getStatus() {
- return status;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (backups == null ? 0 : backups.hashCode());
- result = prime * result + (backupsActive ? 1231 : 1237);
- result = prime * result + (creationDate == null ? 0 : creationDate.hashCode());
- result = prime * result + id;
- result = prime * result + imageId;
- result = prime * result + (ip == null ? 0 : ip.hashCode());
- result = prime * result + (locked ? 1231 : 1237);
- result = prime * result + (name == null ? 0 : name.hashCode());
- result = prime * result + (privateIp == null ? 0 : privateIp.hashCode());
- result = prime * result + regionId;
- result = prime * result + sizeId;
- result = prime * result + (snapshots == null ? 0 : snapshots.hashCode());
- result = prime * result + (status == null ? 0 : status.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Droplet other = (Droplet) obj;
- if (backups == null) {
- if (other.backups != null) {
- return false;
- }
- } else if (!backups.equals(other.backups)) {
- return false;
- }
- if (backupsActive != other.backupsActive) {
- return false;
- }
- if (creationDate == null) {
- if (other.creationDate != null) {
- return false;
- }
- } else if (!creationDate.equals(other.creationDate)) {
- return false;
- }
- if (id != other.id) {
- return false;
- }
- if (imageId != other.imageId) {
- return false;
- }
- if (ip == null) {
- if (other.ip != null) {
- return false;
- }
- } else if (!ip.equals(other.ip)) {
- return false;
- }
- if (locked != other.locked) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (privateIp == null) {
- if (other.privateIp != null) {
- return false;
- }
- } else if (!privateIp.equals(other.privateIp)) {
- return false;
- }
- if (regionId != other.regionId) {
- return false;
- }
- if (sizeId != other.sizeId) {
- return false;
- }
- if (snapshots == null) {
- if (other.snapshots != null) {
- return false;
- }
- } else if (!snapshots.equals(other.snapshots)) {
- return false;
- }
- if (status != other.status) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "Droplet [id=" + id + ", name=" + name + ", imageId=" + imageId + ", sizeId=" + sizeId + ", regionId="
- + regionId + ", backupsActive=" + backupsActive + ", backups=" + backups + ", snapshots=" + snapshots
- + ", ip=" + ip + ", privateIp=" + privateIp + ", locked=" + locked + ", status=" + status
- + ", creationDate=" + creationDate + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/DropletCreation.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/DropletCreation.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/DropletCreation.java
deleted file mode 100644
index d7793c8..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/DropletCreation.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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.inject.name.Named;
-
-/**
- * An DropletCreation response.
- */
-public class DropletCreation {
-
- private final int id;
- private final String name;
- @Named("image_id")
- private final int imageId;
- @Named("size_id")
- private final int sizeId;
- @Named("event_id")
- private final int eventId;
-
- @ConstructorProperties({ "id", "name", "image_id", "size_id", "event_id" })
- public DropletCreation(int id, String name, int imageId, int sizeId, int eventId) {
- this.id = id;
- this.name = checkNotNull(name, "name cannot be null");
- this.imageId = imageId;
- this.sizeId = sizeId;
- this.eventId = eventId;
- }
-
- public int getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public int getImageId() {
- return imageId;
- }
-
- public int getSizeId() {
- return sizeId;
- }
-
- public int getEventId() {
- return eventId;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + eventId;
- result = prime * result + id;
- result = prime * result + imageId;
- result = prime * result + (name == null ? 0 : name.hashCode());
- result = prime * result + sizeId;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- DropletCreation other = (DropletCreation) obj;
- if (eventId != other.eventId) {
- return false;
- }
- if (id != other.id) {
- return false;
- }
- if (imageId != other.imageId) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (sizeId != other.sizeId) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "DropletCreation [id=" + id + ", name=" + name + ", imageId=" + imageId + ", sizeId=" + sizeId
- + ", eventId=" + eventId + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Event.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Event.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Event.java
deleted file mode 100644
index 607e320..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Event.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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.primitives.Ints.tryParse;
-
-import java.beans.ConstructorProperties;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Enums;
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.inject.name.Named;
-
-/**
- * An Event.
- */
-public class Event {
-
- public enum Status {
- DONE, PENDING, ERROR;
-
- public static Status fromValue(String value) {
- // DigitalOcean return a 'null' status when the operation is still in
- // progress
- if (value == null) {
- return PENDING;
- }
- Optional<Status> status = Enums.getIfPresent(Status.class, value.toUpperCase());
- checkArgument(status.isPresent(), "Expected one of %s but was", Joiner.on(',').join(Status.values()), value);
- return status.get();
- }
- }
-
- private final int id;
- @Named("action_status")
- private final Status status;
- @Named("event_type_id")
- private final int typeId;
- private final Integer percentage;
- @Named("droplet_id")
- private final int dropletId;
-
- @ConstructorProperties({ "id", "action_status", "event_type_id", "percentage", "droplet_id" })
- public Event(int id, @Nullable Status status, int typeId, @Nullable String percentage, int dropletId) {
- this.id = id;
- this.status = status == null ? Status.PENDING : status;
- this.typeId = typeId;
- this.percentage = percentage == null ? null : tryParse(percentage);
- this.dropletId = dropletId;
- }
-
- public int getId() {
- return id;
- }
-
- public Status getStatus() {
- return status;
- }
-
- public int getTypeId() {
- return typeId;
- }
-
- public Integer getPercentage() {
- return percentage;
- }
-
- public int getDropletId() {
- return dropletId;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + dropletId;
- result = prime * result + id;
- result = prime * result + (percentage == null ? 0 : percentage.hashCode());
- result = prime * result + (status == null ? 0 : status.hashCode());
- result = prime * result + typeId;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Event other = (Event) obj;
- if (dropletId != other.dropletId) {
- return false;
- }
- if (id != other.id) {
- return false;
- }
- if (percentage == null) {
- if (other.percentage != null) {
- return false;
- }
- } else if (!percentage.equals(other.percentage)) {
- return false;
- }
- if (status != other.status) {
- return false;
- }
- if (typeId != other.typeId) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "Event [id=" + id + ", status=" + status + ", typeId=" + typeId + ", percentage=" + percentage
- + ", dropletId=" + dropletId + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Image.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Image.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Image.java
deleted file mode 100644
index 1ce92c2..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Image.java
+++ /dev/null
@@ -1,160 +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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.List;
-
-import javax.inject.Named;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * An Image.
- */
-public class Image {
- private final int id;
- private final String name;
- private final OperatingSystem os;
- private final boolean publicImage;
- private final String slug;
- @Named("regions")
- private final List<Integer> regionIds;
- @Named("region_slugs")
- private final List<String> regionSlugs;
-
- @ConstructorProperties({ "id", "name", "distribution", "public", "slug", "regions", "region_slugs" })
- public Image(int id, String name, String distribution, boolean publicImage, @Nullable String slug,
- List<Integer> regionIds, List<String> regionSlugs) {
- this.id = id;
- this.name = checkNotNull(name, "name");
- this.os = OperatingSystem.builder().from(name, checkNotNull(distribution, "distribution")).build();
- this.publicImage = publicImage;
- this.slug = slug;
- this.regionIds = ImmutableList.copyOf(checkNotNull(regionIds, "regionIds"));
- this.regionSlugs = ImmutableList.copyOf(checkNotNull(regionSlugs, "regionSlugs"));
- }
-
- public int getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public OperatingSystem getOs() {
- return os;
- }
-
- public boolean isPublicImage() {
- return publicImage;
- }
-
- public String getSlug() {
- return slug;
- }
-
- public List<Integer> getRegionIds() {
- return regionIds;
- }
-
- public List<String> getRegionSlugs() {
- return regionSlugs;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + id;
- result = prime * result + (name == null ? 0 : name.hashCode());
- result = prime * result + (os == null ? 0 : os.hashCode());
- result = prime * result + (publicImage ? 1231 : 1237);
- result = prime * result + (slug == null ? 0 : slug.hashCode());
- result = prime * result + (regionIds == null ? 0 : regionIds.hashCode());
- result = prime * result + (regionSlugs == null ? 0 : regionSlugs.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Image other = (Image) obj;
- if (id != other.id) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (os == null) {
- if (other.os != null) {
- return false;
- }
- } else if (!os.equals(other.os)) {
- return false;
- }
- if (publicImage != other.publicImage) {
- return false;
- }
- if (slug == null) {
- if (other.slug != null) {
- return false;
- }
- } else if (!slug.equals(other.slug)) {
- return false;
- }
- if (regionIds == null) {
- if (other.regionIds != null) {
- return false;
- }
- } else if (!regionIds.equals(other.regionIds)) {
- return false;
- }
- if (regionSlugs == null) {
- if (other.regionSlugs != null) {
- return false;
- }
- } else if (!regionSlugs.equals(other.regionSlugs)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "Image [id=" + id + ", name=" + name + ", os=" + os + ", publicImage=" + publicImage + ", slug=" + slug
- + ", regionIds=" + regionIds + ", regionSlugs=" + regionSlugs + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/OperatingSystem.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/OperatingSystem.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/OperatingSystem.java
deleted file mode 100644
index 09d6267..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/OperatingSystem.java
+++ /dev/null
@@ -1,135 +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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Strings.nullToEmpty;
-import static java.util.regex.Pattern.compile;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * The operating system of an image.
- * <p>
- * This class parses the <code>name</code> string (e.g. "12.10 x64") of the images and properly sets each field to the
- * right value.
- */
-public class OperatingSystem {
-
- // Parse something like "12.10 x64" or "Ubuntu 12.10.1 x64" and matches the version and architecture
- private static final Pattern VERSION_PATTERN = compile("(?:[a-zA-Z\\s]*\\s+)?(\\d+(?:\\.?\\d+)*)?(?:\\s*(x\\d{2}))?.*");
- private static final String IS_64_BIT = "x64";
-
- private final Distribution distribution;
- private final String version;
- private final String arch;
-
- private OperatingSystem(String distribution, String version, String arch) {
- this.distribution = checkNotNull(Distribution.fromValue(distribution), "distribution cannot be null");
- this.version = checkNotNull(version, "version cannot be null");
- this.arch = checkNotNull(arch, "arch cannot be null");
- }
-
- public Distribution getDistribution() {
- return distribution;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getArch() {
- return arch;
- }
-
- public boolean is64bit() {
- return IS_64_BIT.equals(arch);
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String name;
- private String distribution;
-
- public Builder from(String name, String distribution) {
- this.name = checkNotNull(name, "name cannot be null");
- this.distribution = checkNotNull(distribution, "distribution cannot be null");
- return this;
- }
-
- public OperatingSystem build() {
- return new OperatingSystem(distribution, match(VERSION_PATTERN, name, 1), match(VERSION_PATTERN, name, 2));
- }
- }
-
- private static String match(final Pattern pattern, final String input, int group) {
- Matcher m = pattern.matcher(input);
- return m.matches() ? nullToEmpty(m.group(group)) : "";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (arch == null ? 0 : arch.hashCode());
- result = prime * result + (distribution == null ? 0 : distribution.hashCode());
- result = prime * result + (version == null ? 0 : version.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- OperatingSystem other = (OperatingSystem) obj;
- if (arch == null) {
- if (other.arch != null) {
- return false;
- }
- } else if (!arch.equals(other.arch)) {
- return false;
- }
- if (distribution != other.distribution) {
- return false;
- }
- if (version == null) {
- if (other.version != null) {
- return false;
- }
- } else if (!version.equals(other.version)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "OperatingSystem [distribution=" + distribution + ", version=" + version + ", arch=" + arch + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Region.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Region.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Region.java
deleted file mode 100644
index 60a374e..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Region.java
+++ /dev/null
@@ -1,98 +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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-/**
- * A Region.
- */
-public class Region {
-
- private final int id;
- private final String name;
- private final String slug;
-
- @ConstructorProperties({ "id", "name", "slug" })
- public Region(int id, String name, String slug) {
- this.id = id;
- this.name = checkNotNull(name, "name cannot be null");
- this.slug = checkNotNull(slug, "slug cannot be null");
- }
-
- public int getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getSlug() {
- return slug;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + id;
- result = prime * result + (name == null ? 0 : name.hashCode());
- result = prime * result + (slug == null ? 0 : slug.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Region other = (Region) obj;
- if (id != other.id) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (slug == null) {
- if (other.slug != null) {
- return false;
- }
- } else if (!slug.equals(other.slug)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "Region [id=" + id + ", name=" + name + ", slug=" + slug + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Size.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Size.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Size.java
deleted file mode 100644
index 6f4cf9a..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/Size.java
+++ /dev/null
@@ -1,161 +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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-/**
- * A Size.
- */
-public class Size {
-
- private final int id;
- private final String name;
- private final String slug;
- private final int memory;
- private final int cpu;
- private final int disk;
- @Named("cost_per_hour")
- private final String costPerHour;
- @Named("cost_per_month")
- private final String costPerMonth;
-
- @ConstructorProperties({ "id", "name", "slug", "memory", "cpu", "disk", "cost_per_hour", "cost_per_month" })
- public Size(int id, String name, String slug, int memory, int cpu, int disk, String costPerHour, String costPerMonth) {
- this.id = id;
- this.name = checkNotNull(name, "name cannot be null");
- this.slug = checkNotNull(slug, "slug");
- this.memory = memory;
- this.cpu = cpu;
- this.disk = disk;
- this.costPerHour = checkNotNull(costPerHour, "costPerHour cannot be null");
- this.costPerMonth = checkNotNull(costPerMonth, "costPerMonth cannot be null");
- }
-
- public int getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getSlug() {
- return slug;
- }
-
- public int getMemory() {
- return memory;
- }
-
- public int getCpu() {
- return cpu;
- }
-
- public int getDisk() {
- return disk;
- }
-
- public String getCostPerHour() {
- return costPerHour;
- }
-
- public String getCostPerMonth() {
- return costPerMonth;
- }
-
- @Override
- public int hashCode() {
- int prime = 31;
- int result = 1;
- result = prime * result + (costPerHour == null ? 0 : costPerHour.hashCode());
- result = prime * result + (costPerMonth == null ? 0 : costPerMonth.hashCode());
- result = prime * result + cpu;
- result = prime * result + disk;
- result = prime * result + id;
- result = prime * result + memory;
- result = prime * result + (name == null ? 0 : name.hashCode());
- result = prime * result + (slug == null ? 0 : slug.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Size other = (Size) obj;
- if (costPerHour == null) {
- if (other.costPerHour != null) {
- return false;
- }
- } else if (!costPerHour.equals(other.costPerHour)) {
- return false;
- }
- if (costPerMonth == null) {
- if (other.costPerMonth != null) {
- return false;
- }
- } else if (!costPerMonth.equals(other.costPerMonth)) {
- return false;
- }
- if (cpu != other.cpu) {
- return false;
- }
- if (disk != other.disk) {
- return false;
- }
- if (id != other.id) {
- return false;
- }
- if (memory != other.memory) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (slug == null) {
- if (other.slug != null) {
- return false;
- }
- } else if (!slug.equals(other.slug)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "Size [id=" + id + ", name=" + name + ", slug=" + slug + ", memory=" + memory + ", cpu=" + cpu + ", disk="
- + disk + ", costPerHour=" + costPerHour + ", costPerMonth=" + costPerMonth + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/SshKey.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/SshKey.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/SshKey.java
deleted file mode 100644
index d7b034f..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/SshKey.java
+++ /dev/null
@@ -1,96 +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.digitalocean.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.security.PublicKey;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.inject.name.Named;
-
-/**
- * A SSH Key.
- */
-public class SshKey {
-
- private final int id;
- private final String name;
- @Named("ssh_pub_key")
- private final PublicKey publicKey;
-
- @ConstructorProperties({ "id", "name", "ssh_pub_key" })
- public SshKey(int id, String name, @Nullable PublicKey publicKey) {
- this.id = id;
- this.name = checkNotNull(name, "name cannot be null");
- this.publicKey = publicKey;
- }
-
- public int getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public PublicKey getPublicKey() {
- return publicKey;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + id;
- result = prime * result + (name == null ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- SshKey other = (SshKey) obj;
- if (id != other.id) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "SshKey [id=" + id + ", name=" + name + ", publicKey=" + publicKey + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/domain/options/CreateDropletOptions.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/options/CreateDropletOptions.java b/digitalocean/src/main/java/org/jclouds/digitalocean/domain/options/CreateDropletOptions.java
deleted file mode 100644
index 18c573a..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/domain/options/CreateDropletOptions.java
+++ /dev/null
@@ -1,161 +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.digitalocean.domain.options;
-
-import java.util.Set;
-
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Options to customize droplet creation.
- */
-public class CreateDropletOptions extends BaseHttpRequestOptions {
-
- private final Set<Integer> sshKeyIds;
- private final Boolean privateNetworking;
- private final Boolean backupsEnabled;
-
- public CreateDropletOptions(Set<Integer> sshKeyIds, Boolean privateNetworking, Boolean backupsEnabled) {
- this.sshKeyIds = sshKeyIds;
- this.privateNetworking = privateNetworking;
- this.backupsEnabled = backupsEnabled;
-
- if (!sshKeyIds.isEmpty()) {
- queryParameters.put("ssh_key_ids", Joiner.on(',').join(sshKeyIds));
- }
- if (privateNetworking != null) {
- queryParameters.put("private_networking", privateNetworking.toString());
- }
- if (backupsEnabled != null) {
- queryParameters.put("backups_enabled", backupsEnabled.toString());
- }
- }
-
- public Iterable<Integer> getSshKeyIds() {
- return sshKeyIds;
- }
-
- public Boolean getPrivateNetworking() {
- return privateNetworking;
- }
-
- public Boolean getBackupsEnabled() {
- return backupsEnabled;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + (backupsEnabled == null ? 0 : backupsEnabled.hashCode());
- result = prime * result + (privateNetworking == null ? 0 : privateNetworking.hashCode());
- result = prime * result + (sshKeyIds == null ? 0 : sshKeyIds.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- CreateDropletOptions other = (CreateDropletOptions) obj;
- if (backupsEnabled == null) {
- if (other.backupsEnabled != null) {
- return false;
- }
- } else if (!backupsEnabled.equals(other.backupsEnabled)) {
- return false;
- }
- if (privateNetworking == null) {
- if (other.privateNetworking != null) {
- return false;
- }
- } else if (!privateNetworking.equals(other.privateNetworking)) {
- return false;
- }
- if (sshKeyIds == null) {
- if (other.sshKeyIds != null) {
- return false;
- }
- } else if (!sshKeyIds.equals(other.sshKeyIds)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "CreateDropletOptions [sshKeyIds=" + sshKeyIds + ", privateNetworking=" + privateNetworking
- + ", backupsEnabled=" + backupsEnabled + "]";
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private ImmutableSet.Builder<Integer> sshKeyIds = ImmutableSet.builder();
- private Boolean privateNetworking;
- private Boolean backupsEnabled;
-
- /**
- * Adds a set of ssh key ids to be added to the droplet.
- */
- public Builder addSshKeyIds(Iterable<Integer> sshKeyIds) {
- this.sshKeyIds.addAll(sshKeyIds);
- return this;
- }
-
- /**
- * Adds an ssh key id to be added to the droplet.
- */
- public Builder addSshKeyId(int sshKeyId) {
- this.sshKeyIds.add(sshKeyId);
- return this;
- }
-
- /**
- * Enables a private network interface if the region supports private
- * networking.
- */
- public Builder privateNetworking(boolean privateNetworking) {
- this.privateNetworking = privateNetworking;
- return this;
- }
-
- /**
- * Enabled backups for the droplet.
- */
- public Builder backupsEnabled(boolean backupsEnabled) {
- this.backupsEnabled = backupsEnabled;
- return this;
- }
-
- public CreateDropletOptions build() {
- return new CreateDropletOptions(sshKeyIds.build(), privateNetworking, backupsEnabled);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/features/DropletApi.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/features/DropletApi.java b/digitalocean/src/main/java/org/jclouds/digitalocean/features/DropletApi.java
deleted file mode 100644
index d471588..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/features/DropletApi.java
+++ /dev/null
@@ -1,327 +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.digitalocean.features;
-
-import java.io.Closeable;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.digitalocean.domain.Droplet;
-import org.jclouds.digitalocean.domain.DropletCreation;
-import org.jclouds.digitalocean.domain.options.CreateDropletOptions;
-import org.jclouds.digitalocean.http.filters.AuthenticationFilter;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.inject.name.Named;
-
-/**
- * Provides access to the Droplet management features.
- */
-@RequestFilters(AuthenticationFilter.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/droplets")
-public interface DropletApi extends Closeable {
-
- /**
- * Lists all existing droplets.
- *
- * @return The list of all existing droplets.
- */
- @Named("droplet:list")
- @GET
- @SelectJson("droplets")
- List<Droplet> list();
-
- /**
- * Gets the details of the given droplet.
- *
- * @param id The id of the droplet to get.
- * @return The details of the droplet or <code>null</code> if no droplet exists with the given id.
- */
- @Named("droplet:get")
- @GET
- @Path("/{id}")
- @SelectJson("droplet")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- Droplet get(@PathParam("id") int id);
-
- /**
- * Creates a new droplet.
- *
- * @param name The name for the new droplet.
- * @param imageId The id of the image to use to create the droplet.
- * @param sizeId The size to use to create the droplet.
- * @param regionId The region where the droplet must be created.
- * @return The created droplet.
- *
- * @see #create(String, String, String, String)
- */
- @Named("droplet:create")
- @GET
- @Path("/new")
- @SelectJson("droplet")
- DropletCreation create(@QueryParam("name") String name, @QueryParam("image_id") int imageId,
- @QueryParam("size_id") int sizeId, @QueryParam("region_id") int regionId);
-
- /**
- * Creates a new droplet.
- *
- * @param name The name for the new droplet.
- * @param imageId The id of the image to use to create the droplet.
- * @param sizeId The size to use to create the droplet.
- * @param regionId The region where the droplet must be created.
- * @param options Custom options to create the droplet.
- * @return The created droplet.
- *
- * @see #create(String, String, String, String, CreateDropletOptions)
- */
- @Named("droplet:create")
- @GET
- @Path("/new")
- @SelectJson("droplet")
- DropletCreation create(@QueryParam("name") String name, @QueryParam("image_id") int imageId,
- @QueryParam("size_id") int sizeId, @QueryParam("region_id") int regionId, CreateDropletOptions options);
-
- /**
- * Creates a new droplet.
- *
- * @param name The name for the new droplet.
- * @param imageSlug The slug of the image to use to create the droplet.
- * @param sizeSlug The slug of the size to use to create the droplet.
- * @param regionSlug The slug region where the droplet must be created.
- * @return The created droplet.
- *
- * @see #create(String, int, int, int)
- */
- @Named("droplet:create")
- @GET
- @Path("/new")
- @SelectJson("droplet")
- DropletCreation create(@QueryParam("name") String name, @QueryParam("image_slug") String imageSlug,
- @QueryParam("size_slug") String sizeSlug, @QueryParam("region_slug") String regionSlug);
-
- /**
- * Creates a new droplet.
- *
- * @param name The name for the new droplet.
- * @param imageSlug The slug of the image to use to create the droplet.
- * @param sizeSlug The slug of the size to use to create the droplet.
- * @param regionSlug The slug region where the droplet must be created.
- * @param options Custom options to create the droplet.
- * @return The created droplet.
- *
- * @see #create(String, int, int, int, CreateDropletOptions)
- */
- @Named("droplet:create")
- @GET
- @Path("/new")
- @SelectJson("droplet")
- DropletCreation create(@QueryParam("name") String name, @QueryParam("image_slug") String imageSlug,
- @QueryParam("size_slug") String sizeSlug, @QueryParam("region_slug") String regionSlug,
- CreateDropletOptions options);
-
- /**
- * Reboots the given droplet.
- *
- * @param id The id of the droplet to reboot.
- * @return The id of the event to track the reboot process.
- */
- @Named("droplet:reboot")
- @GET
- @Path("/{id}/reboot")
- @SelectJson("event_id")
- int reboot(@PathParam("id") int id);
-
- /**
- * Power cycles the given droplet.
- *
- * @param id The id of the droplet to power cycle.
- * @return The id of the event to track the power cycle process.
- */
- @Named("droplet:powercycle")
- @GET
- @Path("/{id}/power_cycle")
- @SelectJson("event_id")
- int powerCycle(@PathParam("id") int id);
-
- /**
- * Shuts down the given droplet.
- *
- * @param id The id of the droplet to shutdown.
- * @return The id of the event to track the shutdown process.
- */
- @Named("droplet:shutdown")
- @GET
- @Path("/{id}/shutdown")
- @SelectJson("event_id")
- int shutdown(@PathParam("id") int id);
-
- /**
- * Powers off the given droplet.
- *
- * @param id The id of the droplet to power off.
- * @return The id of the event to track the power off process.
- */
- @Named("droplet:poweroff")
- @GET
- @Path("/{id}/power_off")
- @SelectJson("event_id")
- int powerOff(@PathParam("id") int id);
-
- /**
- * Powers on the given droplet.
- *
- * @param id The id of the droplet to power on.
- * @return The id of the event to track the power on process.
- */
- @Named("droplet:poweron")
- @GET
- @Path("/{id}/power_on")
- @SelectJson("event_id")
- int powerOn(@PathParam("id") int id);
-
- /**
- * Resets the password for the given droplet.
- *
- * @param id The id of the droplet to reset the password to.
- * @return The id of the event to track the password reset process.
- */
- @Named("droplet:resetpassword")
- @GET
- @Path("/{id}/password_reset")
- @SelectJson("event_id")
- int resetPassword(@PathParam("id") int id);
-
- /**
- * Changes the size for the given droplet.
- *
- * @param id The id of the droplet to change the size to.
- * @param sizeId The id of the new size for the droplet.
- * @return The id of the event to track the resize process.
- */
- @Named("droplet:resize")
- @GET
- @Path("/{id}/resize")
- @SelectJson("event_id")
- int resize(@PathParam("id") int id, @QueryParam("size_id") int sizeId);
-
- /**
- * Takes a snapshot of the droplet once it has been powered off.
- *
- * @param id The id of the droplet to take the snapshot of.
- * @return The id of the event to track the snapshot process.
- */
- @Named("droplet:snapshot")
- @GET
- @Path("/{id}/snapshot")
- @SelectJson("event_id")
- int snapshot(@PathParam("id") int id);
-
- /**
- * Takes a snapshot of the droplet once it has been powered off.
- *
- * @param id The id of the droplet to take the snapshot of.
- * @param name The name for the snapshot.
- * @return The id of the event to track the snapshot process.
- */
- @Named("droplet:snapshot")
- @GET
- @Path("/{id}/snapshot")
- @SelectJson("event_id")
- int snapshot(@PathParam("id") int id, @QueryParam("name") String name);
-
- /**
- * Restores a droplet with a previous image or snapshot.
- * <p>
- * This will be a mirror copy of the image or snapshot to your droplet. Be sure you have backed up any necessary
- * information prior to restore.
- *
- * @param id The id of the droplet to restore.
- * @param imageId The id of the image or snapshot to use to restore the droplet.
- * @return The id of the event to track the restore process.
- */
- @Named("droplet:restore")
- @GET
- @Path("/{id}/restore")
- @SelectJson("event_id")
- int restore(@PathParam("id") int id, @QueryParam("image_id") int imageId);
-
- /**
- * Rebuilds a droplet with a default image.
- * <p>
- * This is useful if you want to start again but retain the same IP address for your droplet.
- *
- * @param id The id of the droplet to rebuild.
- * @param imageId The id of the image or snapshot to use to restore the droplet.
- * @return The id of the event to track the restore process.
- */
- @Named("droplet:rebuild")
- @GET
- @Path("/{id}/rebuild")
- @SelectJson("event_id")
- int rebuild(@PathParam("id") int id, @QueryParam("image_id") int imageId);
-
- /**
- * Renames a droplet to the specified name.
- *
- * @param id The id of the droplet to rename.
- * @param name The new name for the droplet.
- * @return The id of the event to track the rename process.
- */
- @Named("droplet:rename")
- @GET
- @Path("/{id}/rename")
- @SelectJson("event_id")
- int rename(@PathParam("id") int id, @QueryParam("name") String name);
-
- /**
- * Destroys the given droplet.
- *
- * @param id The id of the droplet to destroy.
- * @return The id of the event to track the destroy process.
- */
- @Named("droplet:destroy")
- @GET
- @Path("/{id}/destroy")
- @SelectJson("event_id")
- int destroy(@PathParam("id") int id);
-
- /**
- * Destroys the given droplet.
- *
- * @param id The id of the droplet to destroy.
- * @param scrubData If true this will strictly write 0s to your prior partition to ensure that all data is completely
- * erased.
- * @return The id of the event to track the destroy process.
- */
- @Named("droplet:destroy")
- @GET
- @Path("/{id}/destroy")
- @SelectJson("event_id")
- int destroy(@PathParam("id") int id, @QueryParam("scrub_data") boolean scrubData);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/features/EventApi.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/features/EventApi.java b/digitalocean/src/main/java/org/jclouds/digitalocean/features/EventApi.java
deleted file mode 100644
index 518cfe3..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/features/EventApi.java
+++ /dev/null
@@ -1,58 +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.digitalocean.features;
-
-import java.io.Closeable;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.digitalocean.domain.Event;
-import org.jclouds.digitalocean.http.filters.AuthenticationFilter;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.inject.name.Named;
-
-/**
- * Provides access to the Event API.
- */
-@RequestFilters(AuthenticationFilter.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/events")
-public interface EventApi extends Closeable {
-
- /**
- * Gets the details of a given event.
- *
- * @param The id of the event to get.
- * @return The details of the event or <code>null</code> if no event exists with the given id.
- */
- @Named("event:get")
- @GET
- @Path("/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- @SelectJson("event")
- @Nullable
- Event get(@PathParam("id") int id);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/features/ImageApi.java b/digitalocean/src/main/java/org/jclouds/digitalocean/features/ImageApi.java
deleted file mode 100644
index 8ae9abc..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/features/ImageApi.java
+++ /dev/null
@@ -1,140 +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.digitalocean.features;
-
-import java.io.Closeable;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.digitalocean.domain.Image;
-import org.jclouds.digitalocean.http.filters.AuthenticationFilter;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.inject.name.Named;
-
-/**
- * Provides access to the Image management features.
- */
-@RequestFilters(AuthenticationFilter.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/images")
-public interface ImageApi extends Closeable {
-
- /**
- * Lists all available images.
- *
- * @return The list of all available images.
- */
- @Named("image:list")
- @GET
- @SelectJson("images")
- List<Image> list();
-
- /**
- * Gets the details of the given image.
- * <p>
- * Note that Image IDs can change. The recommended way to get an image is using the {@link #get(String)} method.
- *
- * @param id The id of the image to get.
- * @return The details of the image or <code>null</code> if no image exists with the given id.
- *
- * @see #get(String)
- */
- @Named("image:get")
- @GET
- @Path("/{id}")
- @SelectJson("image")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- Image get(@PathParam("id") int id);
-
- /**
- * Gets the details of the given image.
- *
- * @param slug The slug of the image to get.
- * @return The details of the image or <code>null</code> if no image exists with the given slug.
- *
- * @see #get(int)
- */
- @Named("image:get")
- @GET
- @Path("/{slug}")
- @SelectJson("image")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- Image get(@PathParam("slug") String slug);
-
- /**
- * Deletes an existing image.
- *
- * @param id The id of the key pair.
- */
- @Named("image:delete")
- @GET
- @Path("/{id}/destroy")
- void delete(@PathParam("id") int id);
-
- /**
- * Deletes an existing image.
- *
- * @param slug The slug of the key pair.
- */
- @Named("image:delete")
- @GET
- @Path("/{slug}/destroy")
- void delete(@PathParam("slug") String slug);
-
- /**
- * Transfers the image to the given region.
- *
- * @param id The id of the image to transfer.
- * @param regionId The id of the region to which the image will be transferred.
- * @return The id of the event to track the transfer process.
- *
- * @see #transfer(String, int)
- */
- @Named("image:transfer")
- @GET
- @Path("/{id}/transfer")
- @SelectJson("event_id")
- int transfer(@PathParam("id") int id, @QueryParam("region_id") int regionId);
-
- /**
- * Transfers the image to the given region.
- *
- * @param slug The slug of the image to transfer.
- * @param regionId The id of the region to which the image will be transferred.
- * @return The id of the event to track the transfer process.
- *
- * @see #transfer(int, int)
- */
- @Named("image:transfer")
- @GET
- @Path("/{slug}/transfer")
- @SelectJson("event_id")
- int transfer(@PathParam("slug") String slug, @QueryParam("region_id") int regionId);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/features/KeyPairApi.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/features/KeyPairApi.java b/digitalocean/src/main/java/org/jclouds/digitalocean/features/KeyPairApi.java
deleted file mode 100644
index 629a179..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/features/KeyPairApi.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.digitalocean.features;
-
-import java.io.Closeable;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.digitalocean.domain.SshKey;
-import org.jclouds.digitalocean.http.filters.AuthenticationFilter;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.inject.name.Named;
-
-/**
- * Provides access to the SSH key pair management features.
- */
-@RequestFilters(AuthenticationFilter.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/ssh_keys")
-public interface KeyPairApi extends Closeable {
-
- /**
- * Lists all existing SSH key pairs.
- *
- * @return The list of all existing SSH key pairs.
- */
- @Named("key:list")
- @GET
- @SelectJson("ssh_keys")
- List<SshKey> list();
-
- /**
- * Gets the details of an existing SSH key pair.
- *
- * @param id The id of the SSH key pair.
- * @return The details of the SSH key pair or <code>null</code> if no key exists with the given id.
- */
- @Named("key:get")
- @GET
- @Path("/{id}")
- @SelectJson("ssh_key")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- SshKey get(@PathParam("id") int id);
-
- /**
- * Creates a new SSH key pair.
- *
- * @param name The name of the key pair.
- * @param publicKey The public key.
- * @return The details of the created key pair.
- */
- @Named("key:create")
- @GET
- @Path("/new")
- @SelectJson("ssh_key")
- SshKey create(@QueryParam("name") String name, @QueryParam("ssh_pub_key") String publicKey);
-
- /**
- * Changes the SSH key for the given key pair.
- *
- * @param id The id of the key pair.
- * @param newPublicKey The new public key.
- * @return The details of the modified key pair.
- */
- @Named("key:edit")
- @GET
- @Path("/{id}/edit")
- @SelectJson("ssh_key")
- SshKey edit(@PathParam("id") int id, @QueryParam("ssh_pub_key") String newPublicKey);
-
- /**
- * Deletes an existing SSH key pair.
- *
- * @param id The id of the key pair.
- */
- @Named("key:delete")
- @GET
- @Path("/{id}/destroy")
- void delete(@PathParam("id") int id);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/features/RegionApi.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/features/RegionApi.java b/digitalocean/src/main/java/org/jclouds/digitalocean/features/RegionApi.java
deleted file mode 100644
index 9fc6d94..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/features/RegionApi.java
+++ /dev/null
@@ -1,51 +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.digitalocean.features;
-
-import java.io.Closeable;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.digitalocean.domain.Region;
-import org.jclouds.digitalocean.http.filters.AuthenticationFilter;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.inject.name.Named;
-
-/**
- * Provides access to the Region management features.
- */
-@RequestFilters(AuthenticationFilter.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/regions")
-public interface RegionApi extends Closeable {
-
- /**
- * Lists all available regions.
- *
- * @return The list of all available regions.
- */
- @Named("region:list")
- @GET
- @SelectJson("regions")
- List<Region> list();
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/114b3528/digitalocean/src/main/java/org/jclouds/digitalocean/features/SizesApi.java
----------------------------------------------------------------------
diff --git a/digitalocean/src/main/java/org/jclouds/digitalocean/features/SizesApi.java b/digitalocean/src/main/java/org/jclouds/digitalocean/features/SizesApi.java
deleted file mode 100644
index 433523e..0000000
--- a/digitalocean/src/main/java/org/jclouds/digitalocean/features/SizesApi.java
+++ /dev/null
@@ -1,51 +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.digitalocean.features;
-
-import java.io.Closeable;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.digitalocean.domain.Size;
-import org.jclouds.digitalocean.http.filters.AuthenticationFilter;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.inject.name.Named;
-
-/**
- * Provides access to the Size management features.
- */
-@RequestFilters(AuthenticationFilter.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/sizes")
-public interface SizesApi extends Closeable {
-
- /**
- * Lists all available sizes.
- *
- * @return The list of all available sizes.
- */
- @Named("size:list")
- @GET
- @SelectJson("sizes")
- List<Size> list();
-}