mirror of https://github.com/apache/jclouds.git
Issue 1014:rename joyent-sdc to joyent-cloudapi
This commit is contained in:
parent
8e88c53a3a
commit
df2b88402c
|
@ -28,18 +28,18 @@
|
||||||
<relativePath>../../project/pom.xml</relativePath>
|
<relativePath>../../project/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.jclouds.labs</groupId>
|
<groupId>org.jclouds.labs</groupId>
|
||||||
<artifactId>joyent-sdc</artifactId>
|
<artifactId>joyent-cloudapi</artifactId>
|
||||||
<name>jcloud joyent-sdc api</name>
|
<name>jcloud joyent-cloudapi api</name>
|
||||||
<description>jclouds components to access an implementation of Joyent SDC</description>
|
<description>jclouds components to access an implementation of Joyent SDC</description>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<test.joyent-sdc.endpoint>https://api.joyentcloud.com</test.joyent-sdc.endpoint>
|
<test.joyent-cloudapi.endpoint>https://api.joyentcloud.com</test.joyent-cloudapi.endpoint>
|
||||||
<test.joyent-sdc.api-version>~6.5</test.joyent-sdc.api-version>
|
<test.joyent-cloudapi.api-version>~6.5</test.joyent-cloudapi.api-version>
|
||||||
<test.joyent-sdc.build-version></test.joyent-sdc.build-version>
|
<test.joyent-cloudapi.build-version></test.joyent-cloudapi.build-version>
|
||||||
<test.joyent-sdc.identity>FIXME_IDENTITY</test.joyent-sdc.identity>
|
<test.joyent-cloudapi.identity>FIXME_IDENTITY</test.joyent-cloudapi.identity>
|
||||||
<test.joyent-sdc.credential>FIXME_CREDENTIALS</test.joyent-sdc.credential>
|
<test.joyent-cloudapi.credential>FIXME_CREDENTIALS</test.joyent-cloudapi.credential>
|
||||||
<jclouds.osgi.export>org.jclouds.joyent.sdc.v6_5*;version="${project.version}"</jclouds.osgi.export>
|
<jclouds.osgi.export>org.jclouds.joyent.cloudapi.v6_5*;version="${project.version}"</jclouds.osgi.export>
|
||||||
<jclouds.osgi.import>
|
<jclouds.osgi.import>
|
||||||
org.jclouds.rest.internal;version="${project.version}",
|
org.jclouds.rest.internal;version="${project.version}",
|
||||||
org.jclouds*;version="${project.version}",
|
org.jclouds*;version="${project.version}",
|
||||||
|
@ -104,11 +104,11 @@
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<test.joyent-sdc.endpoint>${test.joyent-sdc.endpoint}</test.joyent-sdc.endpoint>
|
<test.joyent-cloudapi.endpoint>${test.joyent-cloudapi.endpoint}</test.joyent-cloudapi.endpoint>
|
||||||
<test.joyent-sdc.api-version>${test.joyent-sdc.api-version}</test.joyent-sdc.api-version>
|
<test.joyent-cloudapi.api-version>${test.joyent-cloudapi.api-version}</test.joyent-cloudapi.api-version>
|
||||||
<test.joyent-sdc.build-version>${test.joyent-sdc.build-version}</test.joyent-sdc.build-version>
|
<test.joyent-cloudapi.build-version>${test.joyent-cloudapi.build-version}</test.joyent-cloudapi.build-version>
|
||||||
<test.joyent-sdc.identity>${test.joyent-sdc.identity}</test.joyent-sdc.identity>
|
<test.joyent-cloudapi.identity>${test.joyent-cloudapi.identity}</test.joyent-cloudapi.identity>
|
||||||
<test.joyent-sdc.credential>${test.joyent-sdc.credential}</test.joyent-sdc.credential>
|
<test.joyent-cloudapi.credential>${test.joyent-cloudapi.credential}</test.joyent-cloudapi.credential>
|
||||||
</systemPropertyVariables>
|
</systemPropertyVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
|
@ -16,17 +16,17 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5;
|
package org.jclouds.joyent.cloudapi.v6_5;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.ApiMetadata;
|
import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.config.SDCComputeServiceContextModule;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.config.JoyentCloudComputeServiceContextModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.DatacentersAreZonesModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.DatacentersAreZonesModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCProperties;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudProperties;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCRestClientModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudRestClientModule;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
|
@ -35,16 +35,16 @@ import com.google.common.reflect.TypeToken;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link ApiMetadata} for SDC ~6.5 API
|
* Implementation of {@link ApiMetadata} for JoyentCloud ~6.5 API
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SDCApiMetadata extends BaseRestApiMetadata {
|
public class JoyentCloudApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
/** The serialVersionUID */
|
/** The serialVersionUID */
|
||||||
private static final long serialVersionUID = 6725672099385580694L;
|
private static final long serialVersionUID = 6725672099385580694L;
|
||||||
|
|
||||||
public static final TypeToken<RestContext<SDCClient, SDCAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<SDCClient, SDCAsyncClient>>() {
|
public static final TypeToken<RestContext<JoyentCloudClient, JoyentCloudAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<JoyentCloudClient, JoyentCloudAsyncClient>>() {
|
||||||
private static final long serialVersionUID = -5070937833892503232L;
|
private static final long serialVersionUID = -5070937833892503232L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,39 +53,39 @@ public class SDCApiMetadata extends BaseRestApiMetadata {
|
||||||
return new Builder().fromApiMetadata(this);
|
return new Builder().fromApiMetadata(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SDCApiMetadata() {
|
public JoyentCloudApiMetadata() {
|
||||||
this(new Builder());
|
this(new Builder());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SDCApiMetadata(Builder builder) {
|
protected JoyentCloudApiMetadata(Builder builder) {
|
||||||
super(builder);
|
super(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Properties defaultProperties() {
|
public static Properties defaultProperties() {
|
||||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||||
properties.setProperty(SDCProperties.AUTOGENERATE_KEYS, "true");
|
properties.setProperty(JoyentCloudProperties.AUTOGENERATE_KEYS, "true");
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder {
|
public static class Builder extends BaseRestApiMetadata.Builder {
|
||||||
|
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(SDCClient.class, SDCAsyncClient.class);
|
super(JoyentCloudClient.class, JoyentCloudAsyncClient.class);
|
||||||
id("joyent-sdc")
|
id("joyent-cloudapi")
|
||||||
.name("Joyent SDC API")
|
.name("Joyent Cloud API")
|
||||||
.identityName("username")
|
.identityName("username")
|
||||||
.credentialName("password")
|
.credentialName("password")
|
||||||
.documentation(URI.create("http://sdc.joyent.org/sdcapi.html"))
|
.documentation(URI.create("http://cloudApi.joyent.org/cloudApiapi.html"))
|
||||||
.version("~6.5")
|
.version("~6.5")
|
||||||
.defaultEndpoint("https://api.joyentcloud.com")
|
.defaultEndpoint("https://api.joyentcloud.com")
|
||||||
.defaultProperties(SDCApiMetadata.defaultProperties())
|
.defaultProperties(JoyentCloudApiMetadata.defaultProperties())
|
||||||
.view(TypeToken.of(ComputeServiceContext.class))
|
.view(TypeToken.of(ComputeServiceContext.class))
|
||||||
.defaultModules(ImmutableSet.<Class<? extends Module>> of(DatacentersAreZonesModule.class, SDCRestClientModule.class, SDCComputeServiceContextModule.class));
|
.defaultModules(ImmutableSet.<Class<? extends Module>> of(DatacentersAreZonesModule.class, JoyentCloudRestClientModule.class, JoyentCloudComputeServiceContextModule.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SDCApiMetadata build() {
|
public JoyentCloudApiMetadata build() {
|
||||||
return new SDCApiMetadata(this);
|
return new JoyentCloudApiMetadata(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -16,16 +16,16 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5;
|
package org.jclouds.joyent.cloudapi.v6_5;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.KeyAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.KeyAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.MachineAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.MachineAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.PackageAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.PackageAsyncClient;
|
||||||
import org.jclouds.location.Zone;
|
import org.jclouds.location.Zone;
|
||||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
|
@ -34,14 +34,14 @@ import org.jclouds.rest.annotations.EndpointParam;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to SDC via their REST API.
|
* Provides asynchronous access to JoyentCloud via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see SDCClient
|
* @see JoyentCloudClient
|
||||||
* @see <a href="http://sdc.joyent.org/sdcapi.html">api doc</a>
|
* @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface SDCAsyncClient {
|
public interface JoyentCloudAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
|
@ -16,18 +16,18 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5;
|
package org.jclouds.joyent.cloudapi.v6_5;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.MachineClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.MachineClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.PackageClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.PackageClient;
|
||||||
import org.jclouds.location.Zone;
|
import org.jclouds.location.Zone;
|
||||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
|
@ -36,15 +36,15 @@ import org.jclouds.rest.annotations.EndpointParam;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to SDC.
|
* Provides synchronous access to JoyentCloud.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see SDCAsyncClient
|
* @see JoyentCloudAsyncClient
|
||||||
* @see <a href="http://sdc.joyent.org/sdcapi.html">api doc</a>
|
* @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface SDCClient {
|
public interface JoyentCloudClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.binders;
|
package org.jclouds.joyent.cloudapi.v6_5.binders;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.json.Json;
|
import org.jclouds.json.Json;
|
||||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute;
|
package org.jclouds.joyent.cloudapi.v6_5.compute;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
|
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
|
||||||
|
@ -58,13 +58,13 @@ import org.jclouds.compute.strategy.ResumeNodeStrategy;
|
||||||
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.predicates.KeyPredicates;
|
import org.jclouds.joyent.cloudapi.v6_5.predicates.KeyPredicates;
|
||||||
import org.jclouds.scriptbuilder.functions.InitAdminAccess;
|
import org.jclouds.scriptbuilder.functions.InitAdminAccess;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -80,14 +80,14 @@ import com.google.common.collect.Multimap;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SDCComputeService extends BaseComputeService {
|
public class JoyentCloudComputeService extends BaseComputeService {
|
||||||
protected final SDCClient novaClient;
|
protected final JoyentCloudClient novaClient;
|
||||||
protected final LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache;
|
protected final LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache;
|
||||||
protected final Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByDatacenterId;
|
protected final Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByDatacenterId;
|
||||||
protected final GroupNamingConvention.Factory namingConvention;
|
protected final GroupNamingConvention.Factory namingConvention;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected SDCComputeService(ComputeServiceContext context, Map<String, Credentials> credentialStore,
|
protected JoyentCloudComputeService(ComputeServiceContext context, Map<String, Credentials> credentialStore,
|
||||||
@Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes,
|
@Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes,
|
||||||
@Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy,
|
@Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy,
|
||||||
GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
|
GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
|
||||||
|
@ -101,7 +101,7 @@ public class SDCComputeService extends BaseComputeService {
|
||||||
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
|
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
|
||||||
RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
|
RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
|
||||||
PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
|
PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, SDCClient novaClient,
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, JoyentCloudClient novaClient,
|
||||||
LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache,
|
LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache,
|
||||||
Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByDatacenterId,
|
Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByDatacenterId,
|
||||||
GroupNamingConvention.Factory namingConvention, Optional<ImageExtension> imageExtension) {
|
GroupNamingConvention.Factory namingConvention, Optional<ImageExtension> imageExtension) {
|
||||||
|
@ -143,11 +143,11 @@ public class SDCComputeService extends BaseComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns template options, except of type {@link SDCTemplateOptions}.
|
* returns template options, except of type {@link JoyentCloudTemplateOptions}.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SDCTemplateOptions templateOptions() {
|
public JoyentCloudTemplateOptions templateOptions() {
|
||||||
return SDCTemplateOptions.class.cast(super.templateOptions());
|
return JoyentCloudTemplateOptions.class.cast(super.templateOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute;
|
package org.jclouds.joyent.cloudapi.v6_5.compute;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.transform;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
|
@ -33,14 +33,14 @@ import org.jclouds.compute.domain.Template;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndId;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndId;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||||
import org.jclouds.location.Zone;
|
import org.jclouds.location.Zone;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
|
@ -50,24 +50,24 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSet.Builder;
|
import com.google.common.collect.ImmutableSet.Builder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The adapter used by the SDCComputeServiceContextModule to interface the
|
* The adapter used by the JoyentCloudComputeServiceContextModule to interface the
|
||||||
* SDC-specific domain model to the computeService generic domain model.
|
* JoyentCloud-specific domain model to the computeService generic domain model.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SDCComputeServiceAdapter implements
|
public class JoyentCloudComputeServiceAdapter implements
|
||||||
ComputeServiceAdapter<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location> {
|
ComputeServiceAdapter<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location> {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
protected final SDCClient sdcClient;
|
protected final JoyentCloudClient cloudApiClient;
|
||||||
protected final Supplier<Set<String>> datacenterIds;
|
protected final Supplier<Set<String>> datacenterIds;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SDCComputeServiceAdapter(SDCClient sdcClient, @Zone Supplier<Set<String>> datacenterIds) {
|
public JoyentCloudComputeServiceAdapter(JoyentCloudClient cloudApiClient, @Zone Supplier<Set<String>> datacenterIds) {
|
||||||
this.sdcClient = checkNotNull(sdcClient, "sdcClient");
|
this.cloudApiClient = checkNotNull(cloudApiClient, "cloudApiClient");
|
||||||
this.datacenterIds = checkNotNull(datacenterIds, "datacenterIds");
|
this.datacenterIds = checkNotNull(datacenterIds, "datacenterIds");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class SDCComputeServiceAdapter implements
|
||||||
|
|
||||||
logger.debug(">> creating new machine datacenter(%s) datasetURN(%s) options(%s)", datacenterId, datasetURN,
|
logger.debug(">> creating new machine datacenter(%s) datasetURN(%s) options(%s)", datacenterId, datasetURN,
|
||||||
options);
|
options);
|
||||||
Machine machine = sdcClient.getMachineClientForDatacenter(datacenterId).createWithDataset(datasetURN, options);
|
Machine machine = cloudApiClient.getMachineClientForDatacenter(datacenterId).createWithDataset(datasetURN, options);
|
||||||
|
|
||||||
logger.trace("<< machine(%s)", machine.getId());
|
logger.trace("<< machine(%s)", machine.getId());
|
||||||
|
|
||||||
|
@ -105,11 +105,11 @@ public class SDCComputeServiceAdapter implements
|
||||||
public Iterable<PackageInDatacenter> listHardwareProfiles() {
|
public Iterable<PackageInDatacenter> listHardwareProfiles() {
|
||||||
Builder<PackageInDatacenter> builder = ImmutableSet.builder();
|
Builder<PackageInDatacenter> builder = ImmutableSet.builder();
|
||||||
for (final String datacenterId : datacenterIds.get()) {
|
for (final String datacenterId : datacenterIds.get()) {
|
||||||
builder.addAll(transform(sdcClient.getPackageClientForDatacenter(datacenterId).list(),
|
builder.addAll(transform(cloudApiClient.getPackageClientForDatacenter(datacenterId).list(),
|
||||||
new Function<org.jclouds.joyent.sdc.v6_5.domain.Package, PackageInDatacenter>() {
|
new Function<org.jclouds.joyent.cloudapi.v6_5.domain.Package, PackageInDatacenter>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PackageInDatacenter apply(org.jclouds.joyent.sdc.v6_5.domain.Package arg0) {
|
public PackageInDatacenter apply(org.jclouds.joyent.cloudapi.v6_5.domain.Package arg0) {
|
||||||
return new PackageInDatacenter(arg0, datacenterId);
|
return new PackageInDatacenter(arg0, datacenterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public class SDCComputeServiceAdapter implements
|
||||||
public Iterable<DatasetInDatacenter> listImages() {
|
public Iterable<DatasetInDatacenter> listImages() {
|
||||||
Builder<DatasetInDatacenter> builder = ImmutableSet.builder();
|
Builder<DatasetInDatacenter> builder = ImmutableSet.builder();
|
||||||
for (final String datacenterId : datacenterIds.get()) {
|
for (final String datacenterId : datacenterIds.get()) {
|
||||||
builder.addAll(transform(sdcClient.getDatasetClientForDatacenter(datacenterId).list(),
|
builder.addAll(transform(cloudApiClient.getDatasetClientForDatacenter(datacenterId).list(),
|
||||||
new Function<Dataset, DatasetInDatacenter>() {
|
new Function<Dataset, DatasetInDatacenter>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,7 +139,7 @@ public class SDCComputeServiceAdapter implements
|
||||||
public Iterable<MachineInDatacenter> listNodes() {
|
public Iterable<MachineInDatacenter> listNodes() {
|
||||||
Builder<MachineInDatacenter> builder = ImmutableSet.builder();
|
Builder<MachineInDatacenter> builder = ImmutableSet.builder();
|
||||||
for (final String datacenterId : datacenterIds.get()) {
|
for (final String datacenterId : datacenterIds.get()) {
|
||||||
builder.addAll(transform(sdcClient.getMachineClientForDatacenter(datacenterId).list(),
|
builder.addAll(transform(cloudApiClient.getMachineClientForDatacenter(datacenterId).list(),
|
||||||
new Function<Machine, MachineInDatacenter>() {
|
new Function<Machine, MachineInDatacenter>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -161,7 +161,7 @@ public class SDCComputeServiceAdapter implements
|
||||||
@Override
|
@Override
|
||||||
public MachineInDatacenter getNode(String id) {
|
public MachineInDatacenter getNode(String id) {
|
||||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||||
Machine machine = sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
Machine machine = cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
||||||
datacenterAndId.getId());
|
datacenterAndId.getId());
|
||||||
return machine == null ? null : new MachineInDatacenter(machine, datacenterAndId.getDatacenter());
|
return machine == null ? null : new MachineInDatacenter(machine, datacenterAndId.getDatacenter());
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public class SDCComputeServiceAdapter implements
|
||||||
@Override
|
@Override
|
||||||
public DatasetInDatacenter getImage(String id) {
|
public DatasetInDatacenter getImage(String id) {
|
||||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||||
Dataset dataset = sdcClient.getDatasetClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
Dataset dataset = cloudApiClient.getDatasetClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
||||||
datacenterAndId.getId());
|
datacenterAndId.getId());
|
||||||
return dataset == null ? null : new DatasetInDatacenter(dataset, datacenterAndId.getDatacenter());
|
return dataset == null ? null : new DatasetInDatacenter(dataset, datacenterAndId.getDatacenter());
|
||||||
}
|
}
|
||||||
|
@ -177,26 +177,26 @@ public class SDCComputeServiceAdapter implements
|
||||||
@Override
|
@Override
|
||||||
public void destroyNode(String id) {
|
public void destroyNode(String id) {
|
||||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||||
sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).delete(datacenterAndId.getId());
|
cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).delete(datacenterAndId.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rebootNode(String id) {
|
public void rebootNode(String id) {
|
||||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||||
sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).reboot(datacenterAndId.getId());
|
cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).reboot(datacenterAndId.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resumeNode(String id) {
|
public void resumeNode(String id) {
|
||||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||||
sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).stop(datacenterAndId.getId());
|
cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).stop(datacenterAndId.getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void suspendNode(String id) {
|
public void suspendNode(String id) {
|
||||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||||
sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).start(datacenterAndId.getId());
|
cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).start(datacenterAndId.getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.config;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.config;
|
||||||
|
|
||||||
import static org.jclouds.joyent.sdc.v6_5.config.SDCProperties.AUTOGENERATE_KEYS;
|
import static org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudProperties.AUTOGENERATE_KEYS;
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -38,23 +38,23 @@ import org.jclouds.compute.options.TemplateOptions;
|
||||||
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.functions.IdentityFunction;
|
import org.jclouds.functions.IdentityFunction;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.SDCComputeService;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.JoyentCloudComputeService;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.SDCComputeServiceAdapter;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.JoyentCloudComputeServiceAdapter;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.DatasetInDatacenterToImage;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetInDatacenterToImage;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.DatasetToOperatingSystem;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetToOperatingSystem;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.OrphanedGroupsByDatacenterId;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.OrphanedGroupsByDatacenterId;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.PackageInDatacenterToHardware;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.PackageInDatacenterToHardware;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.loaders.CreateUniqueKey;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.loaders.CreateUniqueKey;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.strategy.ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.strategy.ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||||
import org.jclouds.util.Iterables2;
|
import org.jclouds.util.Iterables2;
|
||||||
import org.jclouds.util.Suppliers2;
|
import org.jclouds.util.Suppliers2;
|
||||||
|
|
||||||
|
@ -73,11 +73,11 @@ import com.google.inject.TypeLiteral;
|
||||||
import com.google.inject.name.Names;
|
import com.google.inject.name.Names;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module for building a compute service context for SDC
|
* Module for building a compute service context for Cloud Api
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SDCComputeServiceContextModule extends
|
public class JoyentCloudComputeServiceContextModule extends
|
||||||
ComputeServiceAdapterContextModule<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location> {
|
ComputeServiceAdapterContextModule<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location> {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -86,7 +86,7 @@ public class SDCComputeServiceContextModule extends
|
||||||
super.configure();
|
super.configure();
|
||||||
bind(
|
bind(
|
||||||
new TypeLiteral<ComputeServiceAdapter<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location>>() {
|
new TypeLiteral<ComputeServiceAdapter<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location>>() {
|
||||||
}).to(SDCComputeServiceAdapter.class);
|
}).to(JoyentCloudComputeServiceAdapter.class);
|
||||||
|
|
||||||
bind(new TypeLiteral<Function<MachineInDatacenter, NodeMetadata>>() {
|
bind(new TypeLiteral<Function<MachineInDatacenter, NodeMetadata>>() {
|
||||||
}).to(MachineInDatacenterToNodeMetadata.class);
|
}).to(MachineInDatacenterToNodeMetadata.class);
|
||||||
|
@ -107,11 +107,11 @@ public class SDCComputeServiceContextModule extends
|
||||||
bind(new TypeLiteral<Function<Set<? extends NodeMetadata>, Multimap<String, String>>>() {
|
bind(new TypeLiteral<Function<Set<? extends NodeMetadata>, Multimap<String, String>>>() {
|
||||||
}).to(OrphanedGroupsByDatacenterId.class);
|
}).to(OrphanedGroupsByDatacenterId.class);
|
||||||
|
|
||||||
bind(ComputeService.class).to(SDCComputeService.class);
|
bind(ComputeService.class).to(JoyentCloudComputeService.class);
|
||||||
bind(TemplateOptions.class).to(SDCTemplateOptions.class);
|
bind(TemplateOptions.class).to(JoyentCloudTemplateOptions.class);
|
||||||
|
|
||||||
bind(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class).to(
|
bind(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class).to(
|
||||||
ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
|
ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
|
||||||
|
|
||||||
bind(new TypeLiteral<CacheLoader<DatacenterAndName, KeyAndPrivateKey>>() {
|
bind(new TypeLiteral<CacheLoader<DatacenterAndName, KeyAndPrivateKey>>() {
|
||||||
}).to(CreateUniqueKey.class);
|
}).to(CreateUniqueKey.class);
|
||||||
|
@ -119,7 +119,7 @@ public class SDCComputeServiceContextModule extends
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
|
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
|
||||||
return options.as(SDCTemplateOptions.class)
|
return options.as(JoyentCloudTemplateOptions.class)
|
||||||
.generateKey(injector.getInstance(
|
.generateKey(injector.getInstance(
|
||||||
com.google.inject.Key.get(boolean.class, Names.named(AUTOGENERATE_KEYS))));
|
com.google.inject.Key.get(boolean.class, Names.named(AUTOGENERATE_KEYS))));
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
@ -29,14 +29,14 @@ import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.ImageBuilder;
|
import org.jclouds.compute.domain.ImageBuilder;
|
||||||
import org.jclouds.compute.domain.OperatingSystem;
|
import org.jclouds.compute.domain.OperatingSystem;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function for transforming a sdc-specific Image into a generic Image object.
|
* A function for transforming a cloudApi-specific Image into a generic Image object.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -30,7 +30,7 @@ import org.jclouds.compute.domain.OperatingSystem.Builder;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.compute.util.ComputeServiceUtils;
|
import org.jclouds.compute.util.ComputeServiceUtils;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -38,7 +38,7 @@ import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function for transforming a sdc specific Dataset into a generic
|
* A function for transforming a cloudApi specific Dataset into a generic
|
||||||
* OperatingSystem object.
|
* OperatingSystem object.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
import static com.google.common.base.Predicates.not;
|
import static com.google.common.base.Predicates.not;
|
||||||
|
@ -43,11 +43,11 @@ import org.jclouds.compute.domain.OperatingSystem;
|
||||||
import org.jclouds.compute.functions.GroupNamingConvention;
|
import org.jclouds.compute.functions.GroupNamingConvention;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndId;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndId;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||||
import org.jclouds.joyent.sdc.v6_5.reference.Metadata;
|
import org.jclouds.joyent.cloudapi.v6_5.reference.Metadata;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.util.InetAddresses2;
|
import org.jclouds.util.InetAddresses2;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function for transforming a sdc-specific Machine into a generic
|
* A function for transforming a cloudApi-specific Machine into a generic
|
||||||
* NodeMetadata object.
|
* NodeMetadata object.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
import static com.google.common.collect.Iterables.filter;
|
||||||
|
@ -29,8 +29,8 @@ import javax.inject.Inject;
|
||||||
import org.jclouds.compute.ComputeService;
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.predicates.NodePredicates;
|
import org.jclouds.compute.predicates.NodePredicates;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.predicates.AllNodesInGroupTerminated;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.predicates.AllNodesInGroupTerminated;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
@ -30,13 +30,13 @@ import org.jclouds.compute.domain.HardwareBuilder;
|
||||||
import org.jclouds.compute.domain.Processor;
|
import org.jclouds.compute.domain.Processor;
|
||||||
import org.jclouds.compute.domain.internal.VolumeImpl;
|
import org.jclouds.compute.domain.internal.VolumeImpl;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function for transforming the sdc specific PackageInDatacenter object to
|
* A function for transforming the cloudApi specific PackageInDatacenter object to
|
||||||
* the generic Hardware object.
|
* the generic Hardware object.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
@ -55,7 +55,7 @@ public class PackageInDatacenterToHardware implements Function<PackageInDatacent
|
||||||
Location location = locationIndex.get().get(pkgInDatacenter.getDatacenter());
|
Location location = locationIndex.get().get(pkgInDatacenter.getDatacenter());
|
||||||
checkState(location != null, "location %s not in locationIndex: %s", pkgInDatacenter.getDatacenter(),
|
checkState(location != null, "location %s not in locationIndex: %s", pkgInDatacenter.getDatacenter(),
|
||||||
locationIndex.get());
|
locationIndex.get());
|
||||||
org.jclouds.joyent.sdc.v6_5.domain.Package pkg = pkgInDatacenter.get();
|
org.jclouds.joyent.cloudapi.v6_5.domain.Package pkg = pkgInDatacenter.get();
|
||||||
return new HardwareBuilder().id(pkgInDatacenter.slashEncode()).providerId(pkg.getName()).name(pkg.getName())
|
return new HardwareBuilder().id(pkgInDatacenter.slashEncode()).providerId(pkg.getName()).name(pkg.getName())
|
||||||
.ram(pkg.getMemorySizeMb())
|
.ram(pkg.getMemorySizeMb())
|
||||||
// TODO: no api call to get processors.. either hard-code or
|
// TODO: no api call to get processors.. either hard-code or
|
|
@ -16,11 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.internal;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.loaders;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.loaders;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
@ -32,10 +32,10 @@ import org.jclouds.compute.functions.GroupNamingConvention;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.crypto.Crypto;
|
import org.jclouds.crypto.Crypto;
|
||||||
import org.jclouds.crypto.SshKeys;
|
import org.jclouds.crypto.SshKeys;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
|
@ -49,14 +49,14 @@ public class CreateUniqueKey extends CacheLoader<DatacenterAndName, KeyAndPrivat
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
protected final SDCClient sdcClient;
|
protected final JoyentCloudClient cloudApiClient;
|
||||||
protected final GroupNamingConvention.Factory namingConvention;
|
protected final GroupNamingConvention.Factory namingConvention;
|
||||||
protected final Crypto crypto;
|
protected final Crypto crypto;
|
||||||
protected final Provider<SecureRandom> secureRandom;
|
protected final Provider<SecureRandom> secureRandom;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CreateUniqueKey(SDCClient sdcClient, GroupNamingConvention.Factory namingConvention, Crypto crypto, Provider<SecureRandom> secureRandom) {
|
public CreateUniqueKey(JoyentCloudClient cloudApiClient, GroupNamingConvention.Factory namingConvention, Crypto crypto, Provider<SecureRandom> secureRandom) {
|
||||||
this.sdcClient = checkNotNull(sdcClient, "sdcClient");
|
this.cloudApiClient = checkNotNull(cloudApiClient, "cloudApiClient");
|
||||||
this.namingConvention = checkNotNull(namingConvention, "namingConvention");
|
this.namingConvention = checkNotNull(namingConvention, "namingConvention");
|
||||||
this.crypto = checkNotNull(crypto, "crypto");
|
this.crypto = checkNotNull(crypto, "crypto");
|
||||||
this.secureRandom = checkNotNull(secureRandom, "secureRandom");
|
this.secureRandom = checkNotNull(secureRandom, "secureRandom");
|
||||||
|
@ -77,7 +77,7 @@ public class CreateUniqueKey extends CacheLoader<DatacenterAndName, KeyAndPrivat
|
||||||
while (key == null) {
|
while (key == null) {
|
||||||
String name = namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix);
|
String name = namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix);
|
||||||
try {
|
try {
|
||||||
key = sdcClient.getKeyClient().create(Key.builder().name(name).key(publicKey).build());
|
key = cloudApiClient.getKeyClient().create(Key.builder().name(name).key(publicKey).build());
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
logger.trace("error creating keypair named %s, %s", name, e.getMessage());
|
logger.trace("error creating keypair named %s, %s", name, e.getMessage());
|
||||||
}
|
}
|
|
@ -0,0 +1,339 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds 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.joyent.cloudapi.v6_5.compute.options;
|
||||||
|
|
||||||
|
import static com.google.common.base.Objects.equal;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
|
import org.jclouds.domain.LoginCredentials;
|
||||||
|
import org.jclouds.scriptbuilder.domain.Statement;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains options supported in the {@code ComputeService#createNodesInGroup} operation on the
|
||||||
|
* "joyent-cloudapi" provider.
|
||||||
|
*
|
||||||
|
* <h2>Usage</h2> The recommended way to instantiate a
|
||||||
|
* JoyentCloudTemplateOptions object is to statically import JoyentCloudTemplateOptions.Builder.* and
|
||||||
|
* invoke a static creation method followed by an instance mutator (if needed):
|
||||||
|
* <p/>
|
||||||
|
* <code>
|
||||||
|
* import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.*;
|
||||||
|
* <p/>
|
||||||
|
* ComputeService client = // get connection
|
||||||
|
* templateBuilder.options(inboundPorts(22, 80, 8080, 443));
|
||||||
|
* Set<? extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
|
||||||
|
* <code>
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class JoyentCloudTemplateOptions extends TemplateOptions implements Cloneable {
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions clone() {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
copyTo(options);
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void copyTo(TemplateOptions to) {
|
||||||
|
super.copyTo(to);
|
||||||
|
if (to instanceof JoyentCloudTemplateOptions) {
|
||||||
|
JoyentCloudTemplateOptions eTo = JoyentCloudTemplateOptions.class.cast(to);
|
||||||
|
eTo.generateKey(shouldGenerateKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean generateKey = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
JoyentCloudTemplateOptions that = JoyentCloudTemplateOptions.class.cast(o);
|
||||||
|
return super.equals(that) && equal(this.generateKey, that.generateKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(super.hashCode(), generateKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ToStringHelper string() {
|
||||||
|
ToStringHelper toString = super.string();
|
||||||
|
if (generateKey)
|
||||||
|
toString.add("generateKey", generateKey);
|
||||||
|
return toString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see #shouldGenerateKey()
|
||||||
|
*/
|
||||||
|
public JoyentCloudTemplateOptions generateKey(boolean enable) {
|
||||||
|
this.generateKey = enable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return true if auto generation of keys is enabled
|
||||||
|
*/
|
||||||
|
public boolean shouldGenerateKey() {
|
||||||
|
return generateKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see JoyentCloudTemplateOptions#shouldGenerateKey()
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions generateKey(boolean enable) {
|
||||||
|
return new JoyentCloudTemplateOptions().generateKey(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods that only facilitate returning the correct object type
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#inboundPorts
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions inboundPorts(int... ports) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(options.inboundPorts(ports));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#port
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions blockOnPort(int port, int seconds) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(options.blockOnPort(port, seconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#installPrivateKey
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions installPrivateKey(String rsaKey) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#authorizePublicKey
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions authorizePublicKey(String rsaKey) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#userMetadata
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(options.userMetadata(userMetadata));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#overrideLoginUser
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions overrideLoginUser(String user) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return options.overrideLoginUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#overrideLoginPassword
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions overrideLoginPassword(String password) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return options.overrideLoginPassword(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#overrideLoginPrivateKey
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions overrideLoginPrivateKey(String privateKey) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return options.overrideLoginPrivateKey(privateKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#overrideAuthenticateSudo
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return options.overrideAuthenticateSudo(authenticateSudo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#overrideLoginCredentials
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return options.overrideLoginCredentials(credentials);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TemplateOptions#blockUntilRunning
|
||||||
|
*/
|
||||||
|
public static JoyentCloudTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
|
||||||
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
|
return options.blockUntilRunning(blockUntilRunning);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// methods that only facilitate returning the correct object type
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions blockOnPort(int port, int seconds) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.blockOnPort(port, seconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions inboundPorts(int... ports) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.inboundPorts(ports));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions authorizePublicKey(String publicKey) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions installPrivateKey(String privateKey) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions dontAuthorizePublicKey() {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.dontAuthorizePublicKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions nameTask(String name) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.nameTask(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions runAsRoot(boolean runAsRoot) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.runAsRoot(runAsRoot));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions runScript(Statement script) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.runScript(script));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions overrideLoginPassword(String password) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.overrideLoginPassword(password));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions overrideLoginPrivateKey(String privateKey) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions overrideLoginUser(String loginUser) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.overrideLoginUser(loginUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.userMetadata(userMetadata));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JoyentCloudTemplateOptions userMetadata(String key, String value) {
|
||||||
|
return JoyentCloudTemplateOptions.class.cast(super.userMetadata(key, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.predicates;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.predicates;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Predicates.and;
|
import static com.google.common.base.Predicates.and;
|
||||||
|
@ -28,7 +28,7 @@ import static org.jclouds.compute.predicates.NodePredicates.locationId;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeService;
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.strategy;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.strategy;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
@ -39,9 +39,9 @@ import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
|
||||||
import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
|
import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
|
||||||
import org.jclouds.compute.strategy.ListNodesStrategy;
|
import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||||
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
|
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
@ -51,13 +51,13 @@ import com.google.common.collect.Multimap;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet extends
|
public class ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet extends
|
||||||
CreateNodesWithGroupEncodedIntoNameThenAddToSet {
|
CreateNodesWithGroupEncodedIntoNameThenAddToSet {
|
||||||
|
|
||||||
private final LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache;
|
private final LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
|
protected ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
|
||||||
CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
|
CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
|
||||||
ListNodesStrategy listNodesStrategy,
|
ListNodesStrategy listNodesStrategy,
|
||||||
GroupNamingConvention.Factory namingConvention,
|
GroupNamingConvention.Factory namingConvention,
|
||||||
|
@ -75,7 +75,7 @@ public class ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddTo
|
||||||
|
|
||||||
Template mutableTemplate = template.clone();
|
Template mutableTemplate = template.clone();
|
||||||
|
|
||||||
SDCTemplateOptions templateOptions = SDCTemplateOptions.class.cast(mutableTemplate.getOptions());
|
JoyentCloudTemplateOptions templateOptions = JoyentCloudTemplateOptions.class.cast(mutableTemplate.getOptions());
|
||||||
|
|
||||||
assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
|
assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.config;
|
package org.jclouds.joyent.cloudapi.v6_5.config;
|
||||||
|
|
||||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.suppliers.ZoneIdToURIFromDatacentersClient;
|
import org.jclouds.joyent.cloudapi.v6_5.suppliers.ZoneIdToURIFromDatacentersClient;
|
||||||
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
||||||
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
||||||
import org.jclouds.location.suppliers.ZoneIdsSupplier;
|
import org.jclouds.location.suppliers.ZoneIdsSupplier;
|
|
@ -16,15 +16,15 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.config;
|
package org.jclouds.joyent.cloudapi.v6_5.config;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.functions.internal.SDCTypeAdapters;
|
import org.jclouds.joyent.cloudapi.v6_5.functions.internal.JoyentCloudTypeAdapters;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
|
@ -33,13 +33,13 @@ import com.google.inject.Provides;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SDCParserModule extends AbstractModule {
|
public class JoyentCloudParserModule extends AbstractModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public Map<Type, Object> provideCustomAdapterBindings() {
|
public Map<Type, Object> provideCustomAdapterBindings() {
|
||||||
return ImmutableMap.<Type, Object> of(Machine.State.class, new SDCTypeAdapters.MachineStateAdapter(), Type.class,
|
return ImmutableMap.<Type, Object> of(Machine.State.class, new JoyentCloudTypeAdapters.MachineStateAdapter(), Type.class,
|
||||||
new SDCTypeAdapters.SDCTypeAdapter());
|
new JoyentCloudTypeAdapters.JoyentCloudTypeAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -16,19 +16,19 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.config;
|
package org.jclouds.joyent.cloudapi.v6_5.config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration properties and constants used in joyent SDC connections.
|
* Configuration properties and constants used in joyent JoyentCloud connections.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SDCProperties {
|
public class JoyentCloudProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whenever a node is created, automatically generate keys for groups, as needed, also
|
* Whenever a node is created, automatically generate keys for groups, as needed, also
|
||||||
* delete the key(s) when the last node in the group is destroyed.
|
* delete the key(s) when the last node in the group is destroyed.
|
||||||
*/
|
*/
|
||||||
public static final String AUTOGENERATE_KEYS = "jclouds.joyent-sdc.autogenerate-keys";
|
public static final String AUTOGENERATE_KEYS = "jclouds.joyent-cloudapi.autogenerate-keys";
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.config;
|
package org.jclouds.joyent.cloudapi.v6_5.config;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -24,19 +24,19 @@ import org.jclouds.http.HttpErrorHandler;
|
||||||
import org.jclouds.http.annotation.ClientError;
|
import org.jclouds.http.annotation.ClientError;
|
||||||
import org.jclouds.http.annotation.Redirection;
|
import org.jclouds.http.annotation.Redirection;
|
||||||
import org.jclouds.http.annotation.ServerError;
|
import org.jclouds.http.annotation.ServerError;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.KeyAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.KeyAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.MachineAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.MachineAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.MachineClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.MachineClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.PackageAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.PackageAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.PackageClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.PackageClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.handlers.SDCErrorHandler;
|
import org.jclouds.joyent.cloudapi.v6_5.handlers.JoyentCloudErrorHandler;
|
||||||
import org.jclouds.json.config.GsonModule.DateAdapter;
|
import org.jclouds.json.config.GsonModule.DateAdapter;
|
||||||
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
|
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
|
@ -45,12 +45,12 @@ import org.jclouds.rest.config.RestClientModule;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the SDC connection.
|
* Configures the JoyentCloud connection.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class SDCRestClientModule extends RestClientModule<SDCClient, SDCAsyncClient> {
|
public class JoyentCloudRestClientModule extends RestClientModule<JoyentCloudClient, JoyentCloudAsyncClient> {
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
||||||
.put(DatacenterClient.class, DatacenterAsyncClient.class)
|
.put(DatacenterClient.class, DatacenterAsyncClient.class)
|
||||||
.put(KeyClient.class, KeyAsyncClient.class)
|
.put(KeyClient.class, KeyAsyncClient.class)
|
||||||
|
@ -58,22 +58,22 @@ public class SDCRestClientModule extends RestClientModule<SDCClient, SDCAsyncCli
|
||||||
.put(DatasetClient.class, DatasetAsyncClient.class)
|
.put(DatasetClient.class, DatasetAsyncClient.class)
|
||||||
.put(PackageClient.class, PackageAsyncClient.class).build();
|
.put(PackageClient.class, PackageAsyncClient.class).build();
|
||||||
|
|
||||||
public SDCRestClientModule() {
|
public JoyentCloudRestClientModule() {
|
||||||
super(DELEGATE_MAP);
|
super(DELEGATE_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(DateAdapter.class).to(Iso8601DateAdapter.class);
|
bind(DateAdapter.class).to(Iso8601DateAdapter.class);
|
||||||
install(new SDCParserModule());
|
install(new JoyentCloudParserModule());
|
||||||
super.configure();
|
super.configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void bindErrorHandlers() {
|
protected void bindErrorHandlers() {
|
||||||
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(SDCErrorHandler.class);
|
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(JoyentCloudErrorHandler.class);
|
||||||
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(SDCErrorHandler.class);
|
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(JoyentCloudErrorHandler.class);
|
||||||
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(SDCErrorHandler.class);
|
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(JoyentCloudErrorHandler.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain;
|
package org.jclouds.joyent.cloudapi.v6_5.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
* Listing of a dataset.
|
* Listing of a dataset.
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see <a href= "http://apidocs.joyent.com/sdcapidoc/cloudapi/#datasets" />
|
* @see <a href= "http://apidocs.joyent.com/cloudApiapidoc/cloudapi/#datasets" />
|
||||||
*/
|
*/
|
||||||
public class Dataset implements Comparable<Dataset> {
|
public class Dataset implements Comparable<Dataset> {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain;
|
package org.jclouds.joyent.cloudapi.v6_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import com.google.common.base.Objects;
|
||||||
* CloudAPI supports uploads of public keys in the OpenSSH format.
|
* CloudAPI supports uploads of public keys in the OpenSSH format.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/#keys" >docs</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi/#keys" >docs</a>
|
||||||
*/
|
*/
|
||||||
public class Key implements Comparable<Key> {
|
public class Key implements Comparable<Key> {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain;
|
package org.jclouds.joyent.cloudapi.v6_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.domain.JsonBall;
|
import org.jclouds.domain.JsonBall;
|
||||||
import org.jclouds.joyent.sdc.v6_5.reference.Metadata;
|
import org.jclouds.joyent.cloudapi.v6_5.reference.Metadata;
|
||||||
import org.jclouds.json.Json;
|
import org.jclouds.json.Json;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
@ -42,7 +42,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
* Listing of a machine.
|
* Listing of a machine.
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see <a href= "http://apidocs.joyent.com/sdcapidoc/cloudapi/#machines" />
|
* @see <a href= "http://apidocs.joyent.com/cloudApiapidoc/cloudapi/#machines" />
|
||||||
*/
|
*/
|
||||||
public class Machine implements Comparable<Machine> {
|
public class Machine implements Comparable<Machine> {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain;
|
package org.jclouds.joyent.cloudapi.v6_5.domain;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
@ -25,7 +25,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
* Listing of a package.
|
* Listing of a package.
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see <a href= "http://apidocs.joyent.com/sdcapidoc/cloudapi/#machines" />
|
* @see <a href= "http://apidocs.joyent.com/cloudApiapidoc/cloudapi/#machines" />
|
||||||
*/
|
*/
|
||||||
public class Package implements Comparable<Package> {
|
public class Package implements Comparable<Package> {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain;
|
package org.jclouds.joyent.cloudapi.v6_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped;
|
package org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped;
|
package org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
@ -16,11 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped;
|
package org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -16,11 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped;
|
package org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -16,11 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped;
|
package org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped;
|
package org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
@ -24,14 +24,14 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class PackageInDatacenter extends DatacenterAndName {
|
public class PackageInDatacenter extends DatacenterAndName {
|
||||||
protected final org.jclouds.joyent.sdc.v6_5.domain.Package pkg;
|
protected final org.jclouds.joyent.cloudapi.v6_5.domain.Package pkg;
|
||||||
|
|
||||||
public PackageInDatacenter(org.jclouds.joyent.sdc.v6_5.domain.Package pkg, String datacenterId) {
|
public PackageInDatacenter(org.jclouds.joyent.cloudapi.v6_5.domain.Package pkg, String datacenterId) {
|
||||||
super(datacenterId, checkNotNull(pkg, "pkg").getName());
|
super(datacenterId, checkNotNull(pkg, "pkg").getName());
|
||||||
this.pkg = pkg;
|
this.pkg = pkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.jclouds.joyent.sdc.v6_5.domain.Package get() {
|
public org.jclouds.joyent.cloudapi.v6_5.domain.Package get() {
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -40,7 +40,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*
|
*
|
||||||
* @see DatacenterClient
|
* @see DatacenterClient
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see <a href="http://sdc.joyent.org/sdcapi.html">api doc</a>
|
* @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
|
||||||
*/
|
*/
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -29,7 +29,7 @@ import org.jclouds.concurrent.Timeout;
|
||||||
*
|
*
|
||||||
* @see DatacenterAsyncClient
|
* @see DatacenterAsyncClient
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see <a href="http://sdc.joyent.org/sdcapi.html">api doc</a>
|
* @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface DatacenterClient {
|
public interface DatacenterClient {
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.http.filters.BasicAuthentication;
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.Headers;
|
import org.jclouds.rest.annotations.Headers;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
@ -25,7 +25,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see DatasetClient
|
* @see DatasetClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi">api doc</a>
|
||||||
*/
|
*/
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
|
@ -1,10 +1,10 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Datasets.
|
* Provides synchronous access to Datasets.
|
||||||
|
@ -12,7 +12,7 @@ import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see DatasetAsyncClient
|
* @see DatasetAsyncClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi">api doc</a>
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface DatasetClient {
|
public interface DatasetClient {
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.http.filters.BasicAuthentication;
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.joyent.sdc.v6_5.binders.BindKeyToJsonPayload;
|
import org.jclouds.joyent.cloudapi.v6_5.binders.BindKeyToJsonPayload;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.Headers;
|
import org.jclouds.rest.annotations.Headers;
|
||||||
|
@ -26,7 +26,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see KeyClient
|
* @see KeyClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/#keys">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi/#keys">api doc</a>
|
||||||
*/
|
*/
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
|
@ -1,10 +1,10 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys are the means by which you operate on your SSH/signing keys. Currently
|
* Keys are the means by which you operate on your SSH/signing keys. Currently
|
||||||
|
@ -12,7 +12,7 @@ import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see KeyAsyncClient
|
* @see KeyAsyncClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi/#keys">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi/#keys">api doc</a>
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface KeyClient {
|
public interface KeyClient {
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.http.filters.BasicAuthentication;
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.Headers;
|
import org.jclouds.rest.annotations.Headers;
|
||||||
import org.jclouds.rest.annotations.Payload;
|
import org.jclouds.rest.annotations.Payload;
|
||||||
|
@ -50,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see MachineClient
|
* @see MachineClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi">api doc</a>
|
||||||
*/
|
*/
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
||||||
|
@ -129,7 +129,7 @@ public interface MachineAsyncClient {
|
||||||
@Produces(MediaType.APPLICATION_FORM_URLENCODED)
|
@Produces(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
@Path("/my/machines/{id}")
|
@Path("/my/machines/{id}")
|
||||||
@Payload("action=resize&package={package}")
|
@Payload("action=resize&package={package}")
|
||||||
ListenableFuture<Void> resize(@PathParam("id") String id,@PayloadParam("package") String packageSDC);
|
ListenableFuture<Void> resize(@PathParam("id") String id,@PayloadParam("package") String packageJoyentCloud);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see MachineClient#delete
|
* @see MachineClient#delete
|
|
@ -16,14 +16,14 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Machine.
|
* Provides synchronous access to Machine.
|
||||||
|
@ -31,7 +31,7 @@ import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see MachineAsyncClient
|
* @see MachineAsyncClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi">api doc</a>
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface MachineClient {
|
public interface MachineClient {
|
||||||
|
@ -121,10 +121,10 @@ public interface MachineClient {
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* the id of the machine to resize
|
* the id of the machine to resize
|
||||||
* @param packageSDC
|
* @param packageJoyentCloud
|
||||||
* the package to use for the machine
|
* the package to use for the machine
|
||||||
*/
|
*/
|
||||||
void resize(String id, String packageSDC);
|
void resize(String id, String packageJoyentCloud);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to delete a machine (the machine must be stopped before it can
|
* Allows you to delete a machine (the machine must be stopped before it can
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see PackageClient
|
* @see PackageClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi">api doc</a>
|
||||||
*/
|
*/
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
||||||
|
@ -37,7 +37,7 @@ public interface PackageAsyncClient {
|
||||||
@Path("/my/packages")
|
@Path("/my/packages")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||||
ListenableFuture<Set<org.jclouds.joyent.sdc.v6_5.domain.Package>> list();
|
ListenableFuture<Set<org.jclouds.joyent.cloudapi.v6_5.domain.Package>> list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see PackageClient#get
|
* @see PackageClient#get
|
||||||
|
@ -46,5 +46,5 @@ public interface PackageAsyncClient {
|
||||||
@Path("/my/packages/{name}")
|
@Path("/my/packages/{name}")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<org.jclouds.joyent.sdc.v6_5.domain.Package> get(@PathParam("name") String name);
|
ListenableFuture<org.jclouds.joyent.cloudapi.v6_5.domain.Package> get(@PathParam("name") String name);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -11,7 +11,7 @@ import org.jclouds.concurrent.Timeout;
|
||||||
*
|
*
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
* @see PackageAsyncClient
|
* @see PackageAsyncClient
|
||||||
* @see <a href="http://apidocs.joyent.com/sdcapidoc/cloudapi">api doc</a>
|
* @see <a href="http://apidocs.joyent.com/cloudApiapidoc/cloudapi">api doc</a>
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface PackageClient {
|
public interface PackageClient {
|
||||||
|
@ -21,7 +21,7 @@ public interface PackageClient {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Set<org.jclouds.joyent.sdc.v6_5.domain.Package> list();
|
Set<org.jclouds.joyent.cloudapi.v6_5.domain.Package> list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an individual package by id.
|
* Gets an individual package by id.
|
||||||
|
@ -30,5 +30,5 @@ public interface PackageClient {
|
||||||
* the name of the package
|
* the name of the package
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
org.jclouds.joyent.sdc.v6_5.domain.Package get(String name);
|
org.jclouds.joyent.cloudapi.v6_5.domain.Package get(String name);
|
||||||
}
|
}
|
|
@ -16,12 +16,12 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.functions.internal;
|
package org.jclouds.joyent.cloudapi.v6_5.functions.internal;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||||
|
|
||||||
import com.google.gson.TypeAdapter;
|
import com.google.gson.TypeAdapter;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
|
@ -30,7 +30,7 @@ import com.google.gson.stream.JsonWriter;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SDCTypeAdapters {
|
public class JoyentCloudTypeAdapters {
|
||||||
|
|
||||||
public static class MachineStateAdapter extends TypeAdapter<Machine.State> {
|
public static class MachineStateAdapter extends TypeAdapter<Machine.State> {
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,7 +44,7 @@ public class SDCTypeAdapters {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SDCTypeAdapter extends TypeAdapter<Type> {
|
public static class JoyentCloudTypeAdapter extends TypeAdapter<Type> {
|
||||||
@Override
|
@Override
|
||||||
public void write(JsonWriter writer, Type value) throws IOException {
|
public void write(JsonWriter writer, Type value) throws IOException {
|
||||||
writer.value(value.value());
|
writer.value(value.value());
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.handlers;
|
package org.jclouds.joyent.cloudapi.v6_5.handlers;
|
||||||
|
|
||||||
import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
|
import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import org.jclouds.rest.ResourceNotFoundException;
|
||||||
*/
|
*/
|
||||||
// TODO: is there error spec someplace? let's type errors, etc.
|
// TODO: is there error spec someplace? let's type errors, etc.
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SDCErrorHandler implements HttpErrorHandler {
|
public class JoyentCloudErrorHandler implements HttpErrorHandler {
|
||||||
public void handleError(HttpCommand command, HttpResponse response) {
|
public void handleError(HttpCommand command, HttpResponse response) {
|
||||||
// it is important to always read fully and close streams
|
// it is important to always read fully and close streams
|
||||||
byte[] data = closeClientButKeepContentStream(response);
|
byte[] data = closeClientButKeepContentStream(response);
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.options;
|
package org.jclouds.joyent.cloudapi.v6_5.options;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
@ -24,7 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.PackageClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.PackageClient;
|
||||||
import org.jclouds.util.Maps2;
|
import org.jclouds.util.Maps2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
|
@ -16,11 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.predicates;
|
package org.jclouds.joyent.cloudapi.v6_5.predicates;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.reference;
|
package org.jclouds.joyent.cloudapi.v6_5.reference;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.suppliers;
|
package org.jclouds.joyent.cloudapi.v6_5.suppliers;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterClient;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterClient;
|
||||||
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
||||||
import org.jclouds.util.Suppliers2;
|
import org.jclouds.util.Suppliers2;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApiMetadata
|
|
@ -16,10 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5;
|
package org.jclouds.joyent.cloudapi.v6_5;
|
||||||
|
|
||||||
import org.jclouds.View;
|
import org.jclouds.View;
|
||||||
import org.jclouds.apis.internal.BaseApiMetadataTest;
|
import org.jclouds.apis.internal.BaseApiMetadataTest;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApiMetadata;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -29,9 +30,9 @@ import com.google.common.reflect.TypeToken;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "SDCApiMetadataTest")
|
@Test(groups = "unit", testName = "JoyentCloudApiMetadataTest")
|
||||||
public class SDCApiMetadataTest extends BaseApiMetadataTest {
|
public class JoyentCloudApiMetadataTest extends BaseApiMetadataTest {
|
||||||
public SDCApiMetadataTest() {
|
public JoyentCloudApiMetadataTest() {
|
||||||
super(new SDCApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
|
super(new JoyentCloudApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,11 +16,12 @@
|
||||||
* specific language governing permisions and limitations
|
* specific language governing permisions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5;
|
package org.jclouds.joyent.cloudapi.v6_5;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -28,12 +29,12 @@ import com.google.common.collect.ImmutableSet;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "SDCClientExpectTest")
|
@Test(groups = "unit", testName = "JoyentCloudClientExpectTest")
|
||||||
public class SDCClientExpectTest extends BaseSDCClientExpectTest {
|
public class JoyentCloudClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||||
|
|
||||||
public void testGetConfiguredDatacenters() {
|
public void testGetConfiguredDatacenters() {
|
||||||
|
|
||||||
SDCClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
JoyentCloudClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
clientWhenDatacentersExists.getConfiguredDatacenters(),
|
clientWhenDatacentersExists.getConfiguredDatacenters(),
|
|
@ -16,23 +16,23 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5;
|
package org.jclouds.joyent.cloudapi.v6_5;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "SDCClientLiveTest")
|
@Test(groups = "live", testName = "JoyentCloudClientLiveTest")
|
||||||
public class SDCClientLiveTest extends BaseSDCClientLiveTest {
|
public class JoyentCloudClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||||
|
|
||||||
public void testGetDatacenters() {
|
public void testGetDatacenters() {
|
||||||
Set<String> dcs = sdcContext.getApi().getConfiguredDatacenters();
|
Set<String> dcs = cloudApiContext.getApi().getConfiguredDatacenters();
|
||||||
assertEquals(dcs, sdcContext.getApi().getDatacenterClient().getDatacenters().keySet());
|
assertEquals(dcs, cloudApiContext.getApi().getDatacenterClient().getDatacenters().keySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute;
|
package org.jclouds.joyent.cloudapi.v6_5.compute;
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
|
@ -10,11 +10,11 @@ import com.google.inject.Module;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "SDCComputeServiceLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "JoyentCloudComputeServiceLiveTest")
|
||||||
public class SDCComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
public class JoyentCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
public SDCComputeServiceLiveTest() {
|
public JoyentCloudComputeServiceLiveTest() {
|
||||||
provider = "joyent-sdc";
|
provider = "joyent-cloudapi";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -27,9 +27,10 @@ import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LocationBuilder;
|
import org.jclouds.domain.LocationBuilder;
|
||||||
import org.jclouds.domain.LocationScope;
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetInDatacenterToImage;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseDatasetTest;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseDatasetTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -39,15 +40,15 @@ import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the function that transforms sdc-specific images to generic images.
|
* Tests the function that transforms cloudApi-specific images to generic images.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(testName = "DatasetInDatacenterToHardwareTest")
|
@Test(testName = "DatasetInDatacenterToHardwareTest")
|
||||||
public class DatasetInDatacenterToImageTest {
|
public class DatasetInDatacenterToImageTest {
|
||||||
|
|
||||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc")
|
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi")
|
||||||
.description("joyent-sdc").build();
|
.description("joyent-cloudapi").build();
|
||||||
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(LocationScope.ZONE)
|
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(LocationScope.ZONE)
|
||||||
.parent(provider).build();
|
.parent(provider).build();
|
||||||
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
@ -25,14 +25,15 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.OperatingSystem;
|
import org.jclouds.compute.domain.OperatingSystem;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetToOperatingSystem;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseDatasetTest;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseDatasetTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the function for transforming a sdc specific Image into a generic
|
* Tests for the function for transforming a cloudApi specific Image into a generic
|
||||||
* OperatingSystem object.
|
* OperatingSystem object.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
@ -36,10 +36,11 @@ import org.jclouds.compute.functions.GroupNamingConvention;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LocationBuilder;
|
import org.jclouds.domain.LocationBuilder;
|
||||||
import org.jclouds.domain.LocationScope;
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.config.SDCComputeServiceContextModule;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.config.JoyentCloudComputeServiceContextModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseCreatedMachineTest;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseCreatedMachineTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -49,7 +50,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the function for transforming a sdc specific Machine into a generic
|
* Tests for the function for transforming a cloudApi specific Machine into a generic
|
||||||
* NodeMetadata object.
|
* NodeMetadata object.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
@ -57,8 +58,8 @@ import com.google.inject.Guice;
|
||||||
@Test(testName = "MachineInDatacenterToNodeMetadataTest")
|
@Test(testName = "MachineInDatacenterToNodeMetadataTest")
|
||||||
public class MachineInDatacenterToNodeMetadataTest {
|
public class MachineInDatacenterToNodeMetadataTest {
|
||||||
|
|
||||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc")
|
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi")
|
||||||
.description("joyent-sdc").build();
|
.description("joyent-cloudapi").build();
|
||||||
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(LocationScope.ZONE)
|
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(LocationScope.ZONE)
|
||||||
.parent(provider).build();
|
.parent(provider).build();
|
||||||
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
||||||
|
@ -105,7 +106,7 @@ public class MachineInDatacenterToNodeMetadataTest {
|
||||||
MachineInDatacenter machineInDatacenterToConvert = new MachineInDatacenter(machineToConvert, "us-sw-1");
|
MachineInDatacenter machineInDatacenterToConvert = new MachineInDatacenter(machineToConvert, "us-sw-1");
|
||||||
|
|
||||||
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
||||||
SDCComputeServiceContextModule.toPortableNodeStatus, locationIndex,
|
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
|
||||||
Suppliers.<Set<? extends Image>> ofInstance(images),
|
Suppliers.<Set<? extends Image>> ofInstance(images),
|
||||||
Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
|
Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ public class MachineInDatacenterToNodeMetadataTest {
|
||||||
|
|
||||||
assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);
|
assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);
|
||||||
|
|
||||||
assertEquals(SDCComputeServiceContextModule.toPortableNodeStatus.get(machineToConvert.getState()),
|
assertEquals(JoyentCloudComputeServiceContextModule.toPortableNodeStatus.get(machineToConvert.getState()),
|
||||||
convertedNodeMetadata.getStatus());
|
convertedNodeMetadata.getStatus());
|
||||||
|
|
||||||
assertNotNull(convertedNodeMetadata.getPrivateAddresses());
|
assertNotNull(convertedNodeMetadata.getPrivateAddresses());
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -30,11 +30,13 @@ import org.jclouds.compute.functions.GroupNamingConvention;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LocationBuilder;
|
import org.jclouds.domain.LocationBuilder;
|
||||||
import org.jclouds.domain.LocationScope;
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.config.SDCComputeServiceContextModule;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.config.JoyentCloudComputeServiceContextModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine.State;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.OrphanedGroupsByDatacenterId;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine.State;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseMachineTest;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseMachineTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
|
@ -53,8 +55,8 @@ import com.google.inject.Guice;
|
||||||
@Test(testName = "OrphanedGroupsByDatacenterIdTest")
|
@Test(testName = "OrphanedGroupsByDatacenterIdTest")
|
||||||
public class OrphanedGroupsByDatacenterIdTest {
|
public class OrphanedGroupsByDatacenterIdTest {
|
||||||
|
|
||||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc").description(
|
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi").description(
|
||||||
"joyent-sdc").build();
|
"joyent-cloudapi").build();
|
||||||
Location datacenter = new LocationBuilder().id("us-east-1").description("us-east-1").scope(
|
Location datacenter = new LocationBuilder().id("us-east-1").description("us-east-1").scope(
|
||||||
LocationScope.ZONE).parent(provider).build();
|
LocationScope.ZONE).parent(provider).build();
|
||||||
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
||||||
|
@ -70,7 +72,7 @@ public class OrphanedGroupsByDatacenterIdTest {
|
||||||
|
|
||||||
|
|
||||||
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
||||||
SDCComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
||||||
.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
|
.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
|
||||||
.<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
|
.<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
|
||||||
|
|
||||||
|
@ -87,7 +89,7 @@ public class OrphanedGroupsByDatacenterIdTest {
|
||||||
MachineInDatacenter machine2 = new MachineInDatacenter(new ParseMachineTest().expected(), "us-east-1");
|
MachineInDatacenter machine2 = new MachineInDatacenter(new ParseMachineTest().expected(), "us-east-1");
|
||||||
|
|
||||||
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
||||||
SDCComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
||||||
.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
|
.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
|
||||||
.<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
|
.<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.functions;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.functions;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
|
@ -28,8 +28,9 @@ import org.jclouds.compute.domain.Hardware;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LocationBuilder;
|
import org.jclouds.domain.LocationBuilder;
|
||||||
import org.jclouds.domain.LocationScope;
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Package;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.PackageInDatacenterToHardware;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Package;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -43,14 +44,14 @@ import com.google.common.collect.ImmutableMap;
|
||||||
*/
|
*/
|
||||||
@Test(testName = "PackageInDatacenterToHardwareTest")
|
@Test(testName = "PackageInDatacenterToHardwareTest")
|
||||||
public class PackageInDatacenterToHardwareTest {
|
public class PackageInDatacenterToHardwareTest {
|
||||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc").description(
|
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi").description(
|
||||||
"joyent-sdc").build();
|
"joyent-cloudapi").build();
|
||||||
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(
|
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(
|
||||||
LocationScope.ZONE).parent(provider).build();
|
LocationScope.ZONE).parent(provider).build();
|
||||||
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
||||||
.<String, Location> of("us-sw-1", zone));
|
.<String, Location> of("us-sw-1", zone));
|
||||||
|
|
||||||
Package packageToConvert = org.jclouds.joyent.sdc.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
Package packageToConvert = org.jclouds.joyent.cloudapi.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
||||||
.diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build();
|
.diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build();
|
||||||
|
|
||||||
@Test
|
@Test
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.loaders;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.loaders;
|
||||||
|
|
||||||
import static org.easymock.EasyMock.createMock;
|
import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
|
@ -43,11 +43,12 @@ import org.jclouds.crypto.Crypto;
|
||||||
import org.jclouds.crypto.Pems;
|
import org.jclouds.crypto.Pems;
|
||||||
import org.jclouds.crypto.SshKeys;
|
import org.jclouds.crypto.SshKeys;
|
||||||
import org.jclouds.io.Payloads;
|
import org.jclouds.io.Payloads;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.compute.loaders.CreateUniqueKey;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ public class CreateUniqueKeyTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testApply() {
|
public void testApply() {
|
||||||
SDCClient sdcClient = createMock(SDCClient.class);
|
JoyentCloudClient cloudApiClient = createMock(JoyentCloudClient.class);
|
||||||
KeyClient keyClient = createMock(KeyClient.class);
|
KeyClient keyClient = createMock(KeyClient.class);
|
||||||
Crypto crypto = createMock(Crypto.class);
|
Crypto crypto = createMock(Crypto.class);
|
||||||
KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
|
KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
|
||||||
|
@ -101,18 +102,18 @@ public class CreateUniqueKeyTest {
|
||||||
rsaKeyPairGenerator.initialize(2048, secureRandom);
|
rsaKeyPairGenerator.initialize(2048, secureRandom);
|
||||||
expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair);
|
expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair);
|
||||||
|
|
||||||
expect(sdcClient.getKeyClient()).andReturn(keyClient);
|
expect(cloudApiClient.getKeyClient()).andReturn(keyClient);
|
||||||
|
|
||||||
expect(keyClient.create(key)).andReturn(key);
|
expect(keyClient.create(key)).andReturn(key);
|
||||||
|
|
||||||
replay(sdcClient, keyClient, crypto, rsaKeyPairGenerator, secureRandom);
|
replay(cloudApiClient, keyClient, crypto, rsaKeyPairGenerator, secureRandom);
|
||||||
|
|
||||||
CreateUniqueKey parser = new CreateUniqueKey(sdcClient, namingConvention, crypto, Providers.of(secureRandom));
|
CreateUniqueKey parser = new CreateUniqueKey(cloudApiClient, namingConvention, crypto, Providers.of(secureRandom));
|
||||||
|
|
||||||
assertEquals(parser.load(DatacenterAndName.fromDatacenterAndName("datacenter", "group")),
|
assertEquals(parser.load(DatacenterAndName.fromDatacenterAndName("datacenter", "group")),
|
||||||
KeyAndPrivateKey.fromKeyAndPrivateKey(key, PRIVATE_KEY));
|
KeyAndPrivateKey.fromKeyAndPrivateKey(key, PRIVATE_KEY));
|
||||||
|
|
||||||
verify(sdcClient, keyClient, crypto, rsaKeyPairGenerator, secureRandom);
|
verify(cloudApiClient, keyClient, crypto, rsaKeyPairGenerator, secureRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,74 +16,75 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.compute.options;
|
package org.jclouds.joyent.cloudapi.v6_5.compute.options;
|
||||||
|
|
||||||
import static org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions.Builder.authorizePublicKey;
|
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.authorizePublicKey;
|
||||||
import static org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions.Builder.blockOnPort;
|
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.blockOnPort;
|
||||||
import static org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions.Builder.generateKey;
|
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.generateKey;
|
||||||
import static org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions.Builder.inboundPorts;
|
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.inboundPorts;
|
||||||
import static org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions.Builder.installPrivateKey;
|
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.installPrivateKey;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jclouds.compute.options.TemplateOptions;
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests possible uses of SDCTemplateOptions and SDCTemplateOptions.Builder.*
|
* Tests possible uses of JoyentCloudTemplateOptions and JoyentCloudTemplateOptions.Builder.*
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(testName = "SDCTemplateOptionsTest")
|
@Test(testName = "JoyentCloudTemplateOptionsTest")
|
||||||
public class SDCTemplateOptionsTest {
|
public class JoyentCloudTemplateOptionsTest {
|
||||||
|
|
||||||
public void testAs() {
|
public void testAs() {
|
||||||
TemplateOptions options = new SDCTemplateOptions();
|
TemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
assertEquals(options.as(SDCTemplateOptions.class), options);
|
assertEquals(options.as(JoyentCloudTemplateOptions.class), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateKeyDefault() {
|
public void testGenerateKeyDefault() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
assert !options.shouldGenerateKey();
|
assert !options.shouldGenerateKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateKey() {
|
public void testGenerateKey() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions().generateKey(true);
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions().generateKey(true);
|
||||||
assert options.shouldGenerateKey();
|
assert options.shouldGenerateKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateKeyStatic() {
|
public void testGenerateKeyStatic() {
|
||||||
SDCTemplateOptions options = generateKey(true);
|
JoyentCloudTemplateOptions options = generateKey(true);
|
||||||
assert options.shouldGenerateKey();
|
assert options.shouldGenerateKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
// superclass tests
|
// superclass tests
|
||||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||||
public void testinstallPrivateKeyBadFormat() {
|
public void testinstallPrivateKeyBadFormat() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.installPrivateKey("whompy");
|
options.installPrivateKey("whompy");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testinstallPrivateKey() throws IOException {
|
public void testinstallPrivateKey() throws IOException {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
|
options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
|
||||||
assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
|
assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNullinstallPrivateKey() {
|
public void testNullinstallPrivateKey() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
assertEquals(options.getPrivateKey(), null);
|
assertEquals(options.getPrivateKey(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testinstallPrivateKeyStatic() throws IOException {
|
public void testinstallPrivateKeyStatic() throws IOException {
|
||||||
SDCTemplateOptions options = installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
|
JoyentCloudTemplateOptions options = installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
|
||||||
assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
|
assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,26 +95,26 @@ public class SDCTemplateOptionsTest {
|
||||||
|
|
||||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||||
public void testauthorizePublicKeyBadFormat() {
|
public void testauthorizePublicKeyBadFormat() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.authorizePublicKey("whompy");
|
options.authorizePublicKey("whompy");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testauthorizePublicKey() throws IOException {
|
public void testauthorizePublicKey() throws IOException {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.authorizePublicKey("ssh-rsa");
|
options.authorizePublicKey("ssh-rsa");
|
||||||
assertEquals(options.getPublicKey(), "ssh-rsa");
|
assertEquals(options.getPublicKey(), "ssh-rsa");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNullauthorizePublicKey() {
|
public void testNullauthorizePublicKey() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
assertEquals(options.getPublicKey(), null);
|
assertEquals(options.getPublicKey(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testauthorizePublicKeyStatic() throws IOException {
|
public void testauthorizePublicKeyStatic() throws IOException {
|
||||||
SDCTemplateOptions options = authorizePublicKey("ssh-rsa");
|
JoyentCloudTemplateOptions options = authorizePublicKey("ssh-rsa");
|
||||||
assertEquals(options.getPublicKey(), "ssh-rsa");
|
assertEquals(options.getPublicKey(), "ssh-rsa");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +125,13 @@ public class SDCTemplateOptionsTest {
|
||||||
|
|
||||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||||
public void testblockOnPortBadFormat() {
|
public void testblockOnPortBadFormat() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.blockOnPort(-1, -1);
|
options.blockOnPort(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testblockOnPort() {
|
public void testblockOnPort() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.blockOnPort(22, 30);
|
options.blockOnPort(22, 30);
|
||||||
assertEquals(options.getPort(), 22);
|
assertEquals(options.getPort(), 22);
|
||||||
assertEquals(options.getSeconds(), 30);
|
assertEquals(options.getSeconds(), 30);
|
||||||
|
@ -139,27 +140,27 @@ public class SDCTemplateOptionsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNullblockOnPort() {
|
public void testNullblockOnPort() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
assertEquals(options.getPort(), -1);
|
assertEquals(options.getPort(), -1);
|
||||||
assertEquals(options.getSeconds(), -1);
|
assertEquals(options.getSeconds(), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testblockOnPortStatic() {
|
public void testblockOnPortStatic() {
|
||||||
SDCTemplateOptions options = blockOnPort(22, 30);
|
JoyentCloudTemplateOptions options = blockOnPort(22, 30);
|
||||||
assertEquals(options.getPort(), 22);
|
assertEquals(options.getPort(), 22);
|
||||||
assertEquals(options.getSeconds(), 30);
|
assertEquals(options.getSeconds(), 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||||
public void testinboundPortsBadFormat() {
|
public void testinboundPortsBadFormat() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.inboundPorts(-1, -1);
|
options.inboundPorts(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testinboundPorts() {
|
public void testinboundPorts() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
options.inboundPorts(22, 30);
|
options.inboundPorts(22, 30);
|
||||||
assertEquals(options.getInboundPorts()[0], 22);
|
assertEquals(options.getInboundPorts()[0], 22);
|
||||||
assertEquals(options.getInboundPorts()[1], 30);
|
assertEquals(options.getInboundPorts()[1], 30);
|
||||||
|
@ -168,13 +169,13 @@ public class SDCTemplateOptionsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultOpen22() {
|
public void testDefaultOpen22() {
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||||
assertEquals(options.getInboundPorts()[0], 22);
|
assertEquals(options.getInboundPorts()[0], 22);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testinboundPortsStatic() {
|
public void testinboundPortsStatic() {
|
||||||
SDCTemplateOptions options = inboundPorts(22, 30);
|
JoyentCloudTemplateOptions options = inboundPorts(22, 30);
|
||||||
assertEquals(options.getInboundPorts()[0], 22);
|
assertEquals(options.getInboundPorts()[0], 22);
|
||||||
assertEquals(options.getInboundPorts()[1], 30);
|
assertEquals(options.getInboundPorts()[1], 30);
|
||||||
}
|
}
|
|
@ -16,15 +16,15 @@
|
||||||
* specific language governing permisions and limitations
|
* specific language governing permisions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
@ -33,11 +33,11 @@ import com.google.common.collect.ImmutableMap;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "DatacenterClientExpectTest")
|
@Test(groups = "unit", testName = "DatacenterClientExpectTest")
|
||||||
public class DatacenterClientExpectTest extends BaseSDCClientExpectTest {
|
public class DatacenterClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||||
|
|
||||||
public void testGetDatacentersWhenResponseIs2xx() {
|
public void testGetDatacentersWhenResponseIs2xx() {
|
||||||
|
|
||||||
SDCClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
JoyentCloudClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
clientWhenDatacentersExists.getDatacenterClient().getDatacenters(),
|
clientWhenDatacentersExists.getDatacenterClient().getDatacenters(),
|
||||||
|
@ -50,7 +50,7 @@ public class DatacenterClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
public void testGetDatacentersWhenResponseIs404() {
|
public void testGetDatacentersWhenResponseIs404() {
|
||||||
HttpResponse getDatacentersResponse = HttpResponse.builder().statusCode(404).build();
|
HttpResponse getDatacentersResponse = HttpResponse.builder().statusCode(404).build();
|
||||||
|
|
||||||
SDCClient getDatacentersWhenNone = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
JoyentCloudClient getDatacentersWhenNone = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||||
|
|
||||||
assertEquals(getDatacentersWhenNone.getDatacenterClient().getDatacenters(), ImmutableMap.of());
|
assertEquals(getDatacentersWhenNone.getDatacenterClient().getDatacenters(), ImmutableMap.of());
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
@ -24,17 +24,17 @@ import static org.testng.Assert.assertTrue;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "DatacenterClientLiveTest")
|
@Test(groups = "live", testName = "DatacenterClientLiveTest")
|
||||||
public class DatacenterClientLiveTest extends BaseSDCClientLiveTest {
|
public class DatacenterClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||||
|
|
||||||
public void testGetDatacenters() {
|
public void testGetDatacenters() {
|
||||||
Map<String, URI> dcs = sdcContext.getApi().getDatacenterClient().getDatacenters();
|
Map<String, URI> dcs = cloudApiContext.getApi().getDatacenterClient().getDatacenters();
|
||||||
assertNotNull(dcs);
|
assertNotNull(dcs);
|
||||||
assertTrue(dcs.size() > 0);
|
assertTrue(dcs.size() > 0);
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permisions and limitations
|
* specific language governing permisions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseDatasetListTest;
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseDatasetListTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "DatasetClientExpectTest")
|
@Test(groups = "unit", testName = "DatasetClientExpectTest")
|
||||||
public class DatasetClientExpectTest extends BaseSDCClientExpectTest {
|
public class DatasetClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||||
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
||||||
URI.create("https://us-sw-1.api.joyentcloud.com/my/datasets")).headers(
|
URI.create("https://us-sw-1.api.joyentcloud.com/my/datasets")).headers(
|
||||||
ImmutableMultimap.<String, String> builder().put("X-Api-Version", "~6.5").put("Accept", "application/json")
|
ImmutableMultimap.<String, String> builder().put("X-Api-Version", "~6.5").put("Accept", "application/json")
|
||||||
|
@ -46,7 +46,7 @@ public class DatasetClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResource("/dataset_list.json")).build();
|
payloadFromResource("/dataset_list.json")).build();
|
||||||
|
|
||||||
SDCClient clientWhenDatasetsExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient clientWhenDatasetsExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(clientWhenDatasetsExists.getDatasetClientForDatacenter("us-sw-1").list().toString(), new ParseDatasetListTest()
|
assertEquals(clientWhenDatasetsExists.getDatasetClientForDatacenter("us-sw-1").list().toString(), new ParseDatasetListTest()
|
||||||
.expected().toString());
|
.expected().toString());
|
||||||
|
@ -55,7 +55,7 @@ public class DatasetClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
public void testListDatasetsWhenResponseIs404() {
|
public void testListDatasetsWhenResponseIs404() {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
||||||
|
|
||||||
SDCClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(listWhenNone.getDatasetClientForDatacenter("us-sw-1").list(), ImmutableSet.of());
|
assertEquals(listWhenNone.getDatasetClientForDatacenter("us-sw-1").list(), ImmutableSet.of());
|
||||||
}
|
}
|
|
@ -16,26 +16,27 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetClient;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "DatasetClientLiveTest")
|
@Test(groups = "live", testName = "DatasetClientLiveTest")
|
||||||
public class DatasetClientLiveTest extends BaseSDCClientLiveTest {
|
public class DatasetClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListAndGetDatasets() throws Exception {
|
public void testListAndGetDatasets() throws Exception {
|
||||||
for (String datacenterId : sdcContext.getApi().getConfiguredDatacenters()) {
|
for (String datacenterId : cloudApiContext.getApi().getConfiguredDatacenters()) {
|
||||||
DatasetClient client = sdcContext.getApi().getDatasetClientForDatacenter(datacenterId);
|
DatasetClient client = cloudApiContext.getApi().getDatasetClientForDatacenter(datacenterId);
|
||||||
Set<Dataset> response = client.list();
|
Set<Dataset> response = client.list();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
for (Dataset dataset : response) {
|
for (Dataset dataset : response) {
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permisions and limitations
|
* specific language governing permisions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -24,10 +24,10 @@ import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseKeyListTest;
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseKeyListTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseKeyTest;
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseKeyTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "KeyClientExpectTest")
|
@Test(groups = "unit", testName = "KeyClientExpectTest")
|
||||||
public class KeyClientExpectTest extends BaseSDCClientExpectTest {
|
public class KeyClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||||
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
||||||
URI.create("https://api.joyentcloud.com/my/keys")).headers(
|
URI.create("https://api.joyentcloud.com/my/keys")).headers(
|
||||||
ImmutableMultimap.<String, String> builder().put("X-Api-Version", "~6.5").put("Accept", "application/json")
|
ImmutableMultimap.<String, String> builder().put("X-Api-Version", "~6.5").put("Accept", "application/json")
|
||||||
|
@ -47,7 +47,7 @@ public class KeyClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResource("/key_list.json")).build();
|
payloadFromResource("/key_list.json")).build();
|
||||||
|
|
||||||
SDCClient clientWhenKeysExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient clientWhenKeysExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(clientWhenKeysExists.getKeyClient().list(), new ParseKeyListTest().expected());
|
assertEquals(clientWhenKeysExists.getKeyClient().list(), new ParseKeyListTest().expected());
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class KeyClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
public void testListKeysWhenResponseIs404() {
|
public void testListKeysWhenResponseIs404() {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
||||||
|
|
||||||
SDCClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(listWhenNone.getKeyClient().list(), ImmutableSet.of());
|
assertEquals(listWhenNone.getKeyClient().list(), ImmutableSet.of());
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class KeyClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
.payload(payloadFromResourceWithContentType("/key.json", "application/json; charset=UTF-8"))
|
.payload(payloadFromResourceWithContentType("/key.json", "application/json; charset=UTF-8"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
SDCClient clientWithNewKey = requestsSendResponses(getDatacenters, getDatacentersResponse, create, createResponse);
|
JoyentCloudClient clientWithNewKey = requestsSendResponses(getDatacenters, getDatacentersResponse, create, createResponse);
|
||||||
|
|
||||||
assertEquals(clientWithNewKey.getKeyClient().create(new ParseKeyTest().expected())
|
assertEquals(clientWithNewKey.getKeyClient().create(new ParseKeyTest().expected())
|
||||||
.toString(), new ParseKeyTest().expected().toString());
|
.toString(), new ParseKeyTest().expected().toString());
|
|
@ -16,15 +16,16 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.crypto.SshKeys;
|
import org.jclouds.crypto.SshKeys;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -32,11 +33,11 @@ import org.testng.annotations.Test;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "KeyClientLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "KeyClientLiveTest")
|
||||||
public class KeyClientLiveTest extends BaseSDCClientLiveTest {
|
public class KeyClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListAndGetKeys() throws Exception {
|
public void testListAndGetKeys() throws Exception {
|
||||||
KeyClient client = sdcContext.getApi().getKeyClient();
|
KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||||
Set<Key> response = client.list();
|
Set<Key> response = client.list();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
for (Key key : response) {
|
for (Key key : response) {
|
||||||
|
@ -58,7 +59,7 @@ public class KeyClientLiveTest extends BaseSDCClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateKey() {
|
public void testCreateKey() {
|
||||||
KeyClient client = sdcContext.getApi().getKeyClient();
|
KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||||
|
|
||||||
Key newKey = client.create(Key.builder().name(fingerprint).key(keyText).build());
|
Key newKey = client.create(Key.builder().name(fingerprint).key(keyText).build());
|
||||||
assertEquals(newKey.getName(), fingerprint);
|
assertEquals(newKey.getName(), fingerprint);
|
||||||
|
@ -71,13 +72,13 @@ public class KeyClientLiveTest extends BaseSDCClientLiveTest {
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateKey", expectedExceptions = IllegalStateException.class)
|
@Test(dependsOnMethods = "testCreateKey", expectedExceptions = IllegalStateException.class)
|
||||||
public void testDuplicateKey() {
|
public void testDuplicateKey() {
|
||||||
KeyClient client = sdcContext.getApi().getKeyClient();
|
KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||||
client.create(Key.builder().name(fingerprint).key(keyText).build());
|
client.create(Key.builder().name(fingerprint).key(keyText).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testDuplicateKey")
|
@Test(dependsOnMethods = "testDuplicateKey")
|
||||||
public void testDestroyKey() {
|
public void testDestroyKey() {
|
||||||
final KeyClient client = sdcContext.getApi().getKeyClient();
|
final KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||||
client.delete(fingerprint);
|
client.delete(fingerprint);
|
||||||
// not that eventhough the key is destroyed it is visible via GET for at
|
// not that eventhough the key is destroyed it is visible via GET for at
|
||||||
// least 45 seconds. This may be a cache issue on the server
|
// least 45 seconds. This may be a cache issue on the server
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permisions and limitations
|
* specific language governing permisions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -24,11 +24,11 @@ import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseCreatedMachineTest;
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseCreatedMachineTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseMachineListTest;
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseMachineListTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -38,7 +38,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "MachineClientExpectTest")
|
@Test(groups = "unit", testName = "MachineClientExpectTest")
|
||||||
public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
public class MachineClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||||
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
||||||
URI.create("https://us-sw-1.api.joyentcloud.com/my/machines")).headers(
|
URI.create("https://us-sw-1.api.joyentcloud.com/my/machines")).headers(
|
||||||
ImmutableMultimap.<String, String> builder().put("X-Api-Version", "~6.5").put("Accept", "application/json")
|
ImmutableMultimap.<String, String> builder().put("X-Api-Version", "~6.5").put("Accept", "application/json")
|
||||||
|
@ -48,7 +48,7 @@ public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResource("/machine_list.json")).build();
|
payloadFromResource("/machine_list.json")).build();
|
||||||
|
|
||||||
SDCClient clientWhenMachinesExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient clientWhenMachinesExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(clientWhenMachinesExists.getMachineClientForDatacenter("us-sw-1").list(), new ParseMachineListTest().expected());
|
assertEquals(clientWhenMachinesExists.getMachineClientForDatacenter("us-sw-1").list(), new ParseMachineListTest().expected());
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
public void testListMachinesWhenResponseIs404() {
|
public void testListMachinesWhenResponseIs404() {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
||||||
|
|
||||||
SDCClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(listWhenNone.getMachineClientForDatacenter("us-sw-1").list(), ImmutableSet.of());
|
assertEquals(listWhenNone.getMachineClientForDatacenter("us-sw-1").list(), ImmutableSet.of());
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
.payload(payloadFromResourceWithContentType("/new_machine.json", "application/json; charset=UTF-8"))
|
.payload(payloadFromResourceWithContentType("/new_machine.json", "application/json; charset=UTF-8"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
SDCClient clientWithNewMachine = requestsSendResponses(getDatacenters, getDatacentersResponse, createWithDataset, createWithDatasetResponse);
|
JoyentCloudClient clientWithNewMachine = requestsSendResponses(getDatacenters, getDatacentersResponse, createWithDataset, createWithDatasetResponse);
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
clientWithNewMachine
|
clientWithNewMachine
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static com.google.common.base.Predicates.not;
|
import static com.google.common.base.Predicates.not;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
@ -29,11 +29,12 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.jclouds.compute.domain.ExecResponse;
|
import org.jclouds.compute.domain.ExecResponse;
|
||||||
import org.jclouds.crypto.SshKeys;
|
import org.jclouds.crypto.SshKeys;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
import org.jclouds.joyent.cloudapi.v6_5.features.MachineClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.reference.Metadata;
|
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.reference.Metadata;
|
||||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
|
@ -53,12 +54,12 @@ import com.google.inject.Module;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "MachineClientLiveTest")
|
@Test(groups = "live", testName = "MachineClientLiveTest")
|
||||||
public class MachineClientLiveTest extends BaseSDCClientLiveTest {
|
public class MachineClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListAndGetMachines() throws Exception {
|
public void testListAndGetMachines() throws Exception {
|
||||||
for (String datacenterId : sdcContext.getApi().getConfiguredDatacenters()) {
|
for (String datacenterId : cloudApiContext.getApi().getConfiguredDatacenters()) {
|
||||||
MachineClient client = sdcContext.getApi().getMachineClientForDatacenter(datacenterId);
|
MachineClient client = cloudApiContext.getApi().getMachineClientForDatacenter(datacenterId);
|
||||||
Set<Machine> response = client.list();
|
Set<Machine> response = client.list();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
for (Machine machine : response) {
|
for (Machine machine : response) {
|
||||||
|
@ -93,9 +94,9 @@ public class MachineClientLiveTest extends BaseSDCClientLiveTest {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
key = SshKeys.generate();
|
key = SshKeys.generate();
|
||||||
fingerprint = SshKeys.fingerprintPublicKey(key.get("public"));
|
fingerprint = SshKeys.fingerprintPublicKey(key.get("public"));
|
||||||
sdcContext.getApi().getKeyClient().create(Key.builder().name(fingerprint).key(key.get("public")).build());
|
cloudApiContext.getApi().getKeyClient().create(Key.builder().name(fingerprint).key(key.get("public")).build());
|
||||||
client = sdcContext.getApi().getMachineClientForDatacenter(
|
client = cloudApiContext.getApi().getMachineClientForDatacenter(
|
||||||
Iterables.get(sdcContext.getApi().getConfiguredDatacenters(), 0));
|
Iterables.get(cloudApiContext.getApi().getConfiguredDatacenters(), 0));
|
||||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 180, 1, 1, TimeUnit.SECONDS);
|
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 180, 1, 1, TimeUnit.SECONDS);
|
||||||
machineRunning = new RetryablePredicate<Machine>(new Predicate<Machine>() {
|
machineRunning = new RetryablePredicate<Machine>(new Predicate<Machine>() {
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ public class MachineClientLiveTest extends BaseSDCClientLiveTest {
|
||||||
protected void tearDown() {
|
protected void tearDown() {
|
||||||
if (machine != null)
|
if (machine != null)
|
||||||
client.delete(machine.getId());
|
client.delete(machine.getId());
|
||||||
sdcContext.getApi().getKeyClient().delete(fingerprint);
|
cloudApiContext.getApi().getKeyClient().delete(fingerprint);
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permisions and limitations
|
* specific language governing permisions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.parse.ParsePackageListTest;
|
import org.jclouds.joyent.cloudapi.v6_5.parse.ParsePackageListTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "PackageClientExpectTest")
|
@Test(groups = "unit", testName = "PackageClientExpectTest")
|
||||||
public class PackageClientExpectTest extends BaseSDCClientExpectTest {
|
public class PackageClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||||
HttpRequest list = HttpRequest
|
HttpRequest list = HttpRequest
|
||||||
.builder()
|
.builder()
|
||||||
.method("GET")
|
.method("GET")
|
||||||
|
@ -50,7 +50,7 @@ public class PackageClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResource("/package_list.json")).build();
|
.payload(payloadFromResource("/package_list.json")).build();
|
||||||
|
|
||||||
SDCClient clientWhenPackagesExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient clientWhenPackagesExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(clientWhenPackagesExists.getPackageClientForDatacenter("us-sw-1").list(), new ParsePackageListTest().expected());
|
assertEquals(clientWhenPackagesExists.getPackageClientForDatacenter("us-sw-1").list(), new ParsePackageListTest().expected());
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class PackageClientExpectTest extends BaseSDCClientExpectTest {
|
||||||
public void testListPackagesWhenResponseIs404() {
|
public void testListPackagesWhenResponseIs404() {
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
||||||
|
|
||||||
SDCClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
JoyentCloudClient listWhenNone = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);
|
||||||
|
|
||||||
assertEquals(listWhenNone.getPackageClientForDatacenter("us-sw-1").list(), ImmutableSet.of());
|
assertEquals(listWhenNone.getPackageClientForDatacenter("us-sw-1").list(), ImmutableSet.of());
|
||||||
}
|
}
|
|
@ -16,26 +16,27 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.features;
|
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Package;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Package;
|
||||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
import org.jclouds.joyent.cloudapi.v6_5.features.PackageClient;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "PackageClientLiveTest")
|
@Test(groups = "live", testName = "PackageClientLiveTest")
|
||||||
public class PackageClientLiveTest extends BaseSDCClientLiveTest {
|
public class PackageClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListAndGetPackages() throws Exception {
|
public void testListAndGetPackages() throws Exception {
|
||||||
for (String datacenterId : sdcContext.getApi().getConfiguredDatacenters()) {
|
for (String datacenterId : cloudApiContext.getApi().getConfiguredDatacenters()) {
|
||||||
PackageClient client = sdcContext.getApi().getPackageClientForDatacenter(datacenterId);
|
PackageClient client = cloudApiContext.getApi().getPackageClientForDatacenter(datacenterId);
|
||||||
Set<Package> response = client.list();
|
Set<Package> response = client.list();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
for (Package pkg : response) {
|
for (Package pkg : response) {
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.handlers;
|
package org.jclouds.joyent.cloudapi.v6_5.handlers;
|
||||||
|
|
||||||
import static org.easymock.EasyMock.createMockBuilder;
|
import static org.easymock.EasyMock.createMockBuilder;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
|
@ -31,6 +31,7 @@ import org.jclouds.http.HttpCommand;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.io.Payloads;
|
import org.jclouds.io.Payloads;
|
||||||
|
import org.jclouds.joyent.cloudapi.v6_5.handlers.JoyentCloudErrorHandler;
|
||||||
import org.jclouds.util.Strings2;
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -38,8 +39,8 @@ import org.testng.annotations.Test;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "SDCErrorHandlerTest")
|
@Test(groups = "unit", testName = "JoyentCloudErrorHandlerTest")
|
||||||
public class SDCErrorHandlerTest {
|
public class JoyentCloudErrorHandlerTest {
|
||||||
|
|
||||||
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
|
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
|
||||||
Class<? extends Exception> expected) {
|
Class<? extends Exception> expected) {
|
||||||
|
@ -49,7 +50,7 @@ public class SDCErrorHandlerTest {
|
||||||
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
|
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
|
||||||
String content, Class<? extends Exception> expected) {
|
String content, Class<? extends Exception> expected) {
|
||||||
|
|
||||||
SDCErrorHandler function = new SDCErrorHandler();
|
JoyentCloudErrorHandler function = new JoyentCloudErrorHandler();
|
||||||
|
|
||||||
HttpCommand command = createMockBuilder(HttpCommand.class).createMock();
|
HttpCommand command = createMockBuilder(HttpCommand.class).createMock();
|
||||||
HttpRequest request = new HttpRequest(method, uri);
|
HttpRequest request = new HttpRequest(method, uri);
|
|
@ -16,24 +16,24 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.internal;
|
package org.jclouds.joyent.cloudapi.v6_5.internal;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncClient;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for writing KeyStone Rest Client Expect tests
|
* Base class for writing Cloud Api Rest Client Expect tests
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseSDCAsyncClientExpectTest extends BaseSDCExpectTest<SDCAsyncClient> {
|
public class BaseJoyentCloudAsyncClientExpectTest extends BaseJoyentCloudExpectTest<JoyentCloudAsyncClient> {
|
||||||
public SDCAsyncClient createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
public JoyentCloudAsyncClient createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
||||||
return createInjector(fn, module, props).getInstance(SDCAsyncClient.class);
|
return createInjector(fn, module, props).getInstance(JoyentCloudAsyncClient.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,22 +16,22 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.internal;
|
package org.jclouds.joyent.cloudapi.v6_5.internal;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for writing KeyStone Rest Client Expect tests
|
* Base class for writing Cloud Api Rest Client Expect tests
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseSDCClientExpectTest extends BaseSDCExpectTest<SDCClient> {
|
public class BaseJoyentCloudClientExpectTest extends BaseJoyentCloudExpectTest<JoyentCloudClient> {
|
||||||
protected HttpRequest getDatacenters = HttpRequest
|
protected HttpRequest getDatacenters = HttpRequest
|
||||||
.builder()
|
.builder()
|
||||||
.method("GET")
|
.method("GET")
|
|
@ -16,11 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.internal;
|
package org.jclouds.joyent.cloudapi.v6_5.internal;
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCAsyncClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncClient;
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.testng.annotations.AfterGroups;
|
||||||
|
@ -30,30 +30,30 @@ import org.testng.annotations.Test;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code SDCClient}
|
* Tests behavior of {@code JoyentCloudClient}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class BaseSDCClientLiveTest extends BaseComputeServiceContextLiveTest {
|
public class BaseJoyentCloudClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
|
|
||||||
public BaseSDCClientLiveTest() {
|
public BaseJoyentCloudClientLiveTest() {
|
||||||
provider = "joyent-sdc";
|
provider = "joyent-cloudapi";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RestContext<SDCClient, SDCAsyncClient> sdcContext;
|
protected RestContext<JoyentCloudClient, JoyentCloudAsyncClient> cloudApiContext;
|
||||||
|
|
||||||
@BeforeGroups(groups = { "integration", "live" })
|
@BeforeGroups(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
sdcContext = view.unwrap();
|
cloudApiContext = view.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDown() {
|
protected void tearDown() {
|
||||||
if (sdcContext != null)
|
if (cloudApiContext != null)
|
||||||
sdcContext.close();
|
cloudApiContext.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -16,18 +16,18 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.internal;
|
package org.jclouds.joyent.cloudapi.v6_5.internal;
|
||||||
|
|
||||||
import org.jclouds.rest.internal.BaseRestClientExpectTest;
|
import org.jclouds.rest.internal.BaseRestClientExpectTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for writing SDC Expect tests
|
* Base class for writing JoyentCloud Expect tests
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseSDCExpectTest<T> extends BaseRestClientExpectTest<T> {
|
public class BaseJoyentCloudExpectTest<T> extends BaseRestClientExpectTest<T> {
|
||||||
|
|
||||||
public BaseSDCExpectTest() {
|
public BaseJoyentCloudExpectTest() {
|
||||||
provider = "joyent-sdc";
|
provider = "joyent-cloudapi";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,16 +16,16 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.domain.JsonBall;
|
import org.jclouds.domain.JsonBall;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||||
import org.jclouds.json.BaseItemParserTest;
|
import org.jclouds.json.BaseItemParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -68,7 +68,7 @@ public class ParseCreatedMachineTest extends BaseItemParserTest<Machine> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||||
import org.jclouds.json.BaseSetParserTest;
|
import org.jclouds.json.BaseSetParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -64,7 +64,7 @@ public class ParseDatasetListTest extends BaseSetParserTest<Dataset> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,15 +16,15 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||||
import org.jclouds.json.BaseItemParserTest;
|
import org.jclouds.json.BaseItemParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -52,7 +52,7 @@ public class ParseDatasetTest extends BaseItemParserTest<Dataset> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.json.BaseSetParserTest;
|
import org.jclouds.json.BaseSetParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -58,7 +58,7 @@ public class ParseKeyListTest extends BaseSetParserTest<Key> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,14 +16,14 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||||
import org.jclouds.json.BaseItemParserTest;
|
import org.jclouds.json.BaseItemParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -53,7 +53,7 @@ public class ParseKeyTest extends BaseItemParserTest<Key> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.domain.JsonBall;
|
import org.jclouds.domain.JsonBall;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||||
import org.jclouds.json.BaseSetParserTest;
|
import org.jclouds.json.BaseSetParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -81,7 +81,7 @@ public class ParseMachineListTest extends BaseSetParserTest<Machine> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,16 +16,16 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.domain.JsonBall;
|
import org.jclouds.domain.JsonBall;
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||||
import org.jclouds.json.BaseItemParserTest;
|
import org.jclouds.json.BaseItemParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -67,7 +67,7 @@ public class ParseMachineTest extends BaseItemParserTest<Machine> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,15 +16,15 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.joyent.sdc.v6_5.domain.Package;
|
import org.jclouds.joyent.cloudapi.v6_5.domain.Package;
|
||||||
import org.jclouds.json.BaseSetParserTest;
|
import org.jclouds.json.BaseSetParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -47,17 +47,17 @@ public class ParsePackageListTest extends BaseSetParserTest<Package> {
|
||||||
@Override
|
@Override
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public Set<Package> expected() {
|
public Set<Package> expected() {
|
||||||
return ImmutableSet.of(org.jclouds.joyent.sdc.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
return ImmutableSet.of(org.jclouds.joyent.cloudapi.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
||||||
.diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build(),
|
.diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build(),
|
||||||
|
|
||||||
org.jclouds.joyent.sdc.v6_5.domain.Package.builder().name("Medium 2GB").memorySizeMb(2048).diskSizeGb(61440)
|
org.jclouds.joyent.cloudapi.v6_5.domain.Package.builder().name("Medium 2GB").memorySizeMb(2048).diskSizeGb(61440)
|
||||||
.swapSizeMb(4096).isDefault(false).build()
|
.swapSizeMb(4096).isDefault(false).build()
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -16,12 +16,12 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||||
import org.jclouds.json.BaseItemParserTest;
|
import org.jclouds.json.BaseItemParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -33,7 +33,7 @@ import com.google.inject.Injector;
|
||||||
* @author Gerald Pereira
|
* @author Gerald Pereira
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "ParsePackageTest")
|
@Test(groups = "unit", testName = "ParsePackageTest")
|
||||||
public class ParsePackageTest extends BaseItemParserTest<org.jclouds.joyent.sdc.v6_5.domain.Package> {
|
public class ParsePackageTest extends BaseItemParserTest<org.jclouds.joyent.cloudapi.v6_5.domain.Package> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String resource() {
|
public String resource() {
|
||||||
|
@ -42,13 +42,13 @@ public class ParsePackageTest extends BaseItemParserTest<org.jclouds.joyent.sdc.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public org.jclouds.joyent.sdc.v6_5.domain.Package expected() {
|
public org.jclouds.joyent.cloudapi.v6_5.domain.Package expected() {
|
||||||
return org.jclouds.joyent.sdc.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
return org.jclouds.joyent.cloudapi.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
||||||
.diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build();
|
.diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Injector injector() {
|
protected Injector injector() {
|
||||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
|
@ -1,337 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds 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.joyent.sdc.v6_5.compute.options;
|
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.jclouds.compute.options.TemplateOptions;
|
|
||||||
import org.jclouds.domain.LoginCredentials;
|
|
||||||
import org.jclouds.scriptbuilder.domain.Statement;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains options supported in the {@code ComputeService#runNode} operation on the
|
|
||||||
* "joyent-sdc" provider. <h2>Usage</h2> The recommended way to instantiate a
|
|
||||||
* SDCTemplateOptions object is to statically import SDCTemplateOptions.* and invoke a static
|
|
||||||
* creation method followed by an instance mutator (if needed):
|
|
||||||
* <p/>
|
|
||||||
* <code>
|
|
||||||
* import static org.jclouds.aws.ec2.compute.options.SDCTemplateOptions.Builder.*;
|
|
||||||
* <p/>
|
|
||||||
* ComputeService client = // get connection
|
|
||||||
* templateBuilder.options(inboundPorts(22, 80, 8080, 443));
|
|
||||||
* Set<? extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
|
|
||||||
* <code>
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class SDCTemplateOptions extends TemplateOptions implements Cloneable {
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions clone() {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
copyTo(options);
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void copyTo(TemplateOptions to) {
|
|
||||||
super.copyTo(to);
|
|
||||||
if (to instanceof SDCTemplateOptions) {
|
|
||||||
SDCTemplateOptions eTo = SDCTemplateOptions.class.cast(to);
|
|
||||||
eTo.generateKey(shouldGenerateKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean generateKey = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o)
|
|
||||||
return true;
|
|
||||||
if (o == null || getClass() != o.getClass())
|
|
||||||
return false;
|
|
||||||
SDCTemplateOptions that = SDCTemplateOptions.class.cast(o);
|
|
||||||
return super.equals(that) && equal(this.generateKey, that.generateKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hashCode(super.hashCode(), generateKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ToStringHelper string() {
|
|
||||||
ToStringHelper toString = super.string();
|
|
||||||
if (generateKey)
|
|
||||||
toString.add("generateKey", generateKey);
|
|
||||||
return toString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see #shouldGenerateKey()
|
|
||||||
*/
|
|
||||||
public SDCTemplateOptions generateKey(boolean enable) {
|
|
||||||
this.generateKey = enable;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return true if auto generation of keys is enabled
|
|
||||||
*/
|
|
||||||
public boolean shouldGenerateKey() {
|
|
||||||
return generateKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SDCTemplateOptions#shouldGenerateKey()
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions generateKey(boolean enable) {
|
|
||||||
return new SDCTemplateOptions().generateKey(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// methods that only facilitate returning the correct object type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#inboundPorts
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions inboundPorts(int... ports) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return SDCTemplateOptions.class.cast(options.inboundPorts(ports));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#port
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions blockOnPort(int port, int seconds) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return SDCTemplateOptions.class.cast(options.blockOnPort(port, seconds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#installPrivateKey
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions installPrivateKey(String rsaKey) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return SDCTemplateOptions.class.cast(options.installPrivateKey(rsaKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#authorizePublicKey
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions authorizePublicKey(String rsaKey) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return SDCTemplateOptions.class.cast(options.authorizePublicKey(rsaKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#userMetadata
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions userMetadata(Map<String, String> userMetadata) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return SDCTemplateOptions.class.cast(options.userMetadata(userMetadata));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#overrideLoginUser
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions overrideLoginUser(String user) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return options.overrideLoginUser(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#overrideLoginPassword
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions overrideLoginPassword(String password) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return options.overrideLoginPassword(password);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#overrideLoginPrivateKey
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions overrideLoginPrivateKey(String privateKey) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return options.overrideLoginPrivateKey(privateKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#overrideAuthenticateSudo
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return options.overrideAuthenticateSudo(authenticateSudo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#overrideLoginCredentials
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return options.overrideLoginCredentials(credentials);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see TemplateOptions#blockUntilRunning
|
|
||||||
*/
|
|
||||||
public static SDCTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
|
|
||||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
|
||||||
return options.blockUntilRunning(blockUntilRunning);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// methods that only facilitate returning the correct object type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions blockOnPort(int port, int seconds) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.blockOnPort(port, seconds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions inboundPorts(int... ports) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.inboundPorts(ports));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions authorizePublicKey(String publicKey) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions installPrivateKey(String privateKey) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions dontAuthorizePublicKey() {
|
|
||||||
return SDCTemplateOptions.class.cast(super.dontAuthorizePublicKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions nameTask(String name) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.nameTask(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions runAsRoot(boolean runAsRoot) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.runAsRoot(runAsRoot));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions runScript(Statement script) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.runScript(script));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions overrideLoginPassword(String password) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.overrideLoginPassword(password));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions overrideLoginPrivateKey(String privateKey) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions overrideLoginUser(String loginUser) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.overrideLoginUser(loginUser));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions userMetadata(Map<String, String> userMetadata) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.userMetadata(userMetadata));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SDCTemplateOptions userMetadata(String key, String value) {
|
|
||||||
return SDCTemplateOptions.class.cast(super.userMetadata(key, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
org.jclouds.joyent.sdc.v6_5.SDCApiMetadata
|
|
|
@ -50,12 +50,12 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jclouds.labs</groupId>
|
<groupId>org.jclouds.labs</groupId>
|
||||||
<artifactId>joyent-sdc</artifactId>
|
<artifactId>joyent-cloudapi</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jclouds.labs</groupId>
|
<groupId>org.jclouds.labs</groupId>
|
||||||
<artifactId>joyent-sdc</artifactId>
|
<artifactId>joyent-cloudapi</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
|
@ -25,7 +25,7 @@ import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.SDCApiMetadata;
|
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApiMetadata;
|
||||||
import org.jclouds.providers.ProviderMetadata;
|
import org.jclouds.providers.ProviderMetadata;
|
||||||
import org.jclouds.providers.internal.BaseProviderMetadata;
|
import org.jclouds.providers.internal.BaseProviderMetadata;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class JoyentCloudProviderMetadata extends BaseProviderMetadata {
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
id("joyentcloud")
|
id("joyentcloud")
|
||||||
.name("JoyentCloud")
|
.name("JoyentCloud")
|
||||||
.apiMetadata(new SDCApiMetadata())
|
.apiMetadata(new JoyentCloudApiMetadata())
|
||||||
.homepage(URI.create("http://www.joyent.com/products/smartdatacenter/"))
|
.homepage(URI.create("http://www.joyent.com/products/smartdatacenter/"))
|
||||||
.console(URI.create("https://my.joyentcloud.com/login"))
|
.console(URI.create("https://my.joyentcloud.com/login"))
|
||||||
.iso3166Codes("US-VA", "US-CA", "US-NV", "NL-NH")
|
.iso3166Codes("US-VA", "US-CA", "US-NV", "NL-NH")
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.joyent.joyentcloud;
|
package org.jclouds.joyent.joyentcloud;
|
||||||
|
|
||||||
import org.jclouds.joyent.sdc.v6_5.compute.SDCComputeServiceLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +25,7 @@ import org.testng.annotations.Test;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "JoyentCloudComputeServiceLiveTest")
|
@Test(groups = "live", singleThreaded = true, testName = "JoyentCloudComputeServiceLiveTest")
|
||||||
public class JoyentCloudComputeServiceLiveTest extends SDCComputeServiceLiveTest {
|
public class JoyentCloudComputeServiceLiveTest extends org.jclouds.joyent.cloudapi.v6_5.compute.JoyentCloudComputeServiceLiveTest {
|
||||||
|
|
||||||
public JoyentCloudComputeServiceLiveTest() {
|
public JoyentCloudComputeServiceLiveTest() {
|
||||||
provider = "joyentcloud";
|
provider = "joyentcloud";
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue