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>
|
||||
</parent>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>joyent-sdc</artifactId>
|
||||
<name>jcloud joyent-sdc api</name>
|
||||
<artifactId>joyent-cloudapi</artifactId>
|
||||
<name>jcloud joyent-cloudapi api</name>
|
||||
<description>jclouds components to access an implementation of Joyent SDC</description>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<properties>
|
||||
<test.joyent-sdc.endpoint>https://api.joyentcloud.com</test.joyent-sdc.endpoint>
|
||||
<test.joyent-sdc.api-version>~6.5</test.joyent-sdc.api-version>
|
||||
<test.joyent-sdc.build-version></test.joyent-sdc.build-version>
|
||||
<test.joyent-sdc.identity>FIXME_IDENTITY</test.joyent-sdc.identity>
|
||||
<test.joyent-sdc.credential>FIXME_CREDENTIALS</test.joyent-sdc.credential>
|
||||
<jclouds.osgi.export>org.jclouds.joyent.sdc.v6_5*;version="${project.version}"</jclouds.osgi.export>
|
||||
<test.joyent-cloudapi.endpoint>https://api.joyentcloud.com</test.joyent-cloudapi.endpoint>
|
||||
<test.joyent-cloudapi.api-version>~6.5</test.joyent-cloudapi.api-version>
|
||||
<test.joyent-cloudapi.build-version></test.joyent-cloudapi.build-version>
|
||||
<test.joyent-cloudapi.identity>FIXME_IDENTITY</test.joyent-cloudapi.identity>
|
||||
<test.joyent-cloudapi.credential>FIXME_CREDENTIALS</test.joyent-cloudapi.credential>
|
||||
<jclouds.osgi.export>org.jclouds.joyent.cloudapi.v6_5*;version="${project.version}"</jclouds.osgi.export>
|
||||
<jclouds.osgi.import>
|
||||
org.jclouds.rest.internal;version="${project.version}",
|
||||
org.jclouds*;version="${project.version}",
|
||||
|
@ -104,11 +104,11 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<test.joyent-sdc.endpoint>${test.joyent-sdc.endpoint}</test.joyent-sdc.endpoint>
|
||||
<test.joyent-sdc.api-version>${test.joyent-sdc.api-version}</test.joyent-sdc.api-version>
|
||||
<test.joyent-sdc.build-version>${test.joyent-sdc.build-version}</test.joyent-sdc.build-version>
|
||||
<test.joyent-sdc.identity>${test.joyent-sdc.identity}</test.joyent-sdc.identity>
|
||||
<test.joyent-sdc.credential>${test.joyent-sdc.credential}</test.joyent-sdc.credential>
|
||||
<test.joyent-cloudapi.endpoint>${test.joyent-cloudapi.endpoint}</test.joyent-cloudapi.endpoint>
|
||||
<test.joyent-cloudapi.api-version>${test.joyent-cloudapi.api-version}</test.joyent-cloudapi.api-version>
|
||||
<test.joyent-cloudapi.build-version>${test.joyent-cloudapi.build-version}</test.joyent-cloudapi.build-version>
|
||||
<test.joyent-cloudapi.identity>${test.joyent-cloudapi.identity}</test.joyent-cloudapi.identity>
|
||||
<test.joyent-cloudapi.credential>${test.joyent-cloudapi.credential}</test.joyent-cloudapi.credential>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
|
@ -16,17 +16,17 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5;
|
||||
package org.jclouds.joyent.cloudapi.v6_5;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.config.SDCComputeServiceContextModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.DatacentersAreZonesModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCProperties;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCRestClientModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.config.JoyentCloudComputeServiceContextModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.DatacentersAreZonesModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudProperties;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudRestClientModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||
|
||||
|
@ -35,16 +35,16 @@ import com.google.common.reflect.TypeToken;
|
|||
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
|
||||
*/
|
||||
public class SDCApiMetadata extends BaseRestApiMetadata {
|
||||
public class JoyentCloudApiMetadata extends BaseRestApiMetadata {
|
||||
|
||||
/** The serialVersionUID */
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -53,39 +53,39 @@ public class SDCApiMetadata extends BaseRestApiMetadata {
|
|||
return new Builder().fromApiMetadata(this);
|
||||
}
|
||||
|
||||
public SDCApiMetadata() {
|
||||
public JoyentCloudApiMetadata() {
|
||||
this(new Builder());
|
||||
}
|
||||
|
||||
protected SDCApiMetadata(Builder builder) {
|
||||
protected JoyentCloudApiMetadata(Builder builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
properties.setProperty(SDCProperties.AUTOGENERATE_KEYS, "true");
|
||||
properties.setProperty(JoyentCloudProperties.AUTOGENERATE_KEYS, "true");
|
||||
return properties;
|
||||
}
|
||||
|
||||
public static class Builder extends BaseRestApiMetadata.Builder {
|
||||
|
||||
protected Builder() {
|
||||
super(SDCClient.class, SDCAsyncClient.class);
|
||||
id("joyent-sdc")
|
||||
.name("Joyent SDC API")
|
||||
super(JoyentCloudClient.class, JoyentCloudAsyncClient.class);
|
||||
id("joyent-cloudapi")
|
||||
.name("Joyent Cloud API")
|
||||
.identityName("username")
|
||||
.credentialName("password")
|
||||
.documentation(URI.create("http://sdc.joyent.org/sdcapi.html"))
|
||||
.documentation(URI.create("http://cloudApi.joyent.org/cloudApiapi.html"))
|
||||
.version("~6.5")
|
||||
.defaultEndpoint("https://api.joyentcloud.com")
|
||||
.defaultProperties(SDCApiMetadata.defaultProperties())
|
||||
.defaultProperties(JoyentCloudApiMetadata.defaultProperties())
|
||||
.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
|
||||
public SDCApiMetadata build() {
|
||||
return new SDCApiMetadata(this);
|
||||
public JoyentCloudApiMetadata build() {
|
||||
return new JoyentCloudApiMetadata(this);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -16,16 +16,16 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5;
|
||||
package org.jclouds.joyent.cloudapi.v6_5;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.KeyAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.MachineAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.PackageAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.KeyAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.MachineAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.PackageAsyncClient;
|
||||
import org.jclouds.location.Zone;
|
||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
|
@ -34,14 +34,14 @@ import org.jclouds.rest.annotations.EndpointParam;
|
|||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to SDC via their REST API.
|
||||
* Provides asynchronous access to JoyentCloud via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @see SDCClient
|
||||
* @see <a href="http://sdc.joyent.org/sdcapi.html">api doc</a>
|
||||
* @see JoyentCloudClient
|
||||
* @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface SDCAsyncClient {
|
||||
public interface JoyentCloudAsyncClient {
|
||||
|
||||
/**
|
||||
*
|
|
@ -16,18 +16,18 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5;
|
||||
package org.jclouds.joyent.cloudapi.v6_5;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.MachineClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.PackageClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.MachineClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.PackageClient;
|
||||
import org.jclouds.location.Zone;
|
||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
|
@ -36,15 +36,15 @@ import org.jclouds.rest.annotations.EndpointParam;
|
|||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to SDC.
|
||||
* Provides synchronous access to JoyentCloud.
|
||||
* <p/>
|
||||
*
|
||||
* @see SDCAsyncClient
|
||||
* @see <a href="http://sdc.joyent.org/sdcapi.html">api doc</a>
|
||||
* @see JoyentCloudAsyncClient
|
||||
* @see <a href="http://cloudApi.joyent.org/cloudApiapi.html">api doc</a>
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface SDCClient {
|
||||
public interface JoyentCloudClient {
|
||||
|
||||
/**
|
||||
*
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.binders;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.binders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
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.rest.binders.BindToJsonPayload;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 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.domain.Credentials;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.predicates.KeyPredicates;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.predicates.KeyPredicates;
|
||||
import org.jclouds.scriptbuilder.functions.InitAdminAccess;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
@ -80,14 +80,14 @@ import com.google.common.collect.Multimap;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class SDCComputeService extends BaseComputeService {
|
||||
protected final SDCClient novaClient;
|
||||
public class JoyentCloudComputeService extends BaseComputeService {
|
||||
protected final JoyentCloudClient novaClient;
|
||||
protected final LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache;
|
||||
protected final Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByDatacenterId;
|
||||
protected final GroupNamingConvention.Factory namingConvention;
|
||||
|
||||
@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 Location>> locations, ListNodesStrategy listNodesStrategy,
|
||||
GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
|
||||
|
@ -101,7 +101,7 @@ public class SDCComputeService extends BaseComputeService {
|
|||
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
|
||||
RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
|
||||
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,
|
||||
Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByDatacenterId,
|
||||
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
|
||||
public SDCTemplateOptions templateOptions() {
|
||||
return SDCTemplateOptions.class.cast(super.templateOptions());
|
||||
public JoyentCloudTemplateOptions templateOptions() {
|
||||
return JoyentCloudTemplateOptions.class.cast(super.templateOptions());
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.collect.Iterables.transform;
|
||||
|
@ -33,14 +33,14 @@ import org.jclouds.compute.domain.Template;
|
|||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndId;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndId;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.location.Zone;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
|
@ -50,24 +50,24 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
|
||||
/**
|
||||
* The adapter used by the SDCComputeServiceContextModule to interface the
|
||||
* SDC-specific domain model to the computeService generic domain model.
|
||||
* The adapter used by the JoyentCloudComputeServiceContextModule to interface the
|
||||
* JoyentCloud-specific domain model to the computeService generic domain model.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class SDCComputeServiceAdapter implements
|
||||
public class JoyentCloudComputeServiceAdapter implements
|
||||
ComputeServiceAdapter<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location> {
|
||||
|
||||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
protected final SDCClient sdcClient;
|
||||
protected final JoyentCloudClient cloudApiClient;
|
||||
protected final Supplier<Set<String>> datacenterIds;
|
||||
|
||||
@Inject
|
||||
public SDCComputeServiceAdapter(SDCClient sdcClient, @Zone Supplier<Set<String>> datacenterIds) {
|
||||
this.sdcClient = checkNotNull(sdcClient, "sdcClient");
|
||||
public JoyentCloudComputeServiceAdapter(JoyentCloudClient cloudApiClient, @Zone Supplier<Set<String>> datacenterIds) {
|
||||
this.cloudApiClient = checkNotNull(cloudApiClient, "cloudApiClient");
|
||||
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,
|
||||
options);
|
||||
Machine machine = sdcClient.getMachineClientForDatacenter(datacenterId).createWithDataset(datasetURN, options);
|
||||
Machine machine = cloudApiClient.getMachineClientForDatacenter(datacenterId).createWithDataset(datasetURN, options);
|
||||
|
||||
logger.trace("<< machine(%s)", machine.getId());
|
||||
|
||||
|
@ -105,11 +105,11 @@ public class SDCComputeServiceAdapter implements
|
|||
public Iterable<PackageInDatacenter> listHardwareProfiles() {
|
||||
Builder<PackageInDatacenter> builder = ImmutableSet.builder();
|
||||
for (final String datacenterId : datacenterIds.get()) {
|
||||
builder.addAll(transform(sdcClient.getPackageClientForDatacenter(datacenterId).list(),
|
||||
new Function<org.jclouds.joyent.sdc.v6_5.domain.Package, PackageInDatacenter>() {
|
||||
builder.addAll(transform(cloudApiClient.getPackageClientForDatacenter(datacenterId).list(),
|
||||
new Function<org.jclouds.joyent.cloudapi.v6_5.domain.Package, PackageInDatacenter>() {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public class SDCComputeServiceAdapter implements
|
|||
public Iterable<DatasetInDatacenter> listImages() {
|
||||
Builder<DatasetInDatacenter> builder = ImmutableSet.builder();
|
||||
for (final String datacenterId : datacenterIds.get()) {
|
||||
builder.addAll(transform(sdcClient.getDatasetClientForDatacenter(datacenterId).list(),
|
||||
builder.addAll(transform(cloudApiClient.getDatasetClientForDatacenter(datacenterId).list(),
|
||||
new Function<Dataset, DatasetInDatacenter>() {
|
||||
|
||||
@Override
|
||||
|
@ -139,7 +139,7 @@ public class SDCComputeServiceAdapter implements
|
|||
public Iterable<MachineInDatacenter> listNodes() {
|
||||
Builder<MachineInDatacenter> builder = ImmutableSet.builder();
|
||||
for (final String datacenterId : datacenterIds.get()) {
|
||||
builder.addAll(transform(sdcClient.getMachineClientForDatacenter(datacenterId).list(),
|
||||
builder.addAll(transform(cloudApiClient.getMachineClientForDatacenter(datacenterId).list(),
|
||||
new Function<Machine, MachineInDatacenter>() {
|
||||
|
||||
@Override
|
||||
|
@ -161,7 +161,7 @@ public class SDCComputeServiceAdapter implements
|
|||
@Override
|
||||
public MachineInDatacenter getNode(String id) {
|
||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||
Machine machine = sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
||||
Machine machine = cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
||||
datacenterAndId.getId());
|
||||
return machine == null ? null : new MachineInDatacenter(machine, datacenterAndId.getDatacenter());
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public class SDCComputeServiceAdapter implements
|
|||
@Override
|
||||
public DatasetInDatacenter getImage(String id) {
|
||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||
Dataset dataset = sdcClient.getDatasetClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
||||
Dataset dataset = cloudApiClient.getDatasetClientForDatacenter(datacenterAndId.getDatacenter()).get(
|
||||
datacenterAndId.getId());
|
||||
return dataset == null ? null : new DatasetInDatacenter(dataset, datacenterAndId.getDatacenter());
|
||||
}
|
||||
|
@ -177,26 +177,26 @@ public class SDCComputeServiceAdapter implements
|
|||
@Override
|
||||
public void destroyNode(String id) {
|
||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||
sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).delete(datacenterAndId.getId());
|
||||
cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).delete(datacenterAndId.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rebootNode(String id) {
|
||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||
sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).reboot(datacenterAndId.getId());
|
||||
cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).reboot(datacenterAndId.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeNode(String id) {
|
||||
DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
|
||||
sdcClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).stop(datacenterAndId.getId());
|
||||
cloudApiClient.getMachineClientForDatacenter(datacenterAndId.getDatacenter()).stop(datacenterAndId.getId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspendNode(String 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
|
||||
* 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.util.Map;
|
||||
|
@ -38,23 +38,23 @@ import org.jclouds.compute.options.TemplateOptions;
|
|||
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.SDCComputeService;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.SDCComputeServiceAdapter;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.DatasetInDatacenterToImage;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.DatasetToOperatingSystem;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.OrphanedGroupsByDatacenterId;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.functions.PackageInDatacenterToHardware;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.loaders.CreateUniqueKey;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.strategy.ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.JoyentCloudComputeService;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.JoyentCloudComputeServiceAdapter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetInDatacenterToImage;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetToOperatingSystem;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.OrphanedGroupsByDatacenterId;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.PackageInDatacenterToHardware;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.loaders.CreateUniqueKey;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.strategy.ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||
import org.jclouds.util.Iterables2;
|
||||
import org.jclouds.util.Suppliers2;
|
||||
|
||||
|
@ -73,11 +73,11 @@ import com.google.inject.TypeLiteral;
|
|||
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
|
||||
*/
|
||||
public class SDCComputeServiceContextModule extends
|
||||
public class JoyentCloudComputeServiceContextModule extends
|
||||
ComputeServiceAdapterContextModule<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -86,7 +86,7 @@ public class SDCComputeServiceContextModule extends
|
|||
super.configure();
|
||||
bind(
|
||||
new TypeLiteral<ComputeServiceAdapter<MachineInDatacenter, PackageInDatacenter, DatasetInDatacenter, Location>>() {
|
||||
}).to(SDCComputeServiceAdapter.class);
|
||||
}).to(JoyentCloudComputeServiceAdapter.class);
|
||||
|
||||
bind(new TypeLiteral<Function<MachineInDatacenter, NodeMetadata>>() {
|
||||
}).to(MachineInDatacenterToNodeMetadata.class);
|
||||
|
@ -107,11 +107,11 @@ public class SDCComputeServiceContextModule extends
|
|||
bind(new TypeLiteral<Function<Set<? extends NodeMetadata>, Multimap<String, String>>>() {
|
||||
}).to(OrphanedGroupsByDatacenterId.class);
|
||||
|
||||
bind(ComputeService.class).to(SDCComputeService.class);
|
||||
bind(TemplateOptions.class).to(SDCTemplateOptions.class);
|
||||
bind(ComputeService.class).to(JoyentCloudComputeService.class);
|
||||
bind(TemplateOptions.class).to(JoyentCloudTemplateOptions.class);
|
||||
|
||||
bind(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class).to(
|
||||
ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
|
||||
ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
|
||||
|
||||
bind(new TypeLiteral<CacheLoader<DatacenterAndName, KeyAndPrivateKey>>() {
|
||||
}).to(CreateUniqueKey.class);
|
||||
|
@ -119,7 +119,7 @@ public class SDCComputeServiceContextModule extends
|
|||
|
||||
@Override
|
||||
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
|
||||
return options.as(SDCTemplateOptions.class)
|
||||
return options.as(JoyentCloudTemplateOptions.class)
|
||||
.generateKey(injector.getInstance(
|
||||
com.google.inject.Key.get(boolean.class, Names.named(AUTOGENERATE_KEYS))));
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.checkState;
|
||||
|
@ -29,14 +29,14 @@ import org.jclouds.compute.domain.Image;
|
|||
import org.jclouds.compute.domain.ImageBuilder;
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
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
|
||||
*/
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.Map;
|
||||
|
@ -30,7 +30,7 @@ import org.jclouds.compute.domain.OperatingSystem.Builder;
|
|||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
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 com.google.common.base.Function;
|
||||
|
@ -38,7 +38,7 @@ import com.google.common.base.Splitter;
|
|||
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.
|
||||
*
|
||||
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.checkState;
|
||||
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.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndId;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.reference.Metadata;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndId;
|
||||
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.reference.Metadata;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.util.InetAddresses2;
|
||||
|
||||
|
@ -56,7 +56,7 @@ import com.google.common.base.Predicate;
|
|||
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.
|
||||
*
|
||||
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.collect.Iterables.filter;
|
||||
|
@ -29,8 +29,8 @@ import javax.inject.Inject;
|
|||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.predicates.NodePredicates;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.predicates.AllNodesInGroupTerminated;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.predicates.AllNodesInGroupTerminated;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Function;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.checkState;
|
||||
|
@ -30,13 +30,13 @@ import org.jclouds.compute.domain.HardwareBuilder;
|
|||
import org.jclouds.compute.domain.Processor;
|
||||
import org.jclouds.compute.domain.internal.VolumeImpl;
|
||||
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.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.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
@ -55,7 +55,7 @@ public class PackageInDatacenterToHardware implements Function<PackageInDatacent
|
|||
Location location = locationIndex.get().get(pkgInDatacenter.getDatacenter());
|
||||
checkState(location != null, "location %s not in locationIndex: %s", pkgInDatacenter.getDatacenter(),
|
||||
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())
|
||||
.ram(pkg.getMemorySizeMb())
|
||||
// TODO: no api call to get processors.. either hard-code or
|
|
@ -16,11 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -32,10 +32,10 @@ import org.jclouds.compute.functions.GroupNamingConvention;
|
|||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.crypto.Crypto;
|
||||
import org.jclouds.crypto.SshKeys;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.cache.CacheLoader;
|
||||
|
@ -49,14 +49,14 @@ public class CreateUniqueKey extends CacheLoader<DatacenterAndName, KeyAndPrivat
|
|||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
protected final SDCClient sdcClient;
|
||||
protected final JoyentCloudClient cloudApiClient;
|
||||
protected final GroupNamingConvention.Factory namingConvention;
|
||||
protected final Crypto crypto;
|
||||
protected final Provider<SecureRandom> secureRandom;
|
||||
|
||||
@Inject
|
||||
public CreateUniqueKey(SDCClient sdcClient, GroupNamingConvention.Factory namingConvention, Crypto crypto, Provider<SecureRandom> secureRandom) {
|
||||
this.sdcClient = checkNotNull(sdcClient, "sdcClient");
|
||||
public CreateUniqueKey(JoyentCloudClient cloudApiClient, GroupNamingConvention.Factory namingConvention, Crypto crypto, Provider<SecureRandom> secureRandom) {
|
||||
this.cloudApiClient = checkNotNull(cloudApiClient, "cloudApiClient");
|
||||
this.namingConvention = checkNotNull(namingConvention, "namingConvention");
|
||||
this.crypto = checkNotNull(crypto, "crypto");
|
||||
this.secureRandom = checkNotNull(secureRandom, "secureRandom");
|
||||
|
@ -77,7 +77,7 @@ public class CreateUniqueKey extends CacheLoader<DatacenterAndName, KeyAndPrivat
|
|||
while (key == null) {
|
||||
String name = namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix);
|
||||
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) {
|
||||
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
|
||||
* 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.Predicates.and;
|
||||
|
@ -28,7 +28,7 @@ import static org.jclouds.compute.predicates.NodePredicates.locationId;
|
|||
import javax.inject.Inject;
|
||||
|
||||
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;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.checkNotNull;
|
||||
|
@ -39,9 +39,9 @@ import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
|
|||
import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
|
||||
import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
@ -51,13 +51,13 @@ import com.google.common.collect.Multimap;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Singleton
|
||||
public class ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet extends
|
||||
public class ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet extends
|
||||
CreateNodesWithGroupEncodedIntoNameThenAddToSet {
|
||||
|
||||
private final LoadingCache<DatacenterAndName, KeyAndPrivateKey> keyCache;
|
||||
|
||||
@Inject
|
||||
protected ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
|
||||
protected ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
|
||||
CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
|
||||
ListNodesStrategy listNodesStrategy,
|
||||
GroupNamingConvention.Factory namingConvention,
|
||||
|
@ -75,7 +75,7 @@ public class ApplySDCTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddTo
|
|||
|
||||
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";
|
||||
|
|
@ -16,13 +16,13 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 org.jclouds.joyent.sdc.v6_5.features.DatacenterAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.suppliers.ZoneIdToURIFromDatacentersClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.suppliers.ZoneIdToURIFromDatacentersClient;
|
||||
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
||||
import org.jclouds.location.suppliers.ZoneIdToURISupplier;
|
||||
import org.jclouds.location.suppliers.ZoneIdsSupplier;
|
|
@ -16,15 +16,15 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.util.Map;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.functions.internal.SDCTypeAdapters;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.functions.internal.JoyentCloudTypeAdapters;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.AbstractModule;
|
||||
|
@ -33,13 +33,13 @@ import com.google.inject.Provides;
|
|||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class SDCParserModule extends AbstractModule {
|
||||
public class JoyentCloudParserModule extends AbstractModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public Map<Type, Object> provideCustomAdapterBindings() {
|
||||
return ImmutableMap.<Type, Object> of(Machine.State.class, new SDCTypeAdapters.MachineStateAdapter(), Type.class,
|
||||
new SDCTypeAdapters.SDCTypeAdapter());
|
||||
return ImmutableMap.<Type, Object> of(Machine.State.class, new JoyentCloudTypeAdapters.MachineStateAdapter(), Type.class,
|
||||
new JoyentCloudTypeAdapters.JoyentCloudTypeAdapter());
|
||||
}
|
||||
|
||||
@Override
|
|
@ -16,19 +16,19 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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
|
||||
*/
|
||||
public class SDCProperties {
|
||||
public class JoyentCloudProperties {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.config;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.config;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -24,19 +24,19 @@ import org.jclouds.http.HttpErrorHandler;
|
|||
import org.jclouds.http.annotation.ClientError;
|
||||
import org.jclouds.http.annotation.Redirection;
|
||||
import org.jclouds.http.annotation.ServerError;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatacenterClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.DatasetClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.KeyAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.MachineAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.MachineClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.PackageAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.PackageClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.handlers.SDCErrorHandler;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatacenterClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.KeyAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.KeyClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.MachineAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.MachineClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.PackageAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.PackageClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.handlers.JoyentCloudErrorHandler;
|
||||
import org.jclouds.json.config.GsonModule.DateAdapter;
|
||||
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
|
@ -45,12 +45,12 @@ import org.jclouds.rest.config.RestClientModule;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Configures the SDC connection.
|
||||
* Configures the JoyentCloud connection.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@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()
|
||||
.put(DatacenterClient.class, DatacenterAsyncClient.class)
|
||||
.put(KeyClient.class, KeyAsyncClient.class)
|
||||
|
@ -58,22 +58,22 @@ public class SDCRestClientModule extends RestClientModule<SDCClient, SDCAsyncCli
|
|||
.put(DatasetClient.class, DatasetAsyncClient.class)
|
||||
.put(PackageClient.class, PackageAsyncClient.class).build();
|
||||
|
||||
public SDCRestClientModule() {
|
||||
public JoyentCloudRestClientModule() {
|
||||
super(DELEGATE_MAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(DateAdapter.class).to(Iso8601DateAdapter.class);
|
||||
install(new SDCParserModule());
|
||||
install(new JoyentCloudParserModule());
|
||||
super.configure();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindErrorHandlers() {
|
||||
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(SDCErrorHandler.class);
|
||||
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(SDCErrorHandler.class);
|
||||
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(SDCErrorHandler.class);
|
||||
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(JoyentCloudErrorHandler.class);
|
||||
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(JoyentCloudErrorHandler.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;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
* Listing of a dataset.
|
||||
*
|
||||
* @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> {
|
||||
|
|
@ -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;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import com.google.common.base.Objects;
|
|||
* CloudAPI supports uploads of public keys in the OpenSSH format.
|
||||
*
|
||||
* @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> {
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
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 com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -42,7 +42,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
* Listing of a machine.
|
||||
*
|
||||
* @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> {
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.gson.annotations.SerializedName;
|
||||
|
@ -25,7 +25,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
* Listing of a package.
|
||||
*
|
||||
* @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> {
|
||||
|
|
@ -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;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.checkNotNull;
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.Preconditions.checkArgument;
|
|
@ -16,11 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
|
@ -16,11 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
|
@ -16,11 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -24,14 +24,14 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
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());
|
||||
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;
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.util.Map;
|
||||
|
@ -40,7 +40,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
*
|
||||
* @see DatacenterClient
|
||||
* @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({ '/', '=' })
|
||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.util.Map;
|
||||
|
@ -29,7 +29,7 @@ import org.jclouds.concurrent.Timeout;
|
|||
*
|
||||
* @see DatacenterAsyncClient
|
||||
* @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)
|
||||
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;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import javax.ws.rs.PathParam;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
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.Headers;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
|
@ -25,7 +25,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
*
|
||||
* @author Gerald Pereira
|
||||
* @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({ '/', '=' })
|
||||
@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.concurrent.TimeUnit;
|
||||
|
||||
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.
|
||||
|
@ -12,7 +12,7 @@ import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
|||
*
|
||||
* @author Gerald Pereira
|
||||
* @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)
|
||||
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;
|
||||
|
||||
|
@ -11,8 +11,8 @@ import javax.ws.rs.PathParam;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.http.filters.BasicAuthentication;
|
||||
import org.jclouds.joyent.sdc.v6_5.binders.BindKeyToJsonPayload;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.binders.BindKeyToJsonPayload;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.Headers;
|
||||
|
@ -26,7 +26,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
/**
|
||||
* @author Adrian Cole
|
||||
* @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({ '/', '=' })
|
||||
@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.concurrent.TimeUnit;
|
||||
|
||||
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
|
||||
|
@ -12,7 +12,7 @@ import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
* @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)
|
||||
public interface KeyClient {
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.features;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -31,8 +31,8 @@ import javax.ws.rs.QueryParam;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.http.filters.BasicAuthentication;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.Headers;
|
||||
import org.jclouds.rest.annotations.Payload;
|
||||
|
@ -50,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
*
|
||||
* @author Gerald Pereira
|
||||
* @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({ '/', '=' })
|
||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
||||
|
@ -129,7 +129,7 @@ public interface MachineAsyncClient {
|
|||
@Produces(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
@Path("/my/machines/{id}")
|
||||
@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
|
|
@ -16,14 +16,14 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Machine.
|
||||
|
@ -31,7 +31,7 @@ import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
|||
*
|
||||
* @author Gerald Pereira
|
||||
* @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)
|
||||
public interface MachineClient {
|
||||
|
@ -121,10 +121,10 @@ public interface MachineClient {
|
|||
*
|
||||
* @param id
|
||||
* the id of the machine to resize
|
||||
* @param packageSDC
|
||||
* @param packageJoyentCloud
|
||||
* 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
|
|
@ -1,4 +1,4 @@
|
|||
package org.jclouds.joyent.sdc.v6_5.features;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.features;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
*
|
||||
* @author Gerald Pereira
|
||||
* @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({ '/', '=' })
|
||||
@Headers(keys = "X-Api-Version", values = "{jclouds.api-version}")
|
||||
|
@ -37,7 +37,7 @@ public interface PackageAsyncClient {
|
|||
@Path("/my/packages")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@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
|
||||
|
@ -46,5 +46,5 @@ public interface PackageAsyncClient {
|
|||
@Path("/my/packages/{name}")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@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.concurrent.TimeUnit;
|
||||
|
@ -11,7 +11,7 @@ import org.jclouds.concurrent.Timeout;
|
|||
*
|
||||
* @author Gerald Pereira
|
||||
* @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)
|
||||
public interface PackageClient {
|
||||
|
@ -21,7 +21,7 @@ public interface PackageClient {
|
|||
*
|
||||
* @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.
|
||||
|
@ -30,5 +30,5 @@ public interface PackageClient {
|
|||
* the name of the package
|
||||
* @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
|
||||
* 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 org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
@ -30,7 +30,7 @@ import com.google.gson.stream.JsonWriter;
|
|||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class SDCTypeAdapters {
|
||||
public class JoyentCloudTypeAdapters {
|
||||
|
||||
public static class MachineStateAdapter extends TypeAdapter<Machine.State> {
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class SDCTypeAdapters {
|
|||
}
|
||||
}
|
||||
|
||||
public static class SDCTypeAdapter extends TypeAdapter<Type> {
|
||||
public static class JoyentCloudTypeAdapter extends TypeAdapter<Type> {
|
||||
@Override
|
||||
public void write(JsonWriter writer, Type value) throws IOException {
|
||||
writer.value(value.value());
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -37,7 +37,7 @@ import org.jclouds.rest.ResourceNotFoundException;
|
|||
*/
|
||||
// TODO: is there error spec someplace? let's type errors, etc.
|
||||
@Singleton
|
||||
public class SDCErrorHandler implements HttpErrorHandler {
|
||||
public class JoyentCloudErrorHandler implements HttpErrorHandler {
|
||||
public void handleError(HttpCommand command, HttpResponse response) {
|
||||
// it is important to always read fully and close streams
|
||||
byte[] data = closeClientButKeepContentStream(response);
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.Preconditions.checkNotNull;
|
||||
|
@ -24,7 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import java.util.Map;
|
||||
|
||||
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 com.google.common.base.Function;
|
|
@ -16,11 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.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.util.Map;
|
||||
|
@ -6,7 +6,7 @@ import java.util.Map;
|
|||
import javax.inject.Inject;
|
||||
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.util.Suppliers2;
|
||||
|
|
@ -0,0 +1 @@
|
|||
org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApiMetadata
|
|
@ -16,10 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5;
|
||||
package org.jclouds.joyent.cloudapi.v6_5;
|
||||
|
||||
import org.jclouds.View;
|
||||
import org.jclouds.apis.internal.BaseApiMetadataTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApiMetadata;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -29,9 +30,9 @@ import com.google.common.reflect.TypeToken;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "SDCApiMetadataTest")
|
||||
public class SDCApiMetadataTest extends BaseApiMetadataTest {
|
||||
public SDCApiMetadataTest() {
|
||||
super(new SDCApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
|
||||
@Test(groups = "unit", testName = "JoyentCloudApiMetadataTest")
|
||||
public class JoyentCloudApiMetadataTest extends BaseApiMetadataTest {
|
||||
public JoyentCloudApiMetadataTest() {
|
||||
super(new JoyentCloudApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
|
||||
}
|
||||
}
|
|
@ -16,11 +16,12 @@
|
|||
* specific language governing permisions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5;
|
||||
package org.jclouds.joyent.cloudapi.v6_5;
|
||||
|
||||
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 com.google.common.collect.ImmutableSet;
|
||||
|
@ -28,12 +29,12 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "SDCClientExpectTest")
|
||||
public class SDCClientExpectTest extends BaseSDCClientExpectTest {
|
||||
@Test(groups = "unit", testName = "JoyentCloudClientExpectTest")
|
||||
public class JoyentCloudClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||
|
||||
public void testGetConfiguredDatacenters() {
|
||||
|
||||
SDCClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||
JoyentCloudClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||
|
||||
assertEquals(
|
||||
clientWhenDatacentersExists.getConfiguredDatacenters(),
|
|
@ -16,23 +16,23 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5;
|
||||
package org.jclouds.joyent.cloudapi.v6_5;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", testName = "SDCClientLiveTest")
|
||||
public class SDCClientLiveTest extends BaseSDCClientLiveTest {
|
||||
@Test(groups = "live", testName = "JoyentCloudClientLiveTest")
|
||||
public class JoyentCloudClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||
|
||||
public void testGetDatacenters() {
|
||||
Set<String> dcs = sdcContext.getApi().getConfiguredDatacenters();
|
||||
assertEquals(dcs, sdcContext.getApi().getDatacenterClient().getDatacenters().keySet());
|
||||
Set<String> dcs = cloudApiContext.getApi().getConfiguredDatacenters();
|
||||
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.sshj.config.SshjSshClientModule;
|
||||
|
@ -10,11 +10,11 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "SDCComputeServiceLiveTest")
|
||||
public class SDCComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||
@Test(groups = "live", singleThreaded = true, testName = "JoyentCloudComputeServiceLiveTest")
|
||||
public class JoyentCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||
|
||||
public SDCComputeServiceLiveTest() {
|
||||
provider = "joyent-sdc";
|
||||
public JoyentCloudComputeServiceLiveTest() {
|
||||
provider = "joyent-cloudapi";
|
||||
}
|
||||
|
||||
@Override
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -27,9 +27,10 @@ import org.jclouds.compute.domain.OsFamily;
|
|||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatasetInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseDatasetTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetInDatacenterToImage;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
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 com.google.common.base.Function;
|
||||
|
@ -39,15 +40,15 @@ import com.google.common.base.Suppliers;
|
|||
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
|
||||
*/
|
||||
@Test(testName = "DatasetInDatacenterToHardwareTest")
|
||||
public class DatasetInDatacenterToImageTest {
|
||||
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc")
|
||||
.description("joyent-sdc").build();
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi")
|
||||
.description("joyent-cloudapi").build();
|
||||
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(LocationScope.ZONE)
|
||||
.parent(provider).build();
|
||||
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.assertTrue;
|
||||
|
@ -25,14 +25,15 @@ import java.util.Map;
|
|||
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseDatasetTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.DatasetToOperatingSystem;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseDatasetTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
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.
|
||||
*
|
||||
* @author Adrian Cole
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.assertNotNull;
|
||||
|
@ -36,10 +36,11 @@ import org.jclouds.compute.functions.GroupNamingConvention;
|
|||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.config.SDCComputeServiceContextModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseCreatedMachineTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.config.JoyentCloudComputeServiceContextModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
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 com.google.common.base.Supplier;
|
||||
|
@ -49,7 +50,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
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.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
@ -57,8 +58,8 @@ import com.google.inject.Guice;
|
|||
@Test(testName = "MachineInDatacenterToNodeMetadataTest")
|
||||
public class MachineInDatacenterToNodeMetadataTest {
|
||||
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc")
|
||||
.description("joyent-sdc").build();
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi")
|
||||
.description("joyent-cloudapi").build();
|
||||
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(LocationScope.ZONE)
|
||||
.parent(provider).build();
|
||||
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");
|
||||
|
||||
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
||||
SDCComputeServiceContextModule.toPortableNodeStatus, locationIndex,
|
||||
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
|
||||
Suppliers.<Set<? extends Image>> ofInstance(images),
|
||||
Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
|
||||
|
||||
|
@ -125,7 +126,7 @@ public class MachineInDatacenterToNodeMetadataTest {
|
|||
|
||||
assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);
|
||||
|
||||
assertEquals(SDCComputeServiceContextModule.toPortableNodeStatus.get(machineToConvert.getState()),
|
||||
assertEquals(JoyentCloudComputeServiceContextModule.toPortableNodeStatus.get(machineToConvert.getState()),
|
||||
convertedNodeMetadata.getStatus());
|
||||
|
||||
assertNotNull(convertedNodeMetadata.getPrivateAddresses());
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -30,11 +30,13 @@ import org.jclouds.compute.functions.GroupNamingConvention;
|
|||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.config.SDCComputeServiceContextModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine.State;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.MachineInDatacenter;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseMachineTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.config.JoyentCloudComputeServiceContextModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.MachineInDatacenterToNodeMetadata;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.OrphanedGroupsByDatacenterId;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine.State;
|
||||
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 com.google.common.base.Predicates;
|
||||
|
@ -53,8 +55,8 @@ import com.google.inject.Guice;
|
|||
@Test(testName = "OrphanedGroupsByDatacenterIdTest")
|
||||
public class OrphanedGroupsByDatacenterIdTest {
|
||||
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc").description(
|
||||
"joyent-sdc").build();
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi").description(
|
||||
"joyent-cloudapi").build();
|
||||
Location datacenter = new LocationBuilder().id("us-east-1").description("us-east-1").scope(
|
||||
LocationScope.ZONE).parent(provider).build();
|
||||
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
||||
|
@ -70,7 +72,7 @@ public class OrphanedGroupsByDatacenterIdTest {
|
|||
|
||||
|
||||
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
||||
SDCComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
||||
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
||||
.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
|
||||
.<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");
|
||||
|
||||
MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
|
||||
SDCComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
||||
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
|
||||
.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
|
||||
.<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.assertFalse;
|
||||
|
@ -28,8 +28,9 @@ import org.jclouds.compute.domain.Hardware;
|
|||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Package;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.PackageInDatacenter;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.functions.PackageInDatacenterToHardware;
|
||||
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 com.google.common.base.Supplier;
|
||||
|
@ -43,14 +44,14 @@ import com.google.common.collect.ImmutableMap;
|
|||
*/
|
||||
@Test(testName = "PackageInDatacenterToHardwareTest")
|
||||
public class PackageInDatacenterToHardwareTest {
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-sdc").description(
|
||||
"joyent-sdc").build();
|
||||
Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id("joyent-cloudapi").description(
|
||||
"joyent-cloudapi").build();
|
||||
Location zone = new LocationBuilder().id("us-sw-1").description("us-sw-1").scope(
|
||||
LocationScope.ZONE).parent(provider).build();
|
||||
Supplier<Map<String, Location>> locationIndex = Suppliers.<Map<String, Location>> ofInstance(ImmutableMap
|
||||
.<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();
|
||||
|
||||
@Test
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.expect;
|
||||
|
@ -43,11 +43,12 @@ import org.jclouds.crypto.Crypto;
|
|||
import org.jclouds.crypto.Pems;
|
||||
import org.jclouds.crypto.SshKeys;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.datacenterscoped.DatacenterAndName;
|
||||
import org.jclouds.joyent.sdc.v6_5.features.KeyClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.internal.KeyAndPrivateKey;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.loaders.CreateUniqueKey;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
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.Test;
|
||||
|
||||
|
@ -89,7 +90,7 @@ public class CreateUniqueKeyTest {
|
|||
|
||||
@Test
|
||||
public void testApply() {
|
||||
SDCClient sdcClient = createMock(SDCClient.class);
|
||||
JoyentCloudClient cloudApiClient = createMock(JoyentCloudClient.class);
|
||||
KeyClient keyClient = createMock(KeyClient.class);
|
||||
Crypto crypto = createMock(Crypto.class);
|
||||
KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
|
||||
|
@ -101,18 +102,18 @@ public class CreateUniqueKeyTest {
|
|||
rsaKeyPairGenerator.initialize(2048, secureRandom);
|
||||
expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair);
|
||||
|
||||
expect(sdcClient.getKeyClient()).andReturn(keyClient);
|
||||
expect(cloudApiClient.getKeyClient()).andReturn(keyClient);
|
||||
|
||||
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")),
|
||||
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
|
||||
* 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.sdc.v6_5.compute.options.SDCTemplateOptions.Builder.blockOnPort;
|
||||
import static org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions.Builder.generateKey;
|
||||
import static org.jclouds.joyent.sdc.v6_5.compute.options.SDCTemplateOptions.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.authorizePublicKey;
|
||||
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.blockOnPort;
|
||||
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.generateKey;
|
||||
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.inboundPorts;
|
||||
import static org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions.Builder.installPrivateKey;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests possible uses of SDCTemplateOptions and SDCTemplateOptions.Builder.*
|
||||
* Tests possible uses of JoyentCloudTemplateOptions and JoyentCloudTemplateOptions.Builder.*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(testName = "SDCTemplateOptionsTest")
|
||||
public class SDCTemplateOptionsTest {
|
||||
@Test(testName = "JoyentCloudTemplateOptionsTest")
|
||||
public class JoyentCloudTemplateOptionsTest {
|
||||
|
||||
public void testAs() {
|
||||
TemplateOptions options = new SDCTemplateOptions();
|
||||
assertEquals(options.as(SDCTemplateOptions.class), options);
|
||||
TemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
assertEquals(options.as(JoyentCloudTemplateOptions.class), options);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateKeyDefault() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
assert !options.shouldGenerateKey();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateKey() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions().generateKey(true);
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions().generateKey(true);
|
||||
assert options.shouldGenerateKey();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenerateKeyStatic() {
|
||||
SDCTemplateOptions options = generateKey(true);
|
||||
JoyentCloudTemplateOptions options = generateKey(true);
|
||||
assert options.shouldGenerateKey();
|
||||
}
|
||||
|
||||
// superclass tests
|
||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testinstallPrivateKeyBadFormat() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.installPrivateKey("whompy");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testinstallPrivateKey() throws IOException {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
|
||||
assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullinstallPrivateKey() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
assertEquals(options.getPrivateKey(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
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-----");
|
||||
}
|
||||
|
||||
|
@ -94,26 +95,26 @@ public class SDCTemplateOptionsTest {
|
|||
|
||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testauthorizePublicKeyBadFormat() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.authorizePublicKey("whompy");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testauthorizePublicKey() throws IOException {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.authorizePublicKey("ssh-rsa");
|
||||
assertEquals(options.getPublicKey(), "ssh-rsa");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullauthorizePublicKey() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
assertEquals(options.getPublicKey(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testauthorizePublicKeyStatic() throws IOException {
|
||||
SDCTemplateOptions options = authorizePublicKey("ssh-rsa");
|
||||
JoyentCloudTemplateOptions options = authorizePublicKey("ssh-rsa");
|
||||
assertEquals(options.getPublicKey(), "ssh-rsa");
|
||||
}
|
||||
|
||||
|
@ -124,13 +125,13 @@ public class SDCTemplateOptionsTest {
|
|||
|
||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testblockOnPortBadFormat() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.blockOnPort(-1, -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testblockOnPort() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.blockOnPort(22, 30);
|
||||
assertEquals(options.getPort(), 22);
|
||||
assertEquals(options.getSeconds(), 30);
|
||||
|
@ -139,27 +140,27 @@ public class SDCTemplateOptionsTest {
|
|||
|
||||
@Test
|
||||
public void testNullblockOnPort() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
assertEquals(options.getPort(), -1);
|
||||
assertEquals(options.getSeconds(), -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testblockOnPortStatic() {
|
||||
SDCTemplateOptions options = blockOnPort(22, 30);
|
||||
JoyentCloudTemplateOptions options = blockOnPort(22, 30);
|
||||
assertEquals(options.getPort(), 22);
|
||||
assertEquals(options.getSeconds(), 30);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testinboundPortsBadFormat() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.inboundPorts(-1, -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testinboundPorts() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
options.inboundPorts(22, 30);
|
||||
assertEquals(options.getInboundPorts()[0], 22);
|
||||
assertEquals(options.getInboundPorts()[1], 30);
|
||||
|
@ -168,13 +169,13 @@ public class SDCTemplateOptionsTest {
|
|||
|
||||
@Test
|
||||
public void testDefaultOpen22() {
|
||||
SDCTemplateOptions options = new SDCTemplateOptions();
|
||||
JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
|
||||
assertEquals(options.getInboundPorts()[0], 22);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testinboundPortsStatic() {
|
||||
SDCTemplateOptions options = inboundPorts(22, 30);
|
||||
JoyentCloudTemplateOptions options = inboundPorts(22, 30);
|
||||
assertEquals(options.getInboundPorts()[0], 22);
|
||||
assertEquals(options.getInboundPorts()[1], 30);
|
||||
}
|
|
@ -16,15 +16,15 @@
|
|||
* specific language governing permisions and limitations
|
||||
* 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 java.net.URI;
|
||||
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
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 com.google.common.collect.ImmutableMap;
|
||||
|
@ -33,11 +33,11 @@ import com.google.common.collect.ImmutableMap;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "DatacenterClientExpectTest")
|
||||
public class DatacenterClientExpectTest extends BaseSDCClientExpectTest {
|
||||
public class DatacenterClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||
|
||||
public void testGetDatacentersWhenResponseIs2xx() {
|
||||
|
||||
SDCClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||
JoyentCloudClient clientWhenDatacentersExists = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||
|
||||
assertEquals(
|
||||
clientWhenDatacentersExists.getDatacenterClient().getDatacenters(),
|
||||
|
@ -50,7 +50,7 @@ public class DatacenterClientExpectTest extends BaseSDCClientExpectTest {
|
|||
public void testGetDatacentersWhenResponseIs404() {
|
||||
HttpResponse getDatacentersResponse = HttpResponse.builder().statusCode(404).build();
|
||||
|
||||
SDCClient getDatacentersWhenNone = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||
JoyentCloudClient getDatacentersWhenNone = requestSendsResponse(getDatacenters, getDatacentersResponse);
|
||||
|
||||
assertEquals(getDatacentersWhenNone.getDatacenterClient().getDatacenters(), ImmutableMap.of());
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.assertTrue;
|
||||
|
@ -24,17 +24,17 @@ import static org.testng.Assert.assertTrue;
|
|||
import java.net.URI;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", testName = "DatacenterClientLiveTest")
|
||||
public class DatacenterClientLiveTest extends BaseSDCClientLiveTest {
|
||||
public class DatacenterClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||
|
||||
public void testGetDatacenters() {
|
||||
Map<String, URI> dcs = sdcContext.getApi().getDatacenterClient().getDatacenters();
|
||||
Map<String, URI> dcs = cloudApiContext.getApi().getDatacenterClient().getDatacenters();
|
||||
assertNotNull(dcs);
|
||||
assertTrue(dcs.size() > 0);
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permisions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -24,9 +24,9 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseDatasetListTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseDatasetListTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
* @author Gerald Pereira
|
||||
*/
|
||||
@Test(groups = "unit", testName = "DatasetClientExpectTest")
|
||||
public class DatasetClientExpectTest extends BaseSDCClientExpectTest {
|
||||
public class DatasetClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
||||
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")
|
||||
|
@ -46,7 +46,7 @@ public class DatasetClientExpectTest extends BaseSDCClientExpectTest {
|
|||
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
||||
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()
|
||||
.expected().toString());
|
||||
|
@ -55,7 +55,7 @@ public class DatasetClientExpectTest extends BaseSDCClientExpectTest {
|
|||
public void testListDatasetsWhenResponseIs404() {
|
||||
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());
|
||||
}
|
|
@ -16,26 +16,27 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 java.util.Set;
|
||||
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.DatasetClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Gerald Pereira
|
||||
*/
|
||||
@Test(groups = "live", testName = "DatasetClientLiveTest")
|
||||
public class DatasetClientLiveTest extends BaseSDCClientLiveTest {
|
||||
public class DatasetClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||
|
||||
@Test
|
||||
public void testListAndGetDatasets() throws Exception {
|
||||
for (String datacenterId : sdcContext.getApi().getConfiguredDatacenters()) {
|
||||
DatasetClient client = sdcContext.getApi().getDatasetClientForDatacenter(datacenterId);
|
||||
for (String datacenterId : cloudApiContext.getApi().getConfiguredDatacenters()) {
|
||||
DatasetClient client = cloudApiContext.getApi().getDatasetClientForDatacenter(datacenterId);
|
||||
Set<Dataset> response = client.list();
|
||||
assert null != response;
|
||||
for (Dataset dataset : response) {
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permisions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -24,10 +24,10 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseKeyListTest;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseKeyTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseKeyListTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseKeyTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "KeyClientExpectTest")
|
||||
public class KeyClientExpectTest extends BaseSDCClientExpectTest {
|
||||
public class KeyClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
||||
URI.create("https://api.joyentcloud.com/my/keys")).headers(
|
||||
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(
|
||||
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());
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class KeyClientExpectTest extends BaseSDCClientExpectTest {
|
|||
public void testListKeysWhenResponseIs404() {
|
||||
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());
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class KeyClientExpectTest extends BaseSDCClientExpectTest {
|
|||
.payload(payloadFromResourceWithContentType("/key.json", "application/json; charset=UTF-8"))
|
||||
.build();
|
||||
|
||||
SDCClient clientWithNewKey = requestsSendResponses(getDatacenters, getDatacentersResponse, create, createResponse);
|
||||
JoyentCloudClient clientWithNewKey = requestsSendResponses(getDatacenters, getDatacentersResponse, create, createResponse);
|
||||
|
||||
assertEquals(clientWithNewKey.getKeyClient().create(new ParseKeyTest().expected())
|
||||
.toString(), new ParseKeyTest().expected().toString());
|
|
@ -16,15 +16,16 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 java.util.Set;
|
||||
|
||||
import org.jclouds.crypto.SshKeys;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
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.Test;
|
||||
|
||||
|
@ -32,11 +33,11 @@ import org.testng.annotations.Test;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "KeyClientLiveTest")
|
||||
public class KeyClientLiveTest extends BaseSDCClientLiveTest {
|
||||
public class KeyClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||
|
||||
@Test
|
||||
public void testListAndGetKeys() throws Exception {
|
||||
KeyClient client = sdcContext.getApi().getKeyClient();
|
||||
KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||
Set<Key> response = client.list();
|
||||
assert null != response;
|
||||
for (Key key : response) {
|
||||
|
@ -58,7 +59,7 @@ public class KeyClientLiveTest extends BaseSDCClientLiveTest {
|
|||
}
|
||||
|
||||
public void testCreateKey() {
|
||||
KeyClient client = sdcContext.getApi().getKeyClient();
|
||||
KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||
|
||||
Key newKey = client.create(Key.builder().name(fingerprint).key(keyText).build());
|
||||
assertEquals(newKey.getName(), fingerprint);
|
||||
|
@ -71,13 +72,13 @@ public class KeyClientLiveTest extends BaseSDCClientLiveTest {
|
|||
|
||||
@Test(dependsOnMethods = "testCreateKey", expectedExceptions = IllegalStateException.class)
|
||||
public void testDuplicateKey() {
|
||||
KeyClient client = sdcContext.getApi().getKeyClient();
|
||||
KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||
client.create(Key.builder().name(fingerprint).key(keyText).build());
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testDuplicateKey")
|
||||
public void testDestroyKey() {
|
||||
final KeyClient client = sdcContext.getApi().getKeyClient();
|
||||
final KeyClient client = cloudApiContext.getApi().getKeyClient();
|
||||
client.delete(fingerprint);
|
||||
// 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
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permisions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -24,11 +24,11 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseCreatedMachineTest;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParseMachineListTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseCreatedMachineTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.parse.ParseMachineListTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
@ -38,7 +38,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
* @author Gerald Pereira
|
||||
*/
|
||||
@Test(groups = "unit", testName = "MachineClientExpectTest")
|
||||
public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
||||
public class MachineClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||
HttpRequest list = HttpRequest.builder().method("GET").endpoint(
|
||||
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")
|
||||
|
@ -48,7 +48,7 @@ public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
|||
HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload(
|
||||
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());
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
|||
public void testListMachinesWhenResponseIs404() {
|
||||
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());
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class MachineClientExpectTest extends BaseSDCClientExpectTest {
|
|||
.payload(payloadFromResourceWithContentType("/new_machine.json", "application/json; charset=UTF-8"))
|
||||
.build();
|
||||
|
||||
SDCClient clientWithNewMachine = requestsSendResponses(getDatacenters, getDatacentersResponse, createWithDataset, createWithDatasetResponse);
|
||||
JoyentCloudClient clientWithNewMachine = requestsSendResponses(getDatacenters, getDatacentersResponse, createWithDataset, createWithDatasetResponse);
|
||||
|
||||
assertEquals(
|
||||
clientWithNewMachine
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 org.testng.Assert.assertEquals;
|
||||
|
@ -29,11 +29,12 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.crypto.SshKeys;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
||||
import org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions;
|
||||
import org.jclouds.joyent.sdc.v6_5.reference.Metadata;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.MachineClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||
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.RetryablePredicate;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
|
@ -53,12 +54,12 @@ import com.google.inject.Module;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", testName = "MachineClientLiveTest")
|
||||
public class MachineClientLiveTest extends BaseSDCClientLiveTest {
|
||||
public class MachineClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||
|
||||
@Test
|
||||
public void testListAndGetMachines() throws Exception {
|
||||
for (String datacenterId : sdcContext.getApi().getConfiguredDatacenters()) {
|
||||
MachineClient client = sdcContext.getApi().getMachineClientForDatacenter(datacenterId);
|
||||
for (String datacenterId : cloudApiContext.getApi().getConfiguredDatacenters()) {
|
||||
MachineClient client = cloudApiContext.getApi().getMachineClientForDatacenter(datacenterId);
|
||||
Set<Machine> response = client.list();
|
||||
assert null != response;
|
||||
for (Machine machine : response) {
|
||||
|
@ -93,9 +94,9 @@ public class MachineClientLiveTest extends BaseSDCClientLiveTest {
|
|||
super.setupContext();
|
||||
key = SshKeys.generate();
|
||||
fingerprint = SshKeys.fingerprintPublicKey(key.get("public"));
|
||||
sdcContext.getApi().getKeyClient().create(Key.builder().name(fingerprint).key(key.get("public")).build());
|
||||
client = sdcContext.getApi().getMachineClientForDatacenter(
|
||||
Iterables.get(sdcContext.getApi().getConfiguredDatacenters(), 0));
|
||||
cloudApiContext.getApi().getKeyClient().create(Key.builder().name(fingerprint).key(key.get("public")).build());
|
||||
client = cloudApiContext.getApi().getMachineClientForDatacenter(
|
||||
Iterables.get(cloudApiContext.getApi().getConfiguredDatacenters(), 0));
|
||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 180, 1, 1, TimeUnit.SECONDS);
|
||||
machineRunning = new RetryablePredicate<Machine>(new Predicate<Machine>() {
|
||||
|
||||
|
@ -164,7 +165,7 @@ public class MachineClientLiveTest extends BaseSDCClientLiveTest {
|
|||
protected void tearDown() {
|
||||
if (machine != null)
|
||||
client.delete(machine.getId());
|
||||
sdcContext.getApi().getKeyClient().delete(fingerprint);
|
||||
cloudApiContext.getApi().getKeyClient().delete(fingerprint);
|
||||
super.tearDown();
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permisions and limitations
|
||||
* 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;
|
||||
|
||||
|
@ -24,9 +24,9 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientExpectTest;
|
||||
import org.jclouds.joyent.sdc.v6_5.parse.ParsePackageListTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientExpectTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.parse.ParsePackageListTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
* @author Gerald Pereira
|
||||
*/
|
||||
@Test(groups = "unit", testName = "PackageClientExpectTest")
|
||||
public class PackageClientExpectTest extends BaseSDCClientExpectTest {
|
||||
public class PackageClientExpectTest extends BaseJoyentCloudClientExpectTest {
|
||||
HttpRequest list = HttpRequest
|
||||
.builder()
|
||||
.method("GET")
|
||||
|
@ -50,7 +50,7 @@ public class PackageClientExpectTest extends BaseSDCClientExpectTest {
|
|||
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
|
||||
.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());
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class PackageClientExpectTest extends BaseSDCClientExpectTest {
|
|||
public void testListPackagesWhenResponseIs404() {
|
||||
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());
|
||||
}
|
|
@ -16,26 +16,27 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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 java.util.Set;
|
||||
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Package;
|
||||
import org.jclouds.joyent.sdc.v6_5.internal.BaseSDCClientLiveTest;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Package;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.features.PackageClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.internal.BaseJoyentCloudClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Gerald Pereira
|
||||
*/
|
||||
@Test(groups = "live", testName = "PackageClientLiveTest")
|
||||
public class PackageClientLiveTest extends BaseSDCClientLiveTest {
|
||||
public class PackageClientLiveTest extends BaseJoyentCloudClientLiveTest {
|
||||
|
||||
@Test
|
||||
public void testListAndGetPackages() throws Exception {
|
||||
for (String datacenterId : sdcContext.getApi().getConfiguredDatacenters()) {
|
||||
PackageClient client = sdcContext.getApi().getPackageClientForDatacenter(datacenterId);
|
||||
for (String datacenterId : cloudApiContext.getApi().getConfiguredDatacenters()) {
|
||||
PackageClient client = cloudApiContext.getApi().getPackageClientForDatacenter(datacenterId);
|
||||
Set<Package> response = client.list();
|
||||
assert null != response;
|
||||
for (Package pkg : response) {
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.expect;
|
||||
|
@ -31,6 +31,7 @@ import org.jclouds.http.HttpCommand;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.handlers.JoyentCloudErrorHandler;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -38,8 +39,8 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "SDCErrorHandlerTest")
|
||||
public class SDCErrorHandlerTest {
|
||||
@Test(groups = "unit", testName = "JoyentCloudErrorHandlerTest")
|
||||
public class JoyentCloudErrorHandlerTest {
|
||||
|
||||
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
|
||||
Class<? extends Exception> expected) {
|
||||
|
@ -49,7 +50,7 @@ public class SDCErrorHandlerTest {
|
|||
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
|
||||
String content, Class<? extends Exception> expected) {
|
||||
|
||||
SDCErrorHandler function = new SDCErrorHandler();
|
||||
JoyentCloudErrorHandler function = new JoyentCloudErrorHandler();
|
||||
|
||||
HttpCommand command = createMockBuilder(HttpCommand.class).createMock();
|
||||
HttpRequest request = new HttpRequest(method, uri);
|
|
@ -16,24 +16,24 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.internal;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.internal;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
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.inject.Module;
|
||||
|
||||
/**
|
||||
* Base class for writing KeyStone Rest Client Expect tests
|
||||
* Base class for writing Cloud Api Rest Client Expect tests
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class BaseSDCAsyncClientExpectTest extends BaseSDCExpectTest<SDCAsyncClient> {
|
||||
public SDCAsyncClient createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
||||
return createInjector(fn, module, props).getInstance(SDCAsyncClient.class);
|
||||
public class BaseJoyentCloudAsyncClientExpectTest extends BaseJoyentCloudExpectTest<JoyentCloudAsyncClient> {
|
||||
public JoyentCloudAsyncClient createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
||||
return createInjector(fn, module, props).getInstance(JoyentCloudAsyncClient.class);
|
||||
}
|
||||
}
|
|
@ -16,22 +16,22 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.internal;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.internal;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class for writing KeyStone Rest Client Expect tests
|
||||
* Base class for writing Cloud Api Rest Client Expect tests
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class BaseSDCClientExpectTest extends BaseSDCExpectTest<SDCClient> {
|
||||
public class BaseJoyentCloudClientExpectTest extends BaseJoyentCloudExpectTest<JoyentCloudClient> {
|
||||
protected HttpRequest getDatacenters = HttpRequest
|
||||
.builder()
|
||||
.method("GET")
|
|
@ -16,11 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.joyent.sdc.v6_5.SDCAsyncClient;
|
||||
import org.jclouds.joyent.sdc.v6_5.SDCClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncClient;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudClient;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -30,30 +30,30 @@ import org.testng.annotations.Test;
|
|||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code SDCClient}
|
||||
* Tests behavior of {@code JoyentCloudClient}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live")
|
||||
public class BaseSDCClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
public class BaseJoyentCloudClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
|
||||
public BaseSDCClientLiveTest() {
|
||||
provider = "joyent-sdc";
|
||||
public BaseJoyentCloudClientLiveTest() {
|
||||
provider = "joyent-cloudapi";
|
||||
}
|
||||
|
||||
protected RestContext<SDCClient, SDCAsyncClient> sdcContext;
|
||||
protected RestContext<JoyentCloudClient, JoyentCloudAsyncClient> cloudApiContext;
|
||||
|
||||
@BeforeGroups(groups = { "integration", "live" })
|
||||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
sdcContext = view.unwrap();
|
||||
cloudApiContext = view.unwrap();
|
||||
}
|
||||
|
||||
@AfterGroups(groups = "live")
|
||||
protected void tearDown() {
|
||||
if (sdcContext != null)
|
||||
sdcContext.close();
|
||||
if (cloudApiContext != null)
|
||||
cloudApiContext.close();
|
||||
}
|
||||
|
||||
@Override
|
|
@ -16,18 +16,18 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Base class for writing SDC Expect tests
|
||||
* Base class for writing JoyentCloud Expect tests
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class BaseSDCExpectTest<T> extends BaseRestClientExpectTest<T> {
|
||||
public class BaseJoyentCloudExpectTest<T> extends BaseRestClientExpectTest<T> {
|
||||
|
||||
public BaseSDCExpectTest() {
|
||||
provider = "joyent-sdc";
|
||||
public BaseJoyentCloudExpectTest() {
|
||||
provider = "joyent-cloudapi";
|
||||
}
|
||||
}
|
|
@ -16,16 +16,16 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.core.MediaType;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.domain.JsonBall;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||
import org.jclouds.json.BaseItemParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -68,7 +68,7 @@ public class ParseCreatedMachineTest extends BaseItemParserTest<Machine> {
|
|||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -24,9 +24,9 @@ import javax.ws.rs.Consumes;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||
import org.jclouds.json.BaseSetParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -64,7 +64,7 @@ public class ParseDatasetListTest extends BaseSetParserTest<Dataset> {
|
|||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,15 +16,15 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.core.MediaType;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Dataset;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||
import org.jclouds.json.BaseItemParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -52,7 +52,7 @@ public class ParseDatasetTest extends BaseItemParserTest<Dataset> {
|
|||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -24,8 +24,8 @@ import javax.ws.rs.Consumes;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
import org.jclouds.json.BaseSetParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -58,7 +58,7 @@ public class ParseKeyListTest extends BaseSetParserTest<Key> {
|
|||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,14 +16,14 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.core.MediaType;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Key;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Key;
|
||||
import org.jclouds.json.BaseItemParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -53,7 +53,7 @@ public class ParseKeyTest extends BaseItemParserTest<Key> {
|
|||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -25,9 +25,9 @@ import javax.ws.rs.core.MediaType;
|
|||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.domain.JsonBall;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||
import org.jclouds.json.BaseSetParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -81,7 +81,7 @@ public class ParseMachineListTest extends BaseSetParserTest<Machine> {
|
|||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,16 +16,16 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.core.MediaType;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.domain.JsonBall;
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Type;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Machine;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Type;
|
||||
import org.jclouds.json.BaseItemParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -67,7 +67,7 @@ public class ParseMachineTest extends BaseItemParserTest<Machine> {
|
|||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,15 +16,15 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.joyent.sdc.v6_5.parse;
|
||||
package org.jclouds.joyent.cloudapi.v6_5.parse;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.joyent.sdc.v6_5.config.SDCParserModule;
|
||||
import org.jclouds.joyent.sdc.v6_5.domain.Package;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.config.JoyentCloudParserModule;
|
||||
import org.jclouds.joyent.cloudapi.v6_5.domain.Package;
|
||||
import org.jclouds.json.BaseSetParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -47,17 +47,17 @@ public class ParsePackageListTest extends BaseSetParserTest<Package> {
|
|||
@Override
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
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(),
|
||||
|
||||
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()
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
|
@ -16,12 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.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.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -33,7 +33,7 @@ import com.google.inject.Injector;
|
|||
* @author Gerald Pereira
|
||||
*/
|
||||
@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
|
||||
public String resource() {
|
||||
|
@ -42,13 +42,13 @@ public class ParsePackageTest extends BaseItemParserTest<org.jclouds.joyent.sdc.
|
|||
|
||||
@Override
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public org.jclouds.joyent.sdc.v6_5.domain.Package expected() {
|
||||
return org.jclouds.joyent.sdc.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
||||
public org.jclouds.joyent.cloudapi.v6_5.domain.Package expected() {
|
||||
return org.jclouds.joyent.cloudapi.v6_5.domain.Package.builder().name("Small 1GB").memorySizeMb(1024)
|
||||
.diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build();
|
||||
}
|
||||
|
||||
protected Injector injector() {
|
||||
return Guice.createInjector(new SDCParserModule(), new GsonModule() {
|
||||
return Guice.createInjector(new JoyentCloudParserModule(), new GsonModule() {
|
||||
|
||||
@Override
|
||||
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>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>joyent-sdc</artifactId>
|
||||
<artifactId>joyent-cloudapi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>joyent-sdc</artifactId>
|
||||
<artifactId>joyent-cloudapi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
|
|
|
@ -25,7 +25,7 @@ import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
|
|||
import java.net.URI;
|
||||
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.internal.BaseProviderMetadata;
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class JoyentCloudProviderMetadata extends BaseProviderMetadata {
|
|||
protected Builder() {
|
||||
id("joyentcloud")
|
||||
.name("JoyentCloud")
|
||||
.apiMetadata(new SDCApiMetadata())
|
||||
.apiMetadata(new JoyentCloudApiMetadata())
|
||||
.homepage(URI.create("http://www.joyent.com/products/smartdatacenter/"))
|
||||
.console(URI.create("https://my.joyentcloud.com/login"))
|
||||
.iso3166Codes("US-VA", "US-CA", "US-NV", "NL-NH")
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.joyent.joyentcloud;
|
||||
|
||||
import org.jclouds.joyent.sdc.v6_5.compute.SDCComputeServiceLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -26,7 +25,7 @@ import org.testng.annotations.Test;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@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() {
|
||||
provider = "joyentcloud";
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue